| 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 args.src.parser; | |
| 6 | |
| 7 import 'arg_parser.dart'; | 5 import 'arg_parser.dart'; |
| 8 import 'arg_results.dart'; | 6 import 'arg_results.dart'; |
| 9 import 'option.dart'; | 7 import 'option.dart'; |
| 10 | 8 |
| 11 final _SOLO_OPT = new RegExp(r'^-([a-zA-Z0-9])$'); | 9 final _SOLO_OPT = new RegExp(r'^-([a-zA-Z0-9])$'); |
| 12 final _ABBR_OPT = new RegExp(r'^-([a-zA-Z0-9]+)(.*)$'); | 10 final _ABBR_OPT = new RegExp(r'^-([a-zA-Z0-9]+)(.*)$'); |
| 13 final _LONG_OPT = new RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$'); | 11 final _LONG_OPT = new RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$'); |
| 14 | 12 |
| 15 /// The actual argument parsing class. | 13 /// The actual argument parsing class. |
| 16 /// | 14 /// |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 278 } |
| 281 | 279 |
| 282 /// Validates that [value] is allowed as a value of [option]. | 280 /// Validates that [value] is allowed as a value of [option]. |
| 283 void _validateAllowed(Option option, String value) { | 281 void _validateAllowed(Option option, String value) { |
| 284 if (option.allowed == null) return; | 282 if (option.allowed == null) return; |
| 285 | 283 |
| 286 validate(option.allowed.contains(value), | 284 validate(option.allowed.contains(value), |
| 287 '"$value" is not an allowed value for option "${option.name}".'); | 285 '"$value" is not an allowed value for option "${option.name}".'); |
| 288 } | 286 } |
| 289 } | 287 } |
| OLD | NEW |