use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class LTLFormulaVisitor method parseBPredicate.
private de.be4.classicalb.core.parser.node.Start parseBPredicate(String text) {
String bPredicate = "#PREDICATE " + text;
BParser parser = new BParser("Testing");
de.be4.classicalb.core.parser.node.Start start = null;
try {
start = parser.parse(bPredicate, false);
} catch (BCompoundException e) {
throw new LTLParseException(e.getMessage());
}
return start;
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class ASTPrologTest method checkProlog.
private void checkProlog(final int counter, final String bspec, final String expected) throws BCompoundException {
final BParser parser = new BParser("testcase");
if (remove_restrictions) {
parser.getOptions().setRestrictProverExpressions(false);
}
final Start startNode = parser.parse(bspec, false, new NoContentProvider());
checkAST(counter, expected, startNode);
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class ASTPrologTest method testTrueFalse.
@Test
public void testTrueFalse() throws BCompoundException {
checkPredicate("TRUE : BOOL", "member($,boolean_true($),bool_set($))");
checkPredicate("FALSE : BOOL", "member($,boolean_false($),bool_set($))");
final ADisjunctPredicate disjunction = new ADisjunctPredicate();
disjunction.setLeft(new ATruthPredicate());
disjunction.setRight(new AFalsityPredicate());
checkAST(0, "disjunct($,truth($),falsity($))", disjunction);
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class ASTPrologTest method testFreeType.
@Test
public void testFreeType() throws BCompoundException {
final AConstructorFreetypeConstructor multi = new AConstructorFreetypeConstructor(new TIdentifierLiteral("multi"), new APowSubsetExpression(new AIntegerSetExpression()));
final AConstructorFreetypeConstructor single = new AConstructorFreetypeConstructor(new TIdentifierLiteral("single"), new AIntegerSetExpression());
final AFreetype freetype = new AFreetype(new TIdentifierLiteral("T"), Arrays.<PFreetypeConstructor>asList(multi, single));
AFreetypesMachineClause clause = new AFreetypesMachineClause(Arrays.<PFreetype>asList(freetype));
final StringWriter swriter = new StringWriter();
NodeIdAssignment nodeids = new NodeIdAssignment();
clause.apply(nodeids);
IPrologTermOutput pout = new PrologTermOutput(new PrintWriter(swriter), false);
PositionPrinter pprinter = new ClassicalPositionPrinter(nodeids);
ASTProlog prolog = new ASTProlog(pout, pprinter);
clause.apply(prolog);
String code = swriter.toString();
assertFalse(code.isEmpty());
assertEquals("freetypes(0,[freetype(1,'T',[constructor(2,multi,pow_subset(3,integer_set(4))),constructor(5,single,integer_set(6))])])", code);
}
use of de.be4.classicalb.core.parser.exceptions.BCompoundException in project probparsers by bendisposto.
the class ExpressionTest method testQuantifiedUnionExpression.
@Test
public void testQuantifiedUnionExpression() throws Exception {
final String testMachine = "#EXPRESSION UNION x.y.(x=0 | x )";
try {
getTreeAsString(testMachine);
fail("Invalid renaming of identifier not detected");
} catch (BCompoundException e) {
}
}
Aggregations