Examples of ErrorFatal


Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

    public static ConstList<Command> parseOneModule_fromFile(String filename) throws Err {
        try {
           CompModule u = CompParser.alloy_parseStream(new ArrayList<Object>(), null, null, null, 0, filename, "", 1);
            return ConstList.make(u.getAllCommands());
        } catch(IOException ex) {
            throw new ErrorFatal("IOException occurred: "+ex.getMessage(), ex);
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

     * @return the fully-typechecked expression if no error occurred
     * @throws Err if world==null or if any other error occurred
     */
    public static Expr parseOneExpression_fromString (Module world, String input) throws Err {
        try {
            if (world==null) throw new ErrorFatal("Cannot parse an expression with null world.");
            return world.parseOneExpressionFromString(input);
        } catch(IOException ex) {
            throw new ErrorFatal("IOException occurred: "+ex.getMessage(), ex);
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

            root.seenDollar = seenDollar.size()>0;
            return CompModule.resolveAll(rep==null ? A4Reporter.NOP : rep, root);
        } catch(FileNotFoundException ex) {
            throw new ErrorSyntax("File cannot be found.\n"+ex.getMessage(), ex);
        } catch(IOException ex) {
            throw new ErrorFatal("IOException occurred: "+ex.getMessage(), ex);
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

            root.seenDollar = seenDollar.size()>0;
            return CompModule.resolveAll(rep==null ? A4Reporter.NOP : rep, root);
        } catch(FileNotFoundException ex) {
            throw new ErrorSyntax("File cannot be found.\n"+ex.getMessage(), ex);
        } catch(IOException ex) {
            throw new ErrorFatal("IOException occurred: "+ex.getMessage(), ex);
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Unknown exception occurred: "+ex, ex);
        }
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

    /** The macro body. */
    private final Expr body;

    /** Construct a new Macro object. */
    private Macro(Pos pos, Pos isPrivate, CompModule realModule, String name, List<ExprVar> params, List<Expr> args, Expr body) {
        super(pos, new ErrorFatal(pos, "Incomplete call on the macro \""+name+"\""));
        this.realModule = realModule;
        this.isPrivate = isPrivate;
        this.name = name;
        this.params = ConstList.make(params);
        this.args = ConstList.make(args);
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

      /** Returns its immediate children sigs (not including NONE)
       * <p> Note: if this==UNIV, then this method will throw an exception, since we don't keep track of UNIV's children
       */
      public SafeList<PrimSig> children() throws Err {
         if (this==UNIV) throw new ErrorFatal("Internal error (cannot enumerate the subsigs of UNIV)");
         return children.dup();
      }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

      /** Returns its subsigs and their subsigs and their subsigs, etc.
       * <p> Note: if this==UNIV, then this method will throw an exception, since we don't keep track of UNIV's children
       */
      public Iterable<PrimSig> descendents() throws Err {
         if (this==UNIV) throw new ErrorFatal("Internal error (cannot enumerate the subsigs of UNIV)");
         Iterable<PrimSig> answer = children.dup();
         for(PrimSig x:children) answer = Util.fastJoin(answer, x.descendents());
         return answer;
      }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

  static CompModule alloy_parseStream (List<Object> seenDollar,
  Map<String,String> loaded, Map<String,String> fc, CompModule root,
  int lineOffset, String filename, String prefix, int initialResolutionMode) throws Err, FileNotFoundException, IOException {
    Reader isr=null;
    try {
        if (root==null && prefix.length()!=0) throw new ErrorFatal("Internal error (parse subfile with root==null)");
        if (root!=null && prefix.length()==0) throw new ErrorFatal("Internal error (parse topfile with root!=null)");
        CompModule u = new CompModule(root, filename, prefix);
        u.resolution = initialResolutionMode;
        String content = fc!=null ? fc.get(filename) : null;
        if (content==null && loaded!=null) content = loaded.get(filename);
        if (content==null) content = Util.readAll(filename);
        if (loaded!=null) loaded.put(filename,content);
        content = Util.convertLineBreak(content);
        isr = new StringReader(content);
        CompFilter s = new CompFilter(u, seenDollar, filename, lineOffset, new BufferedReader(isr));
        CompParser p = new CompParser(s);
        p.alloymodule=u;
        try {p.parse();} catch(Throwable ex) {if (ex instanceof Err) throw (Err)ex; throw new ErrorFatal("Parser Exception", ex);}
        return u;
    } finally {
        Util.close(isr);
    }
  }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

    private Symbol myread() throws Err {
      if (!undo.isEmpty()) return undo.removeFirst();
      try {
          return r.next_token();
      } catch(Exception ex) {
          if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("IO error: "+ex.getMessage(), ex);
      }
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal

      }
   }

   /** Returns the AlloyType corresponding to the given sig; create an AlloyType for it if none existed before. */
   private AlloyType sig(PrimSig s) throws Err {
      if (s==Sig.NONE) throw new ErrorFatal("Unexpected sig \"none\" encountered.");
      AlloyType ans = sig2type.get(s);
      if (ans == null) {
         ans = makeType(s.label, s.isOne!=null, s.isAbstract!=null, false, s.isPrivate!=null, s.isMeta!=null, s.isEnum!=null);
         sig2type.put(s, ans);
         if (s.parent!=Sig.UNIV) ts.put(ans, sig(s.parent));
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.