@@ -40,8 +40,7 @@ public static void main(String[] args) throws IOException {
4040 return ;
4141 }
4242
43- final Options options = new Options ();
44- boolean beautifyMode = false ;
43+ final RunOptions options = new RunOptions ();
4544 String input = null ;
4645 for (int i = 0 ; i < args .length ; i ++) {
4746 switch (args [i ]) {
@@ -52,19 +51,19 @@ public static void main(String[] args) throws IOException {
5251
5352 case "-b" :
5453 case "--beautify" :
55- beautifyMode = true ;
54+ options . beautifyMode = true ;
5655 break ;
57-
56+
5857 case "-t" :
5958 case "--showtokens" :
6059 options .showTokens = true ;
6160 break ;
62-
61+
6362 case "-m" :
6463 case "--showtime" :
6564 options .showMeasurements = true ;
6665 break ;
67-
66+
6867 case "-o" :
6968 case "--optimize" :
7069 if (i + 1 < args .length ) {
@@ -88,7 +87,7 @@ public static void main(String[] args) throws IOException {
8887 case "--lint" :
8988 options .lintMode = true ;
9089 return ;
91-
90+
9291 case "-f" :
9392 case "--file" :
9493 if (i + 1 < args .length ) {
@@ -104,7 +103,7 @@ public static void main(String[] args) throws IOException {
104103 System .arraycopy (ownlangArgs , 0 , newArgs , 0 , ownlangArgs .length );
105104 Sandbox .main (newArgs );
106105 return ;
107-
106+
108107 default :
109108 if (input == null ) {
110109 input = args [i ];
@@ -116,20 +115,15 @@ public static void main(String[] args) throws IOException {
116115 if (input == null ) {
117116 throw new IllegalArgumentException ("Empty input" );
118117 }
119- if (beautifyMode ) {
118+ if (options . beautifyMode ) {
120119 System .out .println (Beautifier .beautify (input ));
121120 return ;
122121 }
123122 run (input , options );
124123 }
125124
126125 private static void runDefault () throws IOException {
127- final Options options = new Options ();
128- options .showAst = false ;
129- options .showTokens = false ;
130- options .showMeasurements = false ;
131- options .lintMode = false ;
132- options .optimizationLevel = 0 ;
126+ final RunOptions options = new RunOptions ();
133127 run (SourceLoader .readSource ("program.own" ), options );
134128 }
135129
@@ -153,7 +147,7 @@ private static void createOwnLangArgs(String[] javaArgs, int index) {
153147 System .arraycopy (javaArgs , index , ownlangArgs , 0 , ownlangArgs .length );
154148 }
155149
156- private static void run (String input , Options options ) {
150+ private static void run (String input , RunOptions options ) {
157151 options .validate ();
158152 final TimeMeasurement measurement = new TimeMeasurement ();
159153 measurement .start ("Tokenize time" );
@@ -209,16 +203,18 @@ private static void run(String input, Options options) {
209203 }
210204 }
211205
212- private static class Options {
206+ private static class RunOptions {
213207 boolean showTokens , showAst , showMeasurements ;
214208 boolean lintMode ;
209+ boolean beautifyMode ;
215210 int optimizationLevel ;
216211
217- Options () {
212+ RunOptions () {
218213 showTokens = false ;
219214 showAst = false ;
220215 showMeasurements = false ;
221216 lintMode = false ;
217+ beautifyMode = false ;
222218 optimizationLevel = 0 ;
223219 }
224220
0 commit comments