slight restructure
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package util.ast;
|
||||
package parser.ast;
|
||||
|
||||
import java.util.Objects;
|
||||
|
@ -1,13 +1,11 @@
|
||||
package parser;
|
||||
package parser.ast;
|
||||
|
||||
import parser.grammar.Grammar;
|
||||
import util.ast.AST;
|
||||
import util.ast.Node;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static util.tools.Logger.log;
|
||||
import static util.Logger.log;
|
||||
|
||||
public final class ASTCompacter {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package util.ast;
|
||||
package parser.ast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -91,6 +92,11 @@ public class Node {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void setChildren(Node... children) {
|
||||
this.children = new ArrayList<>();
|
||||
this.children.addAll(Arrays.asList(children));
|
||||
}
|
||||
|
||||
public long size() {
|
||||
int s = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package parser;
|
||||
package parser.grammar;
|
||||
|
||||
public enum Actions {
|
||||
COMPACT,
|
@ -1,4 +1,4 @@
|
||||
package util.tools;
|
||||
package util;
|
||||
|
||||
// Maximal professioneller Logger
|
||||
public final class Logger {
|
@ -4,8 +4,9 @@ import lexer.StupsLexer;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import parser.ast.AST;
|
||||
import parser.ast.ASTCompacter;
|
||||
import parser.grammar.Grammar;
|
||||
import util.ast.AST;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
@ -14,7 +15,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
class GeneralTest {
|
||||
class Demo {
|
||||
|
||||
private Lexer initLexer(String program) {
|
||||
try {
|
||||
@ -29,7 +30,7 @@ class GeneralTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testClean() throws URISyntaxException, IOException {
|
||||
void demo() throws URISyntaxException, IOException {
|
||||
Path path = Paths.get(this.getClass().getClassLoader().getResource("exampleGrammars/Grammar.grammar").toURI());
|
||||
Grammar grammar = Grammar.fromFile(path);
|
||||
LL1Parser parser = LL1Parser.fromGrammar(grammar);
|
@ -1,4 +1,4 @@
|
||||
package util.ast;
|
||||
package parser.ast;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
Reference in New Issue
Block a user