Skip to content

Commit

Permalink
fix: allow "not in" & "is not" to be queried
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime authored and amaanq committed Aug 17, 2024
1 parent 62165d7 commit c3d122b
Show file tree
Hide file tree
Showing 6 changed files with 52,225 additions and 54,077 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
!examples/cpython/Lib/test/test_type_params.py
!examples/cpython/Lib/test/test_compile.py
!examples/cpython/Tools/build/generate_re_casefix.py
!examples/cpython/Lib/test/test_annotationlib.py
!examples/cpython/Lib/test/test_type_params.py
invalid-files: |
examples/cpython/Lib/test/tokenizedata/badsyntax_3131.py
fuzz:
Expand Down
8 changes: 6 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,10 @@ module.exports = grammar({
field('argument', $.primary_expression),
)),

_not_in: _ => seq('not', 'in'),

_is_not: _ => seq('is', 'not'),

comparison_operator: $ => prec.left(PREC.compare, seq(
$.primary_expression,
repeat1(seq(
Expand All @@ -820,9 +824,9 @@ module.exports = grammar({
'>',
'<>',
'in',
alias(seq('not', 'in'), 'not in'),
alias($._not_in, 'not in'),
'is',
alias(seq('is', 'not'), 'is not'),
alias($._is_not, 'is not'),
)),
$.primary_expression,
)),
Expand Down
2 changes: 2 additions & 0 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"is"
"not"
"or"
"is not"
"not in"
] @operator

[
Expand Down
52 changes: 30 additions & 22 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3d122b

Please sign in to comment.