Search in sources :

Example 16 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class StringLiteralNotClosedTest 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) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Example 17 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class SatProblem method getTreeAsString.

private String getTreeAsString(final String testMachine) throws BCompoundException, LexerException, IOException {
    final BParser parser = new BParser("testcase");
    Start ast = parser.eparse(testMachine, new Definitions());
    final Ast2String ast2String = new Ast2String();
    ast.apply(ast2String);
    final String string = ast2String.toString();
    return string;
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) Definitions(de.be4.classicalb.core.parser.Definitions) BParser(de.be4.classicalb.core.parser.BParser) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Example 18 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class LetExpressionTest 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 19 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class PredVarsTest method getTreeAsString.

private String getTreeAsString(final String testMachine) throws BCompoundException, LexerException, IOException {
    final BParser parser = new BParser("testcase");
    Start ast = parser.eparse(testMachine, new Definitions());
    final Ast2String ast2String = new Ast2String();
    ast.apply(ast2String);
    final String string = ast2String.toString();
    return string;
}
Also used : Start(de.be4.classicalb.core.parser.node.Start) Definitions(de.be4.classicalb.core.parser.Definitions) BParser(de.be4.classicalb.core.parser.BParser) Ast2String(util.Ast2String) Ast2String(util.Ast2String)

Example 20 with Ast2String

use of util.Ast2String in project probparsers by bendisposto.

the class ExpressionTest 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)

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