| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js; | 5 library dart2js; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 import 'dart:utf'; | 9 import 'dart:utf'; |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Extract the parameter of an option. | 30 * Extract the parameter of an option. |
| 31 * | 31 * |
| 32 * For example, in ['--out=fisk.js'] and ['-ohest.js'], the parameters | 32 * For example, in ['--out=fisk.js'] and ['-ohest.js'], the parameters |
| 33 * are ['fisk.js'] and ['hest.js'], respectively. | 33 * are ['fisk.js'] and ['hest.js'], respectively. |
| 34 */ | 34 */ |
| 35 String extractParameter(String argument) { | 35 String extractParameter(String argument) { |
| 36 // m[0] is the entire match (which will be equal to argument). m[1] | 36 // m[0] is the entire match (which will be equal to argument). m[1] |
| 37 // is something like "-o" or "--out=", and m[2] is the parameter. | 37 // is something like "-o" or "--out=", and m[2] is the parameter. |
| 38 Match m = const RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument); | 38 Match m = new RegExp('^(-[a-z]|--.+=)(.*)').firstMatch(argument); |
| 39 if (m == null) helpAndFail('Error: Unknown option "$argument".'); | 39 if (m == null) helpAndFail('Error: Unknown option "$argument".'); |
| 40 return m[2]; | 40 return m[2]; |
| 41 } | 41 } |
| 42 | 42 |
| 43 String extractPath(String argument) { | 43 String extractPath(String argument) { |
| 44 String path = nativeToUriPath(extractParameter(argument)); | 44 String path = nativeToUriPath(extractParameter(argument)); |
| 45 return path.endsWith("/") ? path : "$path/"; | 45 return path.endsWith("/") ? path : "$path/"; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) { | 48 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } catch (ignored) { | 433 } catch (ignored) { |
| 434 print('Internal error: error while printing exception'); | 434 print('Internal error: error while printing exception'); |
| 435 } | 435 } |
| 436 try { | 436 try { |
| 437 print(trace); | 437 print(trace); |
| 438 } finally { | 438 } finally { |
| 439 exit(253); // 253 is recognized as a crash by our test scripts. | 439 exit(253); // 253 is recognized as a crash by our test scripts. |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 } | 442 } |
| OLD | NEW |