use of de.be4.classicalb.core.parser.exceptions.BCompoundException 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.exceptions.BCompoundException in project probparsers by bendisposto.
the class ErrorMessagesTest method testKeywordAsIdentifierInUnitDeclaration.
@Test
public void testKeywordAsIdentifierInUnitDeclaration() throws Exception {
final String testMachine = "MACHINE Test CONSTANTS /*@unit*/ right PROPERTIES right = 1 END";
try {
getTreeAsString(testMachine);
fail("Invalid identifier not detected");
} catch (BCompoundException e) {
BParseException e1 = (BParseException) e.getFirstException().getCause();
assertTrue(e1.getToken().getText().equals("right"));
}
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class ErrorMessagesTest method testKeywordAsIdentifierInSigma.
@Test
public void testKeywordAsIdentifierInSigma() throws Exception {
final String testMachine = "#EXPRESSION \nSIGMA(a, left).(a= 1& left= 2| {1} )";
try {
getTreeAsString(testMachine);
fail("Invalid identifier not detected");
} catch (BCompoundException e) {
BParseException e1 = (BParseException) e.getFirstException().getCause();
assertTrue(e1.getToken().getText().equals("left"));
}
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class PrimedIdentifierTest method getTreeAsString.
private String getTreeAsString(final String testMachine) throws BCompoundException {
final Start startNode = parser.parse(testMachine, false);
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
return ast2String.toString();
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class PrimedIdentifierTest method testDontPrimedIdentifiersInQuantifiers.
@Test
public void testDontPrimedIdentifiersInQuantifiers() {
final String testMachine = "#PREDICATE !a$0.(a=5 => b=6)";
try {
getTreeAsString(testMachine);
fail("exception expected");
} catch (BCompoundException e) {
assertTrue(e.getFirstException().getCause() instanceof BParseException);
// ok
}
}
Aggregations