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

Unified Diff: pkg/args/lib/src/parser.dart

Issue 260963007: Move allowTrailingOptions into ArgParser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: pkg/args/lib/src/parser.dart
diff --git a/pkg/args/lib/src/parser.dart b/pkg/args/lib/src/parser.dart
index 550fe63e065294d07167b6f0d1d241bdb11ffc51..bccce64d09d54eba4fd6ec423de5e74a95cd7d1e 100644
--- a/pkg/args/lib/src/parser.dart
+++ b/pkg/args/lib/src/parser.dart
@@ -28,9 +28,6 @@ class Parser {
*/
final Parser parent;
- /** If `true`, parsing will continue after a non-option argument. */
- final bool allowTrailingOptions;
-
/** The grammar being parsed. */
final ArgParser grammar;
@@ -43,8 +40,7 @@ class Parser {
/** The accumulated parsed options. */
final Map<String, dynamic> results = <String, dynamic>{};
- Parser(this.commandName, this.grammar, this.args, this.parent, rest,
- {this.allowTrailingOptions: false}) {
+ Parser(this.commandName, this.grammar, this.args, this.parent, rest) {
if (rest != null) this.rest.addAll(rest);
}
@@ -79,8 +75,7 @@ class Parser {
if (command != null) {
validate(rest.isEmpty, 'Cannot specify arguments before a command.');
var commandName = args.removeAt(0);
- var commandParser = new Parser(commandName, command, args, this, rest,
- allowTrailingOptions: allowTrailingOptions);
+ var commandParser = new Parser(commandName, command, args, this, rest);
commandResults = commandParser.parse();
// All remaining arguments were passed to command so clear them here.
@@ -96,7 +91,7 @@ class Parser {
// This argument is neither option nor command, so stop parsing unless
// the [allowTrailingOptions] option is set.
- if (!allowTrailingOptions) break;
+ if (!grammar.allowTrailingOptions) break;
rest.add(args.removeAt(0));
}

Powered by Google App Engine
This is Rietveld 408576698