use of de.be4.classicalb.core.parser.node.PRecEntry in project probparsers by bendisposto.
the class StructType method createASTNode.
public PExpression createASTNode(Typechecker typechecker) {
ArrayList<PRecEntry> list = new ArrayList<PRecEntry>();
Set<Entry<String, BType>> entrySet = this.types.entrySet();
for (Entry<String, BType> entry : entrySet) {
String name = entry.getKey();
BType type = entry.getValue();
TIdentifierLiteral literal = new TIdentifierLiteral(name);
ArrayList<TIdentifierLiteral> idList = new ArrayList<TIdentifierLiteral>();
idList.add(literal);
AIdentifierExpression id = new AIdentifierExpression(idList);
ARecEntry recEntry = new ARecEntry(id, type.createASTNode(typechecker));
list.add(recEntry);
}
AStructExpression node = new AStructExpression(list);
typechecker.setType(node, new SetType(this));
return node;
}
use of de.be4.classicalb.core.parser.node.PRecEntry in project probparsers by bendisposto.
the class TranslatingVisitor method caseARecExpression.
@Override
public void caseARecExpression(ARecExpression node) {
Map<java.lang.String, BObject> s = Record.newStorage();
// TODO or make the record immutable after filling it
for (PRecEntry e : node.getEntries()) {
e.apply(this);
RecordEntry entry = (RecordEntry) this.getResult();
s.put(entry.getKey().getValue(), entry.getValue());
}
this.setResult(new Record(s));
}
Aggregations