OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** General options used by the compiler. */ | |
6 CSSOptions options; | |
7 | |
8 /** Extracts options from command-line arguments. */ | |
9 void parseOptions(List<String> args, var files) { | |
10 assert(options == null); | |
11 options = new CSSOptions(args, files); | |
12 } | |
13 | |
14 // TODO(sigmund): make into a generic option parser... | |
Siggi Cherem (dart-lang)
2012/03/15 01:21:25
what did I do?
:) - remove the TODO since this is
terry
2012/03/15 19:02:49
Done.
| |
15 class CSSOptions { | |
16 /** Location of corelib and other special dart libraries. */ | |
17 String libDir; | |
18 | |
19 /* The top-level dart script to compile. */ | |
20 String dartScript; | |
21 | |
22 /** Where to place the generated code. */ | |
23 String outfile; | |
24 | |
25 // Options that modify behavior significantly | |
26 | |
27 bool warningsAsErrors = false; | |
28 bool checkOnly = false; | |
29 | |
30 // Message support | |
31 bool throwOnErrors = false; | |
32 bool throwOnWarnings = false; | |
33 bool throwOnFatal = false; | |
34 bool showInfo = false; | |
35 bool showWarnings = true; | |
36 bool useColors = true; | |
37 | |
38 /** | |
39 * Options to be used later for passing to the generated code. These are all | |
40 * the arguments after the first dart script, if any. | |
41 */ | |
42 List<String> childArgs; | |
43 | |
44 CSSOptions(List<String> args, var files) { | |
45 bool ignoreUnrecognizedFlags = false; | |
46 bool passedLibDir = false; | |
47 childArgs = []; | |
48 | |
49 // Start from 2 to skip arguments representing the compiler command | |
50 // (node/python followed by frogsh/frog.py). | |
51 loop: for (int i = 2; i < args.length; i++) { | |
52 var arg = args[i]; | |
53 | |
54 switch (arg) { | |
55 case '--check-only': | |
56 checkOnly = true; | |
57 break; | |
58 | |
59 case '--verbose': | |
60 showInfo = true; | |
61 break; | |
62 | |
63 case '--suppress_warnings': | |
64 showWarnings = false; | |
65 break; | |
66 | |
67 case '--warnings_as_errors': | |
68 warningsAsErrors = true; | |
69 break; | |
70 | |
71 case '--throw_on_errors': | |
72 throwOnErrors = true; | |
73 break; | |
74 | |
75 case '--throw_on_warnings': | |
76 throwOnWarnings = true; | |
77 break; | |
78 | |
79 case '--no_colors': | |
80 useColors = false; | |
81 break; | |
82 | |
83 case '--checked': | |
84 checkOnly = true; | |
85 break; | |
86 | |
87 default: | |
88 if (!ignoreUnrecognizedFlags) { | |
89 print('unrecognized flag: "$arg"'); | |
90 } | |
91 } | |
92 } | |
93 } | |
94 } | |
OLD | NEW |