Search in sources :

Example 1 with FunctionCall

use of org.btrplace.safeplace.spec.term.func.FunctionCall in project scheduler by btrplace.

the class MyCstrSpecVisitor method visitCall.

@Override
public FunctionCall visitCall(@NotNull CstrSpecParser.CallContext ctx) {
    List<Term> ps = ctx.term().stream().map(t -> (Term<?>) visit(t)).collect(Collectors.toList());
    Function f = resolveFunction(ctx.ID().getSymbol(), ps);
    FunctionCall.Moment m = FunctionCall.Moment.ANY;
    if (ctx.BEGIN() != null) {
        m = FunctionCall.Moment.BEGIN;
    }
    return new FunctionCall(f, ps, m);
}
Also used : FunctionCall(org.btrplace.safeplace.spec.term.func.FunctionCall) org.btrplace.safeplace.spec.term(org.btrplace.safeplace.spec.term) CstrSpecParser(org.btrplace.safeplace.spec.antlr.CstrSpecParser) Function(org.btrplace.safeplace.spec.term.func.Function) Token(org.antlr.v4.runtime.Token) NotNull(org.antlr.v4.runtime.misc.NotNull) org.btrplace.safeplace.spec.prop(org.btrplace.safeplace.spec.prop) Collectors(java.util.stream.Collectors) TerminalNode(org.antlr.v4.runtime.tree.TerminalNode) ArrayList(java.util.ArrayList) List(java.util.List) org.btrplace.safeplace.spec.type(org.btrplace.safeplace.spec.type) ValueAt(org.btrplace.safeplace.spec.term.func.ValueAt) ParseTree(org.antlr.v4.runtime.tree.ParseTree) CstrSpecBaseVisitor(org.btrplace.safeplace.spec.antlr.CstrSpecBaseVisitor) Function(org.btrplace.safeplace.spec.term.func.Function) FunctionCall(org.btrplace.safeplace.spec.term.func.FunctionCall)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Token (org.antlr.v4.runtime.Token)1 NotNull (org.antlr.v4.runtime.misc.NotNull)1 ParseTree (org.antlr.v4.runtime.tree.ParseTree)1 TerminalNode (org.antlr.v4.runtime.tree.TerminalNode)1 CstrSpecBaseVisitor (org.btrplace.safeplace.spec.antlr.CstrSpecBaseVisitor)1 CstrSpecParser (org.btrplace.safeplace.spec.antlr.CstrSpecParser)1 org.btrplace.safeplace.spec.prop (org.btrplace.safeplace.spec.prop)1 org.btrplace.safeplace.spec.term (org.btrplace.safeplace.spec.term)1 Function (org.btrplace.safeplace.spec.term.func.Function)1 FunctionCall (org.btrplace.safeplace.spec.term.func.FunctionCall)1 ValueAt (org.btrplace.safeplace.spec.term.func.ValueAt)1 org.btrplace.safeplace.spec.type (org.btrplace.safeplace.spec.type)1