Search in sources :

Example 1 with ARecEntry

use of de.be4.classicalb.core.parser.node.ARecEntry 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;
}
Also used : AIdentifierExpression(de.be4.classicalb.core.parser.node.AIdentifierExpression) ARecEntry(de.be4.classicalb.core.parser.node.ARecEntry) ArrayList(java.util.ArrayList) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral) AStructExpression(de.be4.classicalb.core.parser.node.AStructExpression) ARecEntry(de.be4.classicalb.core.parser.node.ARecEntry) PRecEntry(de.be4.classicalb.core.parser.node.PRecEntry) Entry(java.util.Map.Entry) PRecEntry(de.be4.classicalb.core.parser.node.PRecEntry)

Aggregations

AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)1 ARecEntry (de.be4.classicalb.core.parser.node.ARecEntry)1 AStructExpression (de.be4.classicalb.core.parser.node.AStructExpression)1 PRecEntry (de.be4.classicalb.core.parser.node.PRecEntry)1 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1