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
Rename glue
and refactor push_tree
#106481
Conversation
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
/// Checks if the current token is a multiple-character token (or glued like `==`, `<=`, `...`) | ||
/// and returns the corresponding `TokenKind` if it is. | ||
/// | ||
/// if the current tokens is already complete, returns `None`. |
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.
I don't think this comment explains what this method is doing properly.
What this is doing is checking if the current token can be combined with the joint
token to turn into a multiple-character token.
/// and returns the corresponding `TokenKind` if it is. | ||
/// | ||
/// if the current tokens is already complete, returns `None`. | ||
pub fn check_is_multiple_char_token(&self, joint: &Token) -> Option<Token> { |
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.
I prefer the name glue
. Adding a doc comment is fine, but the new name doesn't really explain that we're trying to combine self
and joint
into a new "glued"/merged/combined/joined token.
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.
Certainly it doesn't seem very practical. Thank you for your feedback.
Renamed the glue function to check_is_multiple_char_token and added some comments.
And I think the
push_tree
function could only check the!Self::try_glue_to_last
condition, so I refactored it.thanks