use of de.prob.typechecker.exceptions.ScopeException 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.prob.typechecker.exceptions.ScopeException in project probparsers by bendisposto.
the class MachineContext method caseASeesMachineClause.
@Override
public void caseASeesMachineClause(ASeesMachineClause node) {
this.seesMachineClause = node;
List<PExpression> copy = new ArrayList<PExpression>(node.getMachineNames());
for (PExpression e : copy) {
AIdentifierExpression p = (AIdentifierExpression) e;
String name = Utils.getTIdentifierListAsString(p.getIdentifier());
try {
exist(p.getIdentifier());
} catch (ScopeException e2) {
throw new ScopeException("Machine '" + name + "' is seen twice.");
}
seenMachines.put(name, p);
}
}
use of de.prob.typechecker.exceptions.ScopeException 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);
}
}
}
Aggregations