use of de.be4.classicalb.core.parser.exceptions.BCompoundException 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.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class PrimedIdentifierTest method testPrimedIdentifiersInQuantifiers.
@Test
public void testPrimedIdentifiersInQuantifiers() throws BCompoundException {
final String testMachine = "#PREDICATE !a$0.(a$0=5 => b=6)";
try {
getTreeAsString(testMachine);
fail("exception expected");
} catch (BCompoundException e) {
assertTrue(e.getCause() instanceof BParseException);
// ok
}
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class PrimedIdentifierTest method testRestrictedUsage.
@Test
public void testRestrictedUsage() {
final String testMachine = "#SUBSTITUTION x : (x = x$5)";
try {
getTreeAsString(testMachine);
fail("exception expected");
} catch (BCompoundException e) {
assertTrue(e.getFirstException().getCause() instanceof CheckException);
// ok
}
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class StringLiteralNotClosedTest method testStringLiteralNotClosedLongString.
@Test
public void testStringLiteralNotClosedLongString() {
final String testMachine = "MACHINE Test CONSTANTS the_string PROPERTIES the_string = \"not closed" + randomString(100) + "END";
try {
getTreeAsString(testMachine);
fail("Exception did not occur");
} catch (BCompoundException e) {
System.out.println(e.getCause());
assertTrue(e.getCause() instanceof PreParseException);
assertTrue(e.getLocalizedMessage().contains("Unknown token:"));
}
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException 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;
}
Aggregations