Skip to content
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

Removing deprecated method calls from README #371

Merged
merged 1 commit into from
Feb 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,16 @@ fn main() {

// Because ident_list is silent, the iterator will contain idents
for pair in pairs {

let span = pair.clone().into_span();
// A pair is a combination of the rule which matched and a span of input
println!("Rule: {:?}", pair.as_rule());
println!("Span: {:?}", span);
println!("Text: {}", span.as_str());
println!("Span: {:?}", pair.as_span());
println!("Text: {}", pair.as_str());

// A pair can be converted to an iterator of the tokens which make it up:
for inner_pair in pair.into_inner() {
let inner_span = inner_pair.clone().into_span();
match inner_pair.as_rule() {
Rule::alpha => println!("Letter: {}", inner_span.as_str()),
Rule::digit => println!("Digit: {}", inner_span.as_str()),
Rule::alpha => println!("Letter: {}", inner_pair.as_str()),
Rule::digit => println!("Digit: {}", inner_pair.as_str()),
_ => unreachable!()
};
}
Expand Down