| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.cmdline; | 5 library dart2js.cmdline; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
| 8 import 'dart:convert' show UTF8, LineSplitter; | 8 import 'dart:convert' show UTF8, LineSplitter; |
| 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; | 9 import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr; |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) { | 75 void parseCommandLine(List<OptionHandler> handlers, List<String> argv) { |
| 76 // TODO(ahe): Use ../../args/args.dart for parsing options instead. | 76 // TODO(ahe): Use ../../args/args.dart for parsing options instead. |
| 77 var patterns = <String>[]; | 77 var patterns = <String>[]; |
| 78 for (OptionHandler handler in handlers) { | 78 for (OptionHandler handler in handlers) { |
| 79 patterns.add(handler.pattern); | 79 patterns.add(handler.pattern); |
| 80 } | 80 } |
| 81 var pattern = new RegExp('^(${patterns.join(")\$|^(")})\$'); | 81 var pattern = new RegExp('^(${patterns.join(")\$|^(")})\$'); |
| 82 | 82 |
| 83 Iterator<String> arguments = argv.iterator; | 83 Iterator<String> arguments = argv.iterator; |
| 84 OUTER: while (arguments.moveNext()) { | 84 OUTER: |
| 85 while (arguments.moveNext()) { |
| 85 String argument = arguments.current; | 86 String argument = arguments.current; |
| 86 Match match = pattern.firstMatch(argument); | 87 Match match = pattern.firstMatch(argument); |
| 87 assert(match.groupCount == handlers.length); | 88 assert(match.groupCount == handlers.length); |
| 88 for (int i = 0; i < handlers.length; i++) { | 89 for (int i = 0; i < handlers.length; i++) { |
| 89 if (match[i + 1] != null) { | 90 if (match[i + 1] != null) { |
| 90 OptionHandler handler = handlers[i]; | 91 OptionHandler handler = handlers[i]; |
| 91 if (handler.multipleArguments) { | 92 if (handler.multipleArguments) { |
| 92 handler.handle(arguments); | 93 handler.handle(arguments); |
| 93 } else { | 94 } else { |
| 94 handler.handle(argument); | 95 handler.handle(argument); |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 @override | 995 @override |
| 995 void close() { | 996 void close() { |
| 996 // Do nothing. | 997 // Do nothing. |
| 997 } | 998 } |
| 998 | 999 |
| 999 @override | 1000 @override |
| 1000 void addError(errorEvent, [StackTrace stackTrace]) { | 1001 void addError(errorEvent, [StackTrace stackTrace]) { |
| 1001 // Ignore | 1002 // Ignore |
| 1002 } | 1003 } |
| 1003 } | 1004 } |
| OLD | NEW |