Examples of ExprHasName


Examples of edu.mit.csail.sdg.alloy4compiler.ast.ExprHasName

    /* These corresponds to the helper predicates/functions provided in util/*.als */

    static Expr acyclic(Expr r) throws Err {
        Decl d = r.join(Sig.UNIV).oneOf("x");     // x is a variable over the domain of r
        ExprHasName x = d.get();
        return x.in(x.join(r.closure())).not().forAll(d); // (x !in x.^r) for all x
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.ExprHasName

   void addFunc(Pos p, Pos isPrivate, String n, Expr f, List<Decl> decls, Expr t, Expr v) throws Err {
      if (decls==null) decls=new ArrayList<Decl>(); else decls=new ArrayList<Decl>(decls);
      if (f!=null) decls.add(0, new Decl(null, null, null, Util.asList(ExprVar.make(f.span(), "this")), f));
      for(Decl d:decls) {
         if (d.isPrivate!=null) {
            ExprHasName name = d.names.get(0);
            throw new ErrorSyntax(d.isPrivate.merge(name.pos), "Function parameter \""+name.label+"\" is always private already.");
         }
         if (d.disjoint2!=null) {
            ExprHasName name = d.names.get(d.names.size()-1);
            throw new ErrorSyntax(d.disjoint2.merge(name.pos), "Function parameter \""+name.label+"\" cannot be bound to a 'disjoint' expression.");
         }
      }
      status=3;
      dup(p, n, false);
      ExprHasName dup = Decl.findDuplicateName(decls);
      if (dup!=null) throw new ErrorSyntax(dup.span(), "The parameter name \""+dup.label+"\" cannot appear more than once.");
      Func ans = new Func(p, isPrivate, n, decls, t, v);
      ArrayList<Func> list = funcs.get(n);
      if (list==null) { list = new ArrayList<Func>(); funcs.put(n, list); }
      list.add(ans);
   }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.ExprHasName

      // then B/SIGX's fields cannot refer to A/SIGY, nor any fields in A/SIGY)
      final List<Decl> oldDecls = res.old2fields.get(res.new2old.get(s));
      if (oldDecls==null) return;
      final CompModule m = res.sig2module.get(s);
      final Context cx = new Context(m, warns);
      final ExprHasName dup = Decl.findDuplicateName(oldDecls);
      if (dup!=null) throw new ErrorSyntax(dup.span(), "sig \""+s+"\" cannot have 2 fields named \""+dup.label+"\"");
      for(final Decl d: oldDecls) {
         if (d.expr.mult()!=ExprUnary.Op.EXACTLYOF) {if (defined) continue;} else {if (!defined) continue;}
         // The name "this" does matter, since the parser and the typechecker both refer to it as "this"
         cx.rootfield = d;
         cx.rootsig = s;
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.ExprHasName

            for(ExprVar f: instance.getAllSkolems()) if (f.type().arity()>1) for(A4Tuple t: (A4TupleSet)(instance.eval(f))) {
               if (t.atom(0).equals(atom)) { ans.add(new Pair<String,ExprHasName>(atom, f)); break; }
            }
         } else if (parent instanceof Pair) {
            Pair<?,?> p = (Pair<?,?>)parent;
            ExprHasName rel = (ExprHasName) (p.b);
            String atom = (String) (p.a);
            for(A4Tuple tuple: (A4TupleSet) (instance.eval(rel))) if (tuple.atom(0).equals(atom)) {
               if (tuple.arity()==2) ans.add(tuple.atom(1)); else ans.add(tuple);
            }
         } else if (parent instanceof A4Tuple) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.