@@ -28,7 +28,7 @@ args = process.argv[1 + (process.argv[0] is 'node') ..]
28
28
29
29
# ignore args after --
30
30
additionalArgs = []
31
- if ' --' in args then additionalArgs = args .splice (args .indexOf ' --' ), 9e9
31
+ if ' --' in args then additionalArgs = ( args .splice (args .indexOf ' --' ), 9e9 )[ 1 .. ]
32
32
33
33
34
34
# initialise options
@@ -109,19 +109,23 @@ while args.length
109
109
options[optionMap[match[2 ]]] = if match[1 ]? then off else on
110
110
else if match = (reShortParameter .exec arg) ? reLongParameter .exec arg
111
111
options[optionMap[match[1 ]]] = args .shift ()
112
+ else if match = / ^ (-. | --. * )$ / .exec arg
113
+ console .error " Unrecognised option '#{ match[0 ].replace / '/ g , ' \\\' ' } '"
114
+ process .exit 1
112
115
else
113
116
positionalArgs .push arg
114
117
115
118
116
119
# input validation
117
120
121
+ positionalArgs = positionalArgs .concat additionalArgs
118
122
unless options .compile or options .js or options .parse or options .eval or options .cscodegen
119
123
if not escodegen?
120
124
options .compile = on
121
125
else if positionalArgs .length
122
126
options .eval = on
123
127
options .input = positionalArgs .shift ()
124
- additionalArgs = [ positionalArgs... , additionalArgs ... ]
128
+ additionalArgs = positionalArgs
125
129
else
126
130
options .repl = on
127
131
@@ -248,9 +252,10 @@ else
248
252
249
253
# preprocess
250
254
if options .debug
251
- Preprocessor .processSync input
252
- console .error ' ### PREPROCESSED CS-AST ###'
253
- console .error numberLines humanReadable input .trim ()
255
+ try
256
+ Preprocessor .processSync input
257
+ console .error ' ### PREPROCESSED CS-AST ###'
258
+ console .error numberLines humanReadable input .trim ()
254
259
255
260
# parse
256
261
result = CoffeeScript .parse input, optimise : no
0 commit comments