Search in sources :

Example 6 with PExpression

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

the class MachineContext method caseAEnumeratedSetSet.

@Override
public void caseAEnumeratedSetSet(AEnumeratedSetSet node) {
    {
        List<TIdentifierLiteral> copy = new ArrayList<TIdentifierLiteral>(node.getIdentifier());
        String name = Utils.getTIdentifierListAsString(copy);
        exist(node.getIdentifier());
        enumeratedSets.put(name, node);
    }
    List<PExpression> copy = new ArrayList<PExpression>(node.getElements());
    for (PExpression e : copy) {
        AIdentifierExpression v = (AIdentifierExpression) e;
        String name = Utils.getTIdentifierListAsString(v.getIdentifier());
        exist(v.getIdentifier());
        enumValues.put(name, v);
    }
}
Also used : AIdentifierExpression(de.be4.classicalb.core.parser.node.AIdentifierExpression) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) TIdentifierLiteral(de.be4.classicalb.core.parser.node.TIdentifierLiteral) PExpression(de.be4.classicalb.core.parser.node.PExpression)

Example 7 with PExpression

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

the class BoolType method createASTNode.

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

Example 8 with PExpression

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

the class FunctionType method createASTNode.

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

Example 9 with PExpression

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

the class TranslatingVisitor method caseACoupleExpression.

@Override
public void caseACoupleExpression(ACoupleExpression node) {
    List<BObject> s = new ArrayList<BObject>();
    for (PExpression e : node.getList()) {
        e.apply(this);
        s.add(this.getResult());
    }
    this.setResult(new Tuple(s));
}
Also used : BObject(de.prob.translator.types.BObject) ArrayList(java.util.ArrayList) PExpression(de.be4.classicalb.core.parser.node.PExpression) Tuple(de.prob.translator.types.Tuple)

Example 10 with PExpression

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

the class TranslatingVisitor method caseASequenceExtensionExpression.

@Override
public void caseASequenceExtensionExpression(ASequenceExtensionExpression node) {
    List<BObject> s = new ArrayList<BObject>();
    for (PExpression e : node.getExpression()) {
        e.apply(this);
        s.add(this.getResult());
    }
    this.setResult(new Sequence(s));
}
Also used : BObject(de.prob.translator.types.BObject) ArrayList(java.util.ArrayList) Sequence(de.prob.translator.types.Sequence) 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