-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify Args
internals to a lexer approach
#326
Conversation
@serenity-rs/ferris-elite-collection-of-epic-code please review |
src/framework/standard/args.rs
Outdated
@@ -261,7 +359,10 @@ impl Args { | |||
&s[1..end] | |||
} | |||
|
|||
/// The amount of args. | |||
/// The full amount of recognized arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we settled for British English, we should write recognised.
src/framework/standard/args.rs
Outdated
self.offset >= self.args.len() | ||
} | ||
|
||
/// Go one step behind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot a dot after behind.
src/framework/standard/args.rs
Outdated
/// | ||
/// let mut args = Args::new("42 69 95", &[" ".to_string()]); | ||
/// | ||
/// // Lets parse 'em numbers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Let's
.
src/framework/standard/args.rs
Outdated
/// | ||
/// // Oh, no! I actually wanted to multiply all of them by 2! | ||
/// // I don't want to call `rewind` 3 times manually.... | ||
/// // Wait, i could just go entirely back! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to capitalise i
.
src/framework/standard/args.rs
Outdated
@@ -316,25 +483,12 @@ impl Args { | |||
/// | |||
/// assert_eq!(args.len_quoted(), 2); // `2` because `["42", "69"]` | |||
/// ``` | |||
#[deprecated(since = "0.5.3", note = "its task was merged with `len`, please use it instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should depreciation-notes start capitalised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really.
Though, i suppose i could.
This is an overhaul to the method-of-parsing things into "arguments" to an approach that's:
Also, for convenience, this adds 2 new methods:
rewind
- Goes one step behindrestore
- Goes back to the start(And tweaks docs as well)