Package edu.mit.csail.sdg.alloy4compiler.ast

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


            if (a.parent!=null && a.parent!=UNIV) expr = sig2meta.get(a.parent);
         }
         e.getValue().addDefinedField(Pos.UNKNOWN, null, Pos.UNKNOWN, "parent", (expr==null ? ExprConstant.EMPTYNESS : expr));
      }
      for(Map.Entry<Sig,PrimSig> e: sig2meta.entrySet()) {
         Sig s = e.getKey();
         PrimSig s2 = e.getValue();
         Expr allfields = ExprConstant.EMPTYNESS;
         for(Field f: s.getFields()) {
            PrimSig metaF = field2meta.get(f);
            if (allfields==ExprConstant.EMPTYNESS) allfields = metaF; else allfields = allfields.plus(metaF);
         }
         if (s instanceof PrimSig) for(Sig c: (((PrimSig)s).descendents())) for(Field f: c.getFields()) {
            PrimSig metaF = field2meta.get(f);
View Full Code Here


      for(CompModule x: root.allModules) {
         errors = x.resolveFuncBody(rep, errors, warns);
         errors = x.resolveAssertions(rep, errors, warns);
         errors = x.resolveFacts(root, rep, errors, warns);
         // also, we can collect up all the exact sigs and add them to the root module's list of exact sigs
         for(String n: x.exactParams) { Sig sig = x.params.get(n); if (sig!=null) root.exactSigs.add(sig); }
      }
      if (!errors.isEmpty()) throw errors.pick();
      // Typecheck the run/check commands (which can refer to function bodies and assertions)
      root.resolveCommands(root.getAllReachableFacts());
      if (!errors.isEmpty()) throw errors.pick();
View Full Code Here

      if (name.equals("seq/Int"))    return ExprUnary.Op.NOOP.make(pos, SEQIDX);
      if (name.equals("String"))     return ExprUnary.Op.NOOP.make(pos, STRING);
      if (name.equals("none"))       return ExprUnary.Op.NOOP.make(pos, NONE);
      if (name.equals("iden"))       return ExprConstant.Op.IDEN.make(pos, 0);
      if (name.equals("sig$") || name.equals("field$")) if (world!=null) {
         Sig s = world.sigs.get(name);
         if (s!=null) return ExprUnary.Op.NOOP.make(pos, s);
      }
      final List<Object> ans = name.indexOf('/')>=0 ? getRawQS(fun?5:1, name) : getRawNQS(this, fun?5:1, name);
      final Sig param = params.get(name); if (param!=null && !ans.contains(param)) ans.add(param);
      for(Object x: ans) {
         if (x instanceof Sig) {
            Sig y = (Sig)x;
            ch.add(ExprUnary.Op.NOOP.make(pos, y, null, 0));
            re.add("sig "+y.label);
         }
         else if (x instanceof Func) {
            Func f = (Func)x;
View Full Code Here

                i++;
                if (i>=t.length-1 || !(t[i] instanceof String) || !(t[i+1] instanceof String)) return null;
                String sigName = (String)(t[i]);
                i++;
                String fieldName = (String)(t[i]);
                Sig first = hasSig(sigs,sigName);
                if (first==null) return null;
                Expression expr = null;
                if (fieldName.length()==0) {
                    expr=frame.a2k(first);
                } else {
                    for(Field field:first.getFields()) if (field.label.equals(fieldName)) {
                        expr=frame.a2k(field);
                        while(expr instanceof BinaryExpression) expr=((BinaryExpression)expr).right();
                        break;
                    }
                }
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4compiler.ast.Sig

Copyright © 2018 www.massapicom. 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.