use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class TheoriesIssuesTest method testCommentPredicates1.
@Test
public void testCommentPredicates1() throws Exception {
final Start rootNode = parseInput("context C4 \naxioms\n@axm2 {1↦1,2↦2} = seqAppend({1↦1},2)\nend", false);
final AContextParseUnit parseUnit = (AContextParseUnit) rootNode.getPParseUnit();
final LinkedList<PAxiom> axioms = parseUnit.getAxioms();
final AAxiom axiom = (AAxiom) axioms.get(0);
assertEquals("{1↦1,2↦2} = seqAppend({1↦1},2)", axiom.getPredicate().getText());
}
use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class LTLFormulaVisitor method handleQuantification.
private void handleQuantification(de.be4.ltl.core.parser.node.Node node, String parameterName, String bPredicateString, PLtl ltl) {
// create an identifier (b ast node) for the parameter of the
// quantification
List<TIdentifierLiteral> list = new ArrayList<TIdentifierLiteral>();
list.add(new TIdentifierLiteral(parameterName));
AIdentifierExpression parameterNode = new AIdentifierExpression(list);
// add the created identifier to the current context
Hashtable<String, AIdentifierExpression> currentContext = new Hashtable<String, AIdentifierExpression>();
currentContext.put(parameterName, parameterNode);
this.contextTable.add(currentContext);
// collection the all parameters in
ltlIdentifierTable.put(parameterName, parameterNode);
// parse the b predicate and create a reference to the b ast node
de.be4.classicalb.core.parser.node.Start start = parseBPredicate(bPredicateString);
ltlNodeToBNodeTable.put(node, start);
// collect all identifiers which can be used in the bPredicate and
// verify the bPredicate
LTLBPredicate ltlBPredicate = new LTLBPredicate(getUnifiedContext(), start);
this.bPredicates.add(ltlBPredicate);
machineContext.checkLTLBPredicate(ltlBPredicate);
// remaining LTL formula
ltl.apply(this);
// remove currentContext from contextTable
contextTable.remove(contextTable.size() - 1);
}
use of de.be4.eventb.core.parser.node.Start 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.eventb.core.parser.node.Start 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.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class CreateFreetypeTest method createMachine.
private Start createMachine(String name) {
final AFreetypesMachineClause freetypes = createFreetype();
final AConstantsMachineClause variables = new AConstantsMachineClause(createIdentifiers(VAR_NAME));
final AMemberPredicate member = new AMemberPredicate(createIdentifier(VAR_NAME), new APowSubsetExpression(createIdentifier(FREETYPE_NAME)));
final AInvariantMachineClause inv = new AInvariantMachineClause(member);
final AInitialisationMachineClause init = new AInitialisationMachineClause(createAssignment(VAR_NAME, new AEmptySetExpression()));
final AOperationsMachineClause operations = createOperations();
final AMachineHeader header = new AMachineHeader(createIdLits(name), EMPTY_EXPRS);
final AAbstractMachineParseUnit machine = new AAbstractMachineParseUnit(new AMachineMachineVariant(), header, Arrays.asList(freetypes, variables, inv, init, operations));
return new Start(machine, new EOF());
}
Aggregations