Search in sources :

Example 1 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class OpPatternTest method checkParser.

private void checkParser(final String description, final String oppattern, final String expected) throws BCompoundException {
    final Start ast = parser.parse(BParser.OPERATION_PATTERN_PREFIX + oppattern, false);
    final Ast2String ast2String = new Ast2String();
    ast.apply(ast2String);
    final String parsed = ast2String.toString();
    assertEquals(description, "Start(AOppatternParseUnit(" + expected + "))", parsed);
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Example 2 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class PredicatesTest method getTreeAsString.

private String getTreeAsString(final String testMachine) throws BCompoundException {
    final Start startNode = parser.parse(testMachine, false);
    final Ast2String ast2String = new Ast2String();
    startNode.apply(ast2String);
    return ast2String.toString();
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) Ast2String(util.Ast2String)

Example 3 with Ast2String

use of util.Ast2String 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;
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) BParser(de.be4.classicalb.core.parser.BParser) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Example 4 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class IfThenElseExpressionTest method getTreeAsString.

private String getTreeAsString(final String testMachine) throws BCompoundException {
    final Start startNode = parser.parse(testMachine, false);
    final Ast2String ast2String = new Ast2String();
    startNode.apply(ast2String);
    return ast2String.toString();
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) Ast2String(util.Ast2String)

Example 5 with Ast2String

use of util.Ast2String 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;
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) BParser(de.be4.classicalb.core.parser.BParser) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Aggregations

Ast2String (util.Ast2String)20 Start (de.be4.classicalb.core.parser.node.Start)19 BParser (de.be4.classicalb.core.parser.BParser)8 Definitions (de.be4.classicalb.core.parser.Definitions)2