-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #36969 - nnethercote:rename-Parser-fields, r=eddyb
Clarify the positions of the lexer and parser The lexer and parser use unclear names to indicate their positions in the source code. I propose the following renamings. Lexer: ``` pos -> next_pos # it's actually the next pos! last_pos -> pos # it's actually the current pos! curr -> ch # the current char curr_is -> ch_is # tests the current char col (unchanged) # the current column ``` parser ``` - last_span -> prev_span # the previous token's span - last_token_kind -> prev_token_kind # the previous token's kind - LastTokenKind -> PrevTokenKind # ditto (but the type) - token (unchanged) # the current token - span (unchanged) # the current span ``` Things to note: - This proposal removes all uses of "last", which is an unclear word because it could mean (a) previous, (b) final, or (c) most recent, i.e. current. - The "current" things (ch, col, token, span) consistently lack a prefix. The "previous" and "next" things consistently have a prefix.
- Loading branch information
Showing
9 changed files
with
414 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.