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

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


    Sig package_ = createSigByName("Package");
    Sig body = createSigByName("Body");
    Sig field = createSigByName("Field");
    Sig fieldId = createSigByName("FieldId");

    CommandScope packageScope = new CommandScope(package_,
        isExactMaxPackages, maxPackages);
    result.add(packageScope);

    CommandScope typeScope = new CommandScope(type, isExactMaxClasses(),
        maxClasses);
    result.add(typeScope);

    CommandScope classIdScope = new CommandScope(classId,
        isExactMaxClassNames, maxClassNames);
    result.add(classIdScope);

    CommandScope methodScope = new CommandScope(method, isExactMaxMethods,
        maxMethods);
    result.add(methodScope);

    CommandScope methodIdScope = new CommandScope(methodId,
        isExactMaxMethodNames, maxMethodNames);
    result.add(methodIdScope);

    CommandScope bodyScope = new CommandScope(body, isExactMethodBodyScope,
        maxMethodBody);
    result.add(bodyScope);

    if (this.maxFields != null) {
      CommandScope fieldScope = new CommandScope(field, isExactMaxFields,
          maxFields);
      result.add(fieldScope);

      CommandScope fieldIdScope = new CommandScope(fieldId,
          isExactMaxFieldnames, maxFieldNames);
      result.add(fieldIdScope);

     
    }
View Full Code Here


          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 54: // TypeNumber ::= NUMBER COLON NUMBER
            {
              CommandScope RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        ExprConstant i = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(a.pos.merge(i.pos), Sig.NONE, false, a.num, Integer.MAX_VALUE, i.num);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 53: // TypeNumber ::= NUMBER DOT DOT NUMBER COLON NUMBER
            {
              CommandScope RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-5)).value;
        ExprConstant b = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        ExprConstant i = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(a.pos.merge(i.pos), Sig.NONE, false, a.num, b.num,             i.num);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 52: // TypeNumber ::= NUMBER DOT DOT NUMBER
            {
              CommandScope RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-3)).value;
        ExprConstant b = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(a.pos.merge(b.pos), Sig.NONE, false, a.num, b.num,             1    );
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 51: // TypeNumber ::= NUMBER
            {
              CommandScope RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
                                                                                        RESULT = new CommandScope(a.pos             , Sig.NONE, false, a.num, a.num,             1    );
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 50: // TypeNumber ::= EXACTLY NUMBER COLON NUMBER
            {
              CommandScope RESULT =null;
        Pos e = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-3)).value;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        ExprConstant i = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(    e.merge(i.pos), Sig.NONE, true,  a.num, Integer.MAX_VALUE, i.num);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 49: // TypeNumber ::= EXACTLY NUMBER DOT DOT NUMBER COLON NUMBER
            {
              CommandScope RESULT =null;
        Pos e = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-6)).value;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-5)).value;
        ExprConstant b = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        ExprConstant i = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(    e.merge(i.pos), Sig.NONE, true,  a.num, b.num,             i.num);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 48: // TypeNumber ::= EXACTLY NUMBER DOT DOT NUMBER
            {
              CommandScope RESULT =null;
        Pos e = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-4)).value;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-3)).value;
        ExprConstant b = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (!Version.experimental) throw new ErrorSyntax(a.pos, "Syntax error here."); RESULT = new CommandScope(    e.merge(b.pos), Sig.NONE, true,  a.num, b.num,             1    );
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 47: // TypeNumber ::= EXACTLY NUMBER
            {
              CommandScope RESULT =null;
        Pos e = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
                                                                                        RESULT = new CommandScope(    e.merge(a.pos), Sig.NONE, true,  a.num, a.num,             1    );
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("TypeNumber",70, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 46: // Typescope ::= TypeNumber NONE
            {
              CommandScope RESULT =null;
        CommandScope e = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos f = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (1==1) throw new ErrorSyntax(e.pos.merge(f), "You cannot set a scope on none.");
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 45: // Typescope ::= TypeNumber SIGINT
            {
              CommandScope RESULT =null;
        CommandScope e = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos f = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (1==1) throw new ErrorSyntax(e.pos.merge(f), "You can no longer set a scope on Int; the number of Int atoms is always exactly equal to 2^(integer bitwidth).\n");
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 44: // Typescope ::= TypeNumber STRING
            {
              CommandScope RESULT =null;
        CommandScope a = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos b = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT = new CommandScope(a.pos.merge(b), new PrimSig("String", AttrType.WHERE.make(a.pos.merge(b))), a.isExact, a.startingScope, a.endingScope, a.increment);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 43: // Typescope ::= TypeNumber UNIV
            {
              CommandScope RESULT =null;
        CommandScope e = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos f = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         if (1==1) throw new ErrorSyntax(e.pos.merge(f), "You cannot set a scope on univ.");
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 42: // Typescope ::= TypeNumber SEQ
            {
              CommandScope RESULT =null;
        CommandScope a = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos b = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;

   Pos p = a.pos.merge(b);
   if (a.endingScope>a.startingScope) throw new ErrorSyntax(p, "Cannot specify a growing scope for \"seq\"");
   if (a.isExact) throw new ErrorSyntax(p, "The exactly keyword is redundant here since the number of sequence index has to be exact.");
   RESULT = new CommandScope(p, new PrimSig("seq", AttrType.WHERE.make(p)), a.isExact, a.startingScope, a.startingScope, 1);

              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 41: // Typescope ::= TypeNumber INT
            {
              CommandScope RESULT =null;
        CommandScope a = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        Pos b = (Pos)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;

   Pos p = a.pos.merge(b);
   if (a.endingScope>a.startingScope) throw new ErrorSyntax(p, "Cannot specify a growing scope for \"int\"");
   if (a.isExact) throw new ErrorSyntax(p, "The exactly keyword is redundant here since the integer bitwidth must be exact.");
   RESULT = new CommandScope(p, new PrimSig("int", AttrType.WHERE.make(p)), a.isExact, a.startingScope, a.startingScope, 1);

              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 40: // Typescope ::= TypeNumber Name
            {
              CommandScope RESULT =null;
        CommandScope a = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-1)).value;
        ExprVar b = (ExprVar)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;

   nod(b);
   RESULT = new CommandScope(a.pos.merge(b.pos), new PrimSig(b.label, AttrType.WHERE.make(a.pos.merge(b.pos))), a.isExact, a.startingScope, a.endingScope, a.increment);

              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescope",71, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 39: // Typescopes ::= Typescopes COMMA Typescope
            {
              List<CommandScope> RESULT =null;
        List<CommandScope> a = (List<CommandScope>)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        CommandScope b = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT=a; a.add(b);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescopes",72, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 38: // Typescopes ::= Typescope
            {
              List<CommandScope> RESULT =null;
        CommandScope a = (CommandScope)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT=new ArrayList<CommandScope>(); RESULT.add(a);
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Typescopes",72, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 37: // Scope ::=
            {
              List<CommandScope> RESULT =null;
         RESULT=new ArrayList<CommandScope>();
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Scope",59, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 36: // Scope ::= FOR Typescopes
            {
              List<CommandScope> RESULT =null;
        List<CommandScope> b = (List<CommandScope>)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT=b;
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Scope",59, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 35: // Scope ::= FOR NUMBER BUT Typescopes
            {
              List<CommandScope> RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.elementAt(CUP$CompParser$top-2)).value;
        List<CommandScope> b = (List<CommandScope>)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT=b;                                  b.add(new CommandScope(a.pos, new PrimSig("univ", AttrType.WHERE.make(a.pos)), true, a.num, a.num, 1));
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Scope",59, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 34: // Scope ::= FOR NUMBER
            {
              List<CommandScope> RESULT =null;
        ExprConstant a = (ExprConstant)((java_cup_11a.runtime.Symbol) CUP$CompParser$stack.peek()).value;
         RESULT=new ArrayList<CommandScope>(); RESULT.add(new CommandScope(a.pos, new PrimSig("univ", AttrType.WHERE.make(a.pos)), true, a.num, a.num, 1));
              CUP$CompParser$result = parser.getSymbolFactory().newSymbol("Scope",59, RESULT);
            }
          return CUP$CompParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
 
View Full Code Here

                        rep.resultSAT(cmd, start, sol); return sol;
                    }
                    sim.partial = sol;
                    if (sim.growableSigs.isEmpty()) break;
                    for(Sig s: sim.growableSigs) {
                        CommandScope sc = cmd.getScope(s);
                        if (sc.increment > sc.endingScope - sc.startingScope) {cmd=null; break;}
                        cmd = cmd.change(s, sc.isExact, sc.startingScope+sc.increment, sc.endingScope, sc.increment);
                    }
                }
            }
View Full Code Here

      if (e==null) e = ExprConstant.TRUE;
      TempList<CommandScope> sc=new TempList<CommandScope>(cmd.scope.size());
      for(CommandScope et: cmd.scope) {
         Sig s = getRawSIG(et.sig.pos, et.sig.label);
         if (s==null) throw new ErrorSyntax(et.sig.pos, "The sig \""+et.sig.label+"\" cannot be found.");
         sc.add(new CommandScope(null, s, et.isExact, et.startingScope, et.endingScope, et.increment));
      }
      return new Command(cmd.pos, cmd.label, cmd.check, cmd.overall, cmd.bitwidth, cmd.maxseq, cmd.expects, sc.makeConst(), exactSigs, globalFacts.and(e), parent);
   }
View Full Code Here

TOP

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

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.