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);
}
}
use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.
the class MachineContext method caseAOperationsMachineClause.
@Override
public void caseAOperationsMachineClause(AOperationsMachineClause node) {
this.operationMachineClause = 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<POperation> copy = new ArrayList<POperation>(node.getOperations());
// first collect all operations
for (POperation e : copy) {
AOperation op = (AOperation) e;
String name = Utils.getTIdentifierListAsString(op.getOpName());
// existString(name);
if (operations.keySet().contains(name)) {
throw new ScopeException(String.format("Duplicate operation: '%s'", name));
}
operations.put(name, op);
}
// visit all operations
for (POperation e : copy) {
e.apply(this);
}
}
use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.
the class MachineContext method caseAMachineHeader.
@Override
public void caseAMachineHeader(AMachineHeader node) {
this.header = node;
if (machineName == null) {
List<TIdentifierLiteral> nameList = new ArrayList<TIdentifierLiteral>(node.getName());
this.machineName = Utils.getTIdentifierListAsString(nameList);
}
List<PExpression> copy = new ArrayList<PExpression>(node.getParameters());
for (PExpression e : copy) {
AIdentifierExpression p = (AIdentifierExpression) e;
String name = Utils.getTIdentifierListAsString(p.getIdentifier());
exist(p.getIdentifier());
if (Character.isUpperCase(name.charAt(0))) {
this.machineSetParameter.put(name, p);
} else {
this.machineScalarParameter.put(name, p);
}
}
}
use of de.be4.classicalb.core.parser.node.Node in project probparsers by bendisposto.
the class MachineContext method caseAAbstractConstantsMachineClause.
@Override
public void caseAAbstractConstantsMachineClause(AAbstractConstantsMachineClause node) {
hasConstants = true;
List<PExpression> copy = new ArrayList<PExpression>(node.getIdentifiers());
for (PExpression e : copy) {
AIdentifierExpression c = (AIdentifierExpression) e;
String name = Utils.getTIdentifierListAsString(c.getIdentifier());
exist(c.getIdentifier());
constants.put(name, c);
}
}
Aggregations