use of de.be4.classicalb.core.parser.node.Node in project prob2 by bendisposto.
the class DomBuilder method createExpressionAST.
private Start createExpressionAST(final PExpression expression) {
Start start = new Start();
AExpressionParseUnit node = new AExpressionParseUnit();
start.setPParseUnit(node);
start.setEOF(EOF);
node.setExpression((PExpression) expression.clone());
node.getExpression().apply(new RenameIdentifiers());
return start;
}
use of de.be4.classicalb.core.parser.node.Node in project prob2 by bendisposto.
the class IdentifierExtractor method union.
public static Set<String> union(final Node... assignments) {
Set<String> union = new HashSet<>();
for (Node assignment : assignments) {
IdentifierExtractor v = new IdentifierExtractor();
assignment.apply(v);
union.addAll(v.getIdentifiers());
}
return union;
}
use of de.be4.classicalb.core.parser.node.Node in project prob2 by bendisposto.
the class EventBParserBase method toPrologTerm.
private static void toPrologTerm(final IPrologTermOutput pto, final Node ast, final boolean wrap, final String wrapper) {
if (wrap) {
pto.openTerm(wrapper);
}
final ASTProlog prolog = new ASTProlog(pto, null);
ast.apply(prolog);
if (wrap) {
pto.closeTerm();
}
}
use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.
the class MachineContext method caseALetSubstitution.
@Override
public void caseALetSubstitution(ALetSubstitution node) {
contextTable.add(new LinkedHashMap<String, Node>());
List<PExpression> copy = new ArrayList<PExpression>(node.getIdentifiers());
for (PExpression e : copy) {
putLocalVariableIntoCurrentScope((AIdentifierExpression) e);
}
node.getPredicate().apply(this);
node.getSubstitution().apply(this);
}
use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.
the class MachineContext method caseAAssertionsMachineClause.
@Override
public void caseAAssertionsMachineClause(AAssertionsMachineClause node) {
this.assertiondMachineClause = node;
this.contextTable = new ArrayList<LinkedHashMap<String, Node>>();
ArrayList<MachineContext> list = lookupReferencedMachines();
for (int i = 0; i < list.size(); i++) {
MachineContext s = list.get(i);
this.contextTable.add(s.getSetParamter());
this.contextTable.add(s.getScalarParameter());
this.contextTable.add(s.getDeferredSets());
this.contextTable.add(s.getEnumeratedSets());
this.contextTable.add(s.getEnumValues());
this.contextTable.add(s.getConstants());
this.contextTable.add(s.getDefinitions());
this.contextTable.add(s.getVariables());
}
List<PPredicate> copy = new ArrayList<PPredicate>(node.getPredicates());
for (PPredicate e : copy) {
e.apply(this);
}
}
Aggregations