Search in sources :

Example 1 with Atomic

use of org.btrplace.safeplace.spec.type.Atomic in project scheduler by btrplace.

the class MyCstrSpecVisitor method visitTypedef.

@Override
public List<UserVar<?>> visitTypedef(@NotNull CstrSpecParser.TypedefContext ctx) {
    Term<?> parent = (Term<?>) visit(ctx.term());
    if (parent.type() instanceof Atomic) {
        throw new SpecException(filename, ctx.op.getCharPositionInLine(), "The right-hand side must be a collection");
    }
    List<UserVar<?>> vars = new ArrayList<>();
    for (TerminalNode n : ctx.ID()) {
        String lbl = n.getText();
        UserVar v = new UserVar(lbl, ctx.op.getText(), parent);
        symbols.put(v);
        vars.add(v);
    }
    return vars;
}
Also used : ArrayList(java.util.ArrayList) Atomic(org.btrplace.safeplace.spec.type.Atomic) Term(org.btrplace.safeplace.spec.term.Term) ProtectedTerm(org.btrplace.safeplace.spec.term.ProtectedTerm) TerminalNode(org.antlr.v4.runtime.tree.TerminalNode) UserVar(org.btrplace.safeplace.spec.term.UserVar)

Aggregations

ArrayList (java.util.ArrayList)1 TerminalNode (org.antlr.v4.runtime.tree.TerminalNode)1 ProtectedTerm (org.btrplace.safeplace.spec.term.ProtectedTerm)1 Term (org.btrplace.safeplace.spec.term.Term)1 UserVar (org.btrplace.safeplace.spec.term.UserVar)1 Atomic (org.btrplace.safeplace.spec.type.Atomic)1