Package edu.mit.csail.sdg.alloy4

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


                StringBuilder sb = new StringBuilder();
                Util.encodeXMLs(sb, "\n<skolem label=\"", label, "\" ID=\"m"+m+"\">\n");
                if (writeExpr(sb.toString(), f.call())) { out.print("</skolem>\n"); }
                m++;
            } catch(Throwable ex) {
                throw new ErrorFatal("Error evaluating skolem "+label, ex);
            }
        }
        out.print("\n</instance>\n");
    }
View Full Code Here


            if (sources!=null) for(Map.Entry<String,String> e: sources.entrySet()) {
                Util.encodeXMLs(out, "\n<source filename=\"", e.getKey(), "\" content=\"", e.getValue(), "\"/>\n");
            }
            out.print("\n</alloy>\n");
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Error writing the solution XML file.", ex);
        }
        if (out.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
    }
View Full Code Here

    /** Write the metamodel as &lt;instance&gt;..&lt;/instance&gt; in XML format. */
    public static void writeMetamodel(ConstList<Sig> sigs, String originalFilename, PrintWriter out) throws Err {
        try {
            new A4SolutionWriter(null, null, sigs, 4, 4, "show metamodel", originalFilename, out, null);
        } catch(Throwable ex) {
            if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Error writing the solution XML file.", ex);
        }
        if (out.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
    }
View Full Code Here

            Map<String,String> fc = new LinkedHashMap<String,String>();
            fc.put("", content);
            CompModule u=CompParser.alloy_parseStream(new ArrayList<Object>(), null, fc, null, 0, "", "", 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

    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

     * @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

            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

            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

    /** 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

      /** 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

TOP

Related Classes of edu.mit.csail.sdg.alloy4.ErrorFatal

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.