You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The name really get me confused because i was doing something like that
(just a little context here, in this piece of code , I use a custom lexer which pop token::EOF also for a custom token ( %> for a <% xxxx %> templating system ), EOF was chosen because
i needed to have a value in the token::Token enum to be able to leverage the other parser functions
it needed to be something that would not be parsed as part of an expression
something for which i will still have a way to make the difference between the actual token and my custom one (for EOF i still have parser.reader.is_eof() for me )
and it was not working because parser.token == token::EOF was actually testing the NEXT token , because bump_and_get was actually first returning the last token (the one used in the match) and AFTER moving the parser by one more token, (the one stored in parser.token)
anyway I've already been to fix my problem, so the problem is more about naming
my proposition
replace bump_and_get by get_and_bump
maybe permit one more value in the Token enum a token::USER_DEFINED(uint), so in order to help people writing syntax extension that superset rust, to still be able to use the normal parser, and just have to implement their own custom lexer::Reader trait.
The text was updated successfully, but these errors were encountered:
Inline function to avoid naming confusion.
Fixes the non-RFC requiring portion of #18394. The suggestion for a new token there probably needs to either be refiled onto rust-lang/rfcs if it's still relevant (may not be given Macros 2.0 work, not sure).
The name really get me confused because i was doing something like that
(just a little context here, in this piece of code , I use a custom lexer which pop token::EOF also for a custom token (
%>
for a <% xxxx %> templating system ), EOF was chosen becauseand it was not working because parser.token == token::EOF was actually testing the NEXT token , because bump_and_get was actually first returning the last token (the one used in the match) and AFTER moving the parser by one more token, (the one stored in parser.token)
anyway I've already been to fix my problem, so the problem is more about naming
my proposition
bump_and_get
byget_and_bump
The text was updated successfully, but these errors were encountered: