use of de.be4.eventbalg.core.parser.parser.Parser in project probparsers by bendisposto.
the class StructuralTest method testConstantsClause.
@Test
public void testConstantsClause() throws Exception {
final String testMachine = "MACHINE SimplyStructure\nCONSTANTS dd, e, Ff\nPROPERTIES dd : BOOL\nEND";
// System.out.println("Parsing: \"" + testMachine + "\":");
final BParser parser = new BParser("testcase");
final Start startNode = parser.parse(testMachine, false);
assertNotNull(startNode);
// TODO more tests
}
use of de.be4.eventbalg.core.parser.parser.Parser 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.eventbalg.core.parser.parser.Parser 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.eventbalg.core.parser.parser.Parser 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.eventbalg.core.parser.parser.Parser 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;
}
Aggregations