fix: handle double quotes in regex scanner to allow spaces in glob patterns#322
Open
Whoaa512 wants to merge 1 commit intotree-sitter:masterfrom
Open
fix: handle double quotes in regex scanner to allow spaces in glob patterns#322Whoaa512 wants to merge 1 commit intotree-sitter:masterfrom
Whoaa512 wants to merge 1 commit intotree-sitter:masterfrom
Conversation
…tterns Fixes tree-sitter#321 The scanner was tracking single-quoted strings but not double-quoted strings when scanning REGEX_NO_SPACE tokens. This caused glob patterns like *"A B"* to fail parsing because the space inside the double quotes was treated as a regex-terminating space. Added in_double_quote tracking to the State struct and updated all three was_space checks to also consider whether we're inside a double-quoted string.
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 #321
Problem
Glob patterns with quoted strings containing spaces failed to parse in
[[ ]]test commands:Root Cause
The scanner tracked
in_single_quotestate but notin_double_quotewhen scanningREGEX_NO_SPACEtokens. When encountering a space inside double quotes, it incorrectly treated it as a regex-terminating space.Fix
in_double_quoteto the State struct in the scanner"character similar to'for entering/exiting quoted stringswas_spacechecks to also considerin_double_quoteTesting