edu.mit.csail.sdg.alloy4compiler.parser
Class CompUtil

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4compiler.parser.CompUtil

public final class CompUtil
extends java.lang.Object

This class provides convenience methods for calling the parser and the compiler.


Method Summary
static CompModule parseEverything_fromFile(A4Reporter rep, java.util.Map<java.lang.String,java.lang.String> loaded, java.lang.String filename)
          Read everything from "file" and parse it; if it mentions submodules, open them and parse them too.
static CompModule parseEverything_fromFile(A4Reporter rep, java.util.Map<java.lang.String,java.lang.String> loaded, java.lang.String filename, int initialResolutionMode)
          Read everything from "file" and parse it; if it mentions submodules, open them and parse them too.
static Expr parseOneExpression_fromString(Module world, java.lang.String input)
          Parses then typecheck the given input String as an Alloy expression from that world
static ConstList<Command> parseOneModule_fromFile(java.lang.String filename)
          Parses 1 module from the file (without loading any subfiles)
static ConstList<Command> parseOneModule_fromString(java.lang.String content)
          Parses 1 module from the input string (without loading any subfiles)
static CompModule parseOneModule(java.lang.String content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseOneModule_fromString

public static ConstList<Command> parseOneModule_fromString(java.lang.String content)
                                                    throws Err
Parses 1 module from the input string (without loading any subfiles)

Returns:
an array of 0 or more Command if no error occurred
Throws:
Err

parseOneModule

public static CompModule parseOneModule(java.lang.String content)
                                 throws Err
Throws:
Err

parseOneModule_fromFile

public static ConstList<Command> parseOneModule_fromFile(java.lang.String filename)
                                                  throws Err
Parses 1 module from the file (without loading any subfiles)

Returns:
an array of 0 or more Command if no error occurred
Throws:
Err

parseOneExpression_fromString

public static Expr parseOneExpression_fromString(Module world,
                                                 java.lang.String input)
                                          throws Err
Parses then typecheck the given input String as an Alloy expression from that world

Returns:
the fully-typechecked expression if no error occurred
Throws:
Err - if world==null or if any other error occurred

parseEverything_fromFile

public static CompModule parseEverything_fromFile(A4Reporter rep,
                                                  java.util.Map<java.lang.String,java.lang.String> loaded,
                                                  java.lang.String filename)
                                           throws Err
Read everything from "file" and parse it; if it mentions submodules, open them and parse them too.

Parameters:
rep - - if nonnull, we will report compilation progress messages to it
loaded - - a cache of files that have been pre-fetched (can be null if there were no prefetching)
filename - - the main module we are parsing
Returns:
the root Module which contains pointers to all submodules
Throws:
Err - if an error occurred

And if loaded!=null, it will contain all the files needed for this parse, and furthermore, other entries will be deleted.


parseEverything_fromFile

public static CompModule parseEverything_fromFile(A4Reporter rep,
                                                  java.util.Map<java.lang.String,java.lang.String> loaded,
                                                  java.lang.String filename,
                                                  int initialResolutionMode)
                                           throws Err
Read everything from "file" and parse it; if it mentions submodules, open them and parse them too.

Parameters:
rep - - if nonnull, we will report compilation progress messages to it
loaded - - a cache of files that have been pre-fetched (can be null if there were no prefetching)
filename - - the main module we are parsing
initialResolutionMode - - use 1 for the historical behavior, and 2 for Alloy 4.2's new "universal implicit this" name resolution behavior
Returns:
the root CompModule which contains pointers to all submodules
Throws:
Err - if an error occurred

And if loaded!=null, it will contain all the files needed for this parse, and furthermore, other entries will be deleted.