use of de.be4.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class UnparsableMachineTest method testParsable.
@Test(expected = BCompoundException.class)
public void testParsable() throws Exception {
final BParser parser = new BParser(machine.getName());
Start start = parser.parseFile(machine, false);
assertNotNull(start);
}
use of de.be4.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class Ticket295 method ticker295.
// #x. /* comment */ (x>1000 & x<2**10)
@Test
public void ticker295() throws Exception {
// String input = "#FORMULA #x. /* comment */ (x>1000 & x<2**10)";
String input1 = "#FORMULA #x. /*buh */ ( x>1000 & x<2**10)";
String input2 = "#FORMULA #x.(/*buh */ x>1000 & x<2**10)";
DefinitionTypes defTypes1 = new DefinitionTypes();
final BLexer lexer1 = new BLexer(new PushbackReader(new StringReader(input1), 99), defTypes1, input1.length());
DefinitionTypes defTypes2 = new DefinitionTypes();
final BLexer lexer2 = new BLexer(new PushbackReader(new StringReader(input2), 99), defTypes2, input2.length());
Parser parser1 = new Parser(lexer1);
Parser parser2 = new Parser(lexer2);
final Start rootNode1 = parser1.parse();
final Start rootNode2 = parser2.parse();
final String result1 = getTreeAsString(rootNode1);
final String result2 = getTreeAsString(rootNode2);
assertNotNull(rootNode1);
assertNotNull(rootNode2);
assertEquals(result1, result2);
}
use of de.be4.classicalb.core.preparser.node.Start 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.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class PushbackBufferOverflows method withoutPredVars.
@Test
public void withoutPredVars() throws Exception {
String source = "#PREDICATE procs : STRING +-> {\"waiting\",\"ready\"} & current : STRING & idle : {TRUE,FALSE} & idle = FALSE & procs /= { } & { \"waiting\" } /= { } & { \"waiting\" } /\\ ran(procs) = { } & { \"ready\" } = ran(procs)";
BParser parser = new BParser();
Start result = parser.parse(source, false);
assertNotNull(result);
}
use of de.be4.classicalb.core.preparser.node.Start in project probparsers by bendisposto.
the class PushbackBufferOverflows method withPredVars.
@Test
public void withPredVars() throws Exception {
String source = "#PREDICATE procs : STRING +-> {\"waiting\",\"ready\"} & current : STRING & idle : {TRUE,FALSE} & idle = FALSE & procs /= { } & { \"waiting\" } /= { } & { \"waiting\" } /\\ ran(procs) = { } & { \"ready\" } = ran(procs)";
BParser parser = new BParser();
Start result = parser.eparse(source, new MockedDefinitions());
assertNotNull(result);
}
Aggregations