Responsible for parsing command-line arguments and executing the WhileyCompiler. @author David J. Pearce
| 34 | * |
| 35 | */ |
| 36 | public class Compiler { |
| 37 | /** |
| 38 | * The outgoing mailbox for this compiler. Essentially, all generated syntax |
| 39 | * errors are sent here. |
| 40 | */ |
| 41 | private MailBox<SyntaxError> mailbox = new PrintStreamErrorHandler(System.out); |
| 42 | /** |
| 43 | * Source directory containing whiley files. |
| 44 | */ |
| 45 | private File whileydir = new File("."); |
| 46 | /** |
| 47 | * Destination directory of Wyil files. |
| 48 | */ |
| 49 | private File wyildir = new File("."); |
| 50 | /** |
| 51 | * Identify paths for source files to compile. |
| 52 | */ |
| 53 | private List<Trie> sources = new ArrayList<>(); |
| 54 | /** |
| 55 | * Identify path for binary target to generate. |
| 56 | */ |
| 57 | private Trie target = Trie.fromString("main"); |
| 58 | /** |
| 59 | * WyIL dependencies to include during compilation. |
| 60 | */ |
| 61 | private List<File> whileypath = Collections.EMPTY_LIST; |
| 62 | private List<WyilFile> dependencies = new ArrayList<>(); |
| 63 | private boolean verification; |
| 64 | private boolean counterexamples; |
| 65 | private boolean strict; |
| 66 | private boolean linking; |
| 67 | |
| 68 | public Compiler setErrorHandler(MailBox<SyntaxError> mailbox) { |
| 69 | this.mailbox = mailbox; |
| 70 | return this; |
| 71 | } |
| 72 | |
| 73 | public Compiler setStrict(boolean b) { |
| 74 | this.strict = b; |
| 75 | return this; |
| 76 | } |
| 77 | |
| 78 | public Compiler setLinking(boolean b) { |
| 79 | this.linking = b; |
| 80 | return this; |
| 81 | } |
| 82 | |
| 83 | public Compiler setVerification(boolean b) { |
| 84 | this.verification = b; |
| 85 | return this; |
| 86 | } |
| 87 | |
| 88 | public Compiler setCounterExamples(boolean b) { |
| 89 | this.counterexamples = b; |
| 90 | return this; |
| 91 | } |
| 92 | |
| 93 | public Compiler setTarget(Trie target) { |
nothing calls this directly
no test coverage detected