use of de.be4.classicalb.core.parser.BParser in project probparsers by bendisposto.
the class StructuralTest method testClausesStructure.
@Test
public void testClausesStructure() throws Exception {
final String testMachine = "MACHINE SimplyStructure\n" + "VARIABLES aa, b, Cc\n" + "INVARIANT aa : NAT\n" + "INITIALISATION aa:=1\n" + "CONSTANTS dd, e, Ff\n" + "PROPERTIES dd : NAT\n" + "SETS GGG; Hhh; JJ = {dada, dudu, TUTUT}; iII; kkk = {LLL}\nEND";
// System.out.println("Parsing: \"" + testMachine + "\":");
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, true);
assertNotNull(startNode);
// TODO more tests
}
use of de.be4.classicalb.core.parser.BParser 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.parser.BParser 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.parser.BParser 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.parser.BParser 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