-
Notifications
You must be signed in to change notification settings - Fork 29
🐛 add a DoubleColon to the Token struct in the lexer.rs
#243
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,7 @@ copy_iterator = "warn" | |
| default_trait_access = "warn" | ||
| doc_link_with_quotes = "warn" | ||
| doc_markdown = "warn" | ||
| empty_enum = "warn" | ||
| empty_enums = "warn" | ||
| enum_glob_use = "allow" | ||
| expl_impl_clone_on_copy = "warn" | ||
| explicit_deref_methods = "warn" | ||
|
|
@@ -152,7 +152,7 @@ struct_field_names = "warn" | |
| too_many_lines = "allow" | ||
| transmute_ptr_to_ptr = "warn" | ||
| trivially_copy_pass_by_ref = "warn" | ||
| unchecked_duration_subtraction = "warn" | ||
| unchecked_time_subtraction = "warn" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The solution is the same as in the previous answer. |
||
| unicode_not_nfc = "warn" | ||
| unnecessary_box_returns = "warn" | ||
| unnecessary_join = "warn" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ pub enum Token<'src> { | |
|
|
||
| // Control symbols | ||
| Arrow, | ||
| /// Represents a contiguous `::` token. | ||
| /// This prevents the lexer from allowing spaces between colons (e.g., `use a: :b`), | ||
| DoubleColon, | ||
| Colon, | ||
| Semi, | ||
| Comma, | ||
|
|
@@ -71,6 +74,7 @@ impl<'src> fmt::Display for Token<'src> { | |
| Token::Match => write!(f, "match"), | ||
|
|
||
| Token::Arrow => write!(f, "->"), | ||
| Token::DoubleColon => write!(f, "::"), | ||
| Token::Colon => write!(f, ":"), | ||
| Token::Semi => write!(f, ";"), | ||
| Token::Comma => write!(f, ","), | ||
|
|
@@ -145,23 +149,30 @@ pub fn lexer<'src>( | |
| _ => Token::Ident(s), | ||
| }); | ||
|
|
||
| let jet = just("jet::") | ||
| .labelled("jet") | ||
| let jet = just("jet") | ||
| .padded() | ||
| .ignore_then(just("::")) | ||
| .padded() | ||
|
Comment on lines
+152
to
+155
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a breaking change in respect to the previous grammar Let's not add Or do you have a reasoning why |
||
| .ignore_then(text::ident()) | ||
| .map(Token::Jet); | ||
| let witness = just("witness::") | ||
| .labelled("witness") | ||
| let witness = just("witness") | ||
| .padded() | ||
| .ignore_then(just("::")) | ||
| .padded() | ||
| .ignore_then(text::ident()) | ||
| .map(Token::Witness); | ||
| let param = just("param::") | ||
| .labelled("param") | ||
| let param = just("param") | ||
| .padded() | ||
| .ignore_then(just("::")) | ||
| .padded() | ||
| .ignore_then(text::ident()) | ||
| .map(Token::Param); | ||
|
|
||
| let op = choice(( | ||
| just("->").to(Token::Arrow), | ||
| just("=>").to(Token::FatArrow), | ||
| just("=").to(Token::Eq), | ||
| just("::").to(Token::DoubleColon), | ||
| just(":").to(Token::Colon), | ||
| just(";").to(Token::Semi), | ||
| just(",").to(Token::Comma), | ||
|
|
||
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.
Explain in description why this is changed
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.
After updating to Rust
1.94.0,cargo clippystarted complaining about these lints. I just applied the automatic suggestions from Clippy to fix the warnings.