use of de.be4.eventbalg.core.parser.analysis.ASTPrinter in project probparsers by bendisposto.
the class DefinitionsErrorsTest method getTreeAsString.
private String getTreeAsString(final String testMachine) throws BCompoundException {
// System.out.println("Parsing: \"" + testMachine + "\":");
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, false);
// startNode.apply(new ASTPrinter());
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
final String string = ast2String.toString();
// System.out.println();
return string;
}
use of de.be4.eventbalg.core.parser.analysis.ASTPrinter in project probparsers by bendisposto.
the class FilePragmaTest method getTreeAsString.
private String getTreeAsString(final String testMachine) throws BCompoundException {
// System.out.println("Parsing \"" + testMachine + "\"");
final BParser parser = new BParser("testcase");
parser.getOptions().setGrammar(RulesGrammar.getInstance());
final Start startNode = parser.parse(testMachine, false);
// startNode.apply(new ASTPrinter());
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
final String string = ast2String.toString();
// System.out.println(string);
return string;
}
use of de.be4.eventbalg.core.parser.analysis.ASTPrinter in project probparsers by bendisposto.
the class ErrorMessagesTest method getTreeAsString.
private String getTreeAsString(final String testMachine) throws BCompoundException {
// System.out.println("Parsing \"" + testMachine + "\"");
final BParser parser = new BParser("testcase");
parser.getOptions().setGrammar(RulesGrammar.getInstance());
final Start startNode = parser.parse(testMachine, false);
// startNode.apply(new ASTPrinter());
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
final String string = ast2String.toString();
// System.out.println(string);
return string;
}
use of de.be4.eventbalg.core.parser.analysis.ASTPrinter in project probparsers by bendisposto.
the class ExploreSourcePositionTest method test.
@Test
public void test() throws BCompoundException, IOException {
final BParser parser = new BParser("m");
Start parse = parser.parseFile(new File("src/test/resources/LabelTest.mch"), false);
parse.apply(new ASTPrinter());
assertTrue(true);
}
use of de.be4.eventbalg.core.parser.analysis.ASTPrinter in project probparsers by bendisposto.
the class UnitPragmaTest method testUnitAlias.
@Test
public void testUnitAlias() throws Exception {
String input = "/*@ unit_alias kmph \"km/h\" */ MACHINE UnitAlias VARIABLES lala INVARIANT lala=0 INITIALISATION lala:=0 END";
BLexer lex = new BLexer(new PushbackReader(new StringReader(input), 500));
Token t;
while (!((t = lex.next()) instanceof EOF)) {
System.out.print(t.getClass().getSimpleName() + "(" + t.getText() + ")");
System.out.print(" ");
}
BParser p = new BParser();
Start ast = p.parse(input, false);
ASTPrinter pr = new ASTPrinter();
ast.apply(pr);
System.out.println(printAST(ast));
}
Aggregations