Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: pkg/args/lib/args.dart

Issue 11312203: "Reverting 14829-14832" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/args/test/args_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * This library lets you define parsers for parsing raw command-line arguments 6 * This library lets you define parsers for parsing raw command-line arguments
7 * into a set of options and values using [GNU][] and [POSIX][] style options. 7 * into a set of options and values using [GNU][] and [POSIX][] style options.
8 * 8 *
9 * ## Defining options ## 9 * ## Defining options ##
10 * 10 *
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 import 'dart:math'; 193 import 'dart:math';
194 194
195 // TODO(rnystrom): Use "package:" URL here when test.dart can handle pub. 195 // TODO(rnystrom): Use "package:" URL here when test.dart can handle pub.
196 import 'src/utils.dart'; 196 import 'src/utils.dart';
197 197
198 /** 198 /**
199 * A class for taking a list of raw command line arguments and parsing out 199 * A class for taking a list of raw command line arguments and parsing out
200 * options and flags from them. 200 * options and flags from them.
201 */ 201 */
202 class ArgParser { 202 class ArgParser {
203 static final _SOLO_OPT = new RegExp(r'^-([a-zA-Z0-9])$'); 203 static const _SOLO_OPT = const RegExp(r'^-([a-zA-Z0-9])$');
204 static final _ABBR_OPT = new RegExp(r'^-([a-zA-Z0-9]+)(.*)$'); 204 static const _ABBR_OPT = const RegExp(r'^-([a-zA-Z0-9]+)(.*)$');
205 static final _LONG_OPT = new RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$'); 205 static const _LONG_OPT = const RegExp(r'^--([a-zA-Z\-_0-9]+)(=(.*))?$');
206 206
207 final Map<String, _Option> _options; 207 final Map<String, _Option> _options;
208 208
209 /** 209 /**
210 * The names of the options, in the order that they were added. This way we 210 * The names of the options, in the order that they were added. This way we
211 * can generate usage information in the same order. 211 * can generate usage information in the same order.
212 */ 212 */
213 // TODO(rnystrom): Use an ordered map type, if one appears. 213 // TODO(rnystrom): Use an ordered map type, if one appears.
214 final List<String> _optionNames; 214 final List<String> _optionNames;
215 215
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 allowedBuffer.add(allowed); 776 allowedBuffer.add(allowed);
777 if (allowed == option.defaultValue) { 777 if (allowed == option.defaultValue) {
778 allowedBuffer.add(' (default)'); 778 allowedBuffer.add(' (default)');
779 } 779 }
780 first = false; 780 first = false;
781 } 781 }
782 allowedBuffer.add(']'); 782 allowedBuffer.add(']');
783 return allowedBuffer.toString(); 783 return allowedBuffer.toString();
784 } 784 }
785 } 785 }
OLDNEW
« no previous file with comments | « no previous file | pkg/args/test/args_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698