Search in sources :

Example 61 with PExpression

use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.

the class TranslatingVisitor method listToSet.

private java.util.Set<BObject> listToSet(LinkedList<PExpression> elements) {
    java.util.Set<BObject> s = de.prob.translator.types.Set.newStorage();
    for (PExpression p : elements) {
        p.apply(this);
        s.add(this.getResult());
    }
    return s;
}
Also used : BObject(de.prob.translator.types.BObject) PExpression(de.be4.classicalb.core.parser.node.PExpression)

Example 62 with PExpression

use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.

the class EnumeratedSetElement method createASTNode.

public PExpression createASTNode(Typechecker typechecker) {
    TIdentifierLiteral literal = new TIdentifierLiteral(name);
    ArrayList<TIdentifierLiteral> idList = new ArrayList<TIdentifierLiteral>();
    idList.add(literal);
    AIdentifierExpression id = new AIdentifierExpression(idList);
    typechecker.setType(id, new SetType(this));
    return id;
}
Also used : AIdentifierExpression(de.be4.classicalb.core.parser.node.AIdentifierExpression) ArrayList(java.util.ArrayList) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral)

Example 63 with PExpression

use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.

the class IntegerType method createASTNode.

public PExpression createASTNode(Typechecker typechecker) {
    AIntegerSetExpression node = new AIntegerSetExpression();
    typechecker.setType(node, new SetType(this));
    return node;
}
Also used : AIntegerSetExpression(de.be4.classicalb.core.parser.node.AIntegerSetExpression)

Example 64 with PExpression

use of de.be4.classicalb.core.parser.node.PExpression in project probparsers by bendisposto.

the class PairType method createASTNode.

public PExpression createASTNode(Typechecker typechecker) {
    ACartesianProductExpression node = new ACartesianProductExpression(first.createASTNode(typechecker), second.createASTNode(typechecker));
    typechecker.setType(node, new SetType(this));
    return node;
}
Also used : ACartesianProductExpression(de.be4.classicalb.core.parser.node.ACartesianProductExpression)

Example 65 with PExpression

use of de.be4.classicalb.core.parser.node.PExpression in project prob2 by bendisposto.

the class DependencyWalker method registerMachineNames.

private void registerMachineNames(final List<PExpression> machineNames, final ERefType depType) {
    for (final PExpression machineName : machineNames) {
        if (machineName instanceof AIdentifierExpression) {
            final AIdentifierExpression identifier = (AIdentifierExpression) machineName;
            final String dest = extractMachineName(identifier.getIdentifier());
            // TODO test this
            addMachine(dest, depType == ERefType.USES ? dest : prefix, depType);
        }
    }
}
Also used : AIdentifierExpression(de.be4.classicalb.core.parser.node.AIdentifierExpression) PExpression(de.be4.classicalb.core.parser.node.PExpression)

Aggregations

PExpression (de.be4.classicalb.core.parser.node.PExpression)50 AIdentifierExpression (de.be4.classicalb.core.parser.node.AIdentifierExpression)28 ArrayList (java.util.ArrayList)27 CheckException (de.be4.classicalb.core.parser.exceptions.CheckException)21 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)12 Test (org.junit.Test)6 Node (de.be4.classicalb.core.parser.node.Node)5 LinkedList (java.util.LinkedList)5 AExpressionParseUnit (de.be4.classicalb.core.parser.node.AExpressionParseUnit)4 AFunctionExpression (de.be4.classicalb.core.parser.node.AFunctionExpression)4 AIntegerExpression (de.be4.classicalb.core.parser.node.AIntegerExpression)4 PSubstitution (de.be4.classicalb.core.parser.node.PSubstitution)4 VisitorException (de.be4.classicalb.core.parser.exceptions.VisitorException)3 ADefinitionExpression (de.be4.classicalb.core.parser.node.ADefinitionExpression)3 AStringExpression (de.be4.classicalb.core.parser.node.AStringExpression)3 Start (de.be4.classicalb.core.parser.node.Start)3 BParser (de.be4.classicalb.core.parser.BParser)2 AExpressionDefinitionDefinition (de.be4.classicalb.core.parser.node.AExpressionDefinitionDefinition)2 AMachineReference (de.be4.classicalb.core.parser.node.AMachineReference)2 AOpSubstitution (de.be4.classicalb.core.parser.node.AOpSubstitution)2