use of de.be4.classicalb.core.parser.BParser in project probparsers by bendisposto.
the class StructuralTest method testVariablesClause.
@Test
public void testVariablesClause() throws Exception {
final String testMachine = "MACHINE SimplyStructure\nVARIABLES aa, b, Cc\nINVARIANT aa : NAT & b : NAT & Cc : NAT\nINITIALISATION aa:=1 || b:=2 || c:=3\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 StructuralTest method testSetsClause.
@Test
public void testSetsClause() throws Exception {
final String testMachine = "MACHINE SimplyStructure SETS GGG; Hhh; JJ = {dada, dudu, TUTUT}; iII; kkk = {LLL} END";
// 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 SyntaxErrorsDetectedOnTokenStreamTest 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 DropHaskellRegressionTests method test.
@Test
public void test() throws BCompoundException, IOException {
String name = "src/test/resources/parsable/InfiniteParityFunction.mch";
BParser parser = new BParser(name);
parser.parseFile(new File(name), false);
String code = "not(finite({x|x>2}))";
BParser parser2 = new BParser(name);
parser2.getDefinitions().addDefinitions(parser.getDefinitions());
Start parse = parser2.parse(BParser.FORMULA_PREFIX + " " + code, false, parser.getContentProvider());
assertNotNull(parse);
}
use of de.be4.classicalb.core.parser.BParser in project probparsers by bendisposto.
the class ParseableButProblematicOnWindowsUnixLF 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);
}
Aggregations