use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.
the class MachineContext method caseAConstantsMachineClause.
@Override
public void caseAConstantsMachineClause(AConstantsMachineClause 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);
}
}
use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.
the class MachineContext method visitBDefinition.
public void visitBDefinition(Node node, String name, List<PExpression> copy, Node rightSide) {
if (!this.definitions.containsValue(node)) {
return;
}
contextTable.add(new LinkedHashMap<String, Node>());
for (PExpression e : copy) {
putLocalVariableIntoCurrentScope((AIdentifierExpression) e);
}
rightSide.apply(this);
contextTable.remove(contextTable.size() - 1);
}
use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.
the class MachineContext method caseAAnySubstitution.
@Override
public void caseAAnySubstitution(AAnySubstitution node) {
contextTable.add(new LinkedHashMap<String, Node>());
List<PExpression> copy = new ArrayList<PExpression>(node.getIdentifiers());
for (PExpression e : copy) {
putLocalVariableIntoCurrentScope((AIdentifierExpression) e);
}
node.getWhere().apply(this);
node.getThen().apply(this);
}
use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.
the class MachineContext method caseAOpSubstitution.
@Override
public void caseAOpSubstitution(AOpSubstitution node) {
if (node.getName() != null) {
AIdentifierExpression op = (AIdentifierExpression) node.getName();
String name = Utils.getTIdentifierListAsString(op.getIdentifier());
Node o = operations.get(name);
if (o != null) {
this.referencesTable.put(op, o);
} else {
throw new ScopeException("Unknown operation '" + name + "'");
}
}
{
List<PExpression> copy = new ArrayList<PExpression>(node.getParameters());
for (PExpression e : copy) {
e.apply(this);
}
}
}
use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.
the class MachineContext method caseAVariablesMachineClause.
@Override
public void caseAVariablesMachineClause(AVariablesMachineClause node) {
List<PExpression> copy = new ArrayList<PExpression>(node.getIdentifiers());
for (PExpression e : copy) {
AIdentifierExpression v = (AIdentifierExpression) e;
String name = Utils.getTIdentifierListAsString(v.getIdentifier());
exist(v.getIdentifier());
variables.put(name, v);
}
}
Aggregations