Repository navigation
Conversation
_consume_quoted_identifier, _consume_literal, and _consume_raw_string_literal set the token's end to its length instead of start + length, producing an end before start for any token not at offset 0. Every other token type uses start + length.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #380.
Problem
_consume_quoted_identifier,_consume_literal, and_consume_raw_string_literalset the token'sendtotoken_len(the token length) instead ofstart + token_len. For any such token that is not at offset 0,endis smaller thanstart:Every other token type already uses
start + len(...).Fix
Set
endtostart + token_lenin all three places. Search results are unaffected; only the position metadata changes.Tests
Added
test_position_quoted_identifier,test_position_literal_not_at_start, andtest_position_raw_string_not_at_starttotests/test_lexer.py, each asserting the fixed offsets andend >= start.Validation: