use of de.be4.classicalb.core.preparser.node.Start 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.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class ParsableMachineTest method testParsable.
@Test
public void testParsable() throws Exception {
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
start.apply(new PositionTester());
assertNotNull(start);
}
use of de.be4.classicalb.core.preparser.node.Start 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));
}
use of de.be4.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class SatProblem method getTreeAsStringOrg.
private String getTreeAsStringOrg(final String testMachine) throws BCompoundException {
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, false);
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
final String string = ast2String.toString();
return string;
}
use of de.be4.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class ConsoleTest method testFormulaOutput.
@Test
public void testFormulaOutput() throws BCompoundException {
Start start = BParser.parse("#FORMULA 1+1");
PrologTermStringOutput strOutput = new PrologTermStringOutput();
ASTProlog printer = new ASTProlog(strOutput, null);
start.apply(printer);
strOutput.fullstop();
// A Friendly Reminder: strOutput includes a newline!
String output = strOutput.toString().trim();
assertEquals(output, "add(none,integer(none,1),integer(none,1)).");
}
Aggregations