fix digit escape in highlight regex for constants #90
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.
Checklist (:heavy_check_mark:)
I believe this regex escape
"\d"
actually needs to be"\\d"
to become the digit escape.pies.java
query1.scm
((identifier) @constant (#match? @constant "^_*[A-Z][A-Z\d_]+"))
query2.scm
((identifier) @constant (#match? @constant "^_*[A-Z][A-Z\d_]+$"))
query3.scm
((identifier) @constant (#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
reproduction
query1.scm
is the current query rule, and it works but only because it doesn't end in$
, so in theory other characters could end up matching the query than digits.query2.scm
shows that the\d
escape doesn't work: it fails to match the constant with digits.query3.scm
switches to\\d
with the trailing$
and it works again!It looks like there's one of these
\d
s in the php queries (pr incoming...) but elsewhere there're\\d
s (e.g. this ruby query)