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 committed Jul 29, 2024
1 parent 0dee05e commit b09a556
Show file tree
Hide file tree
Showing 6 changed files with 52,066 additions and 53,953 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
examples/**/*.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 @@ -806,6 +806,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 @@ -819,9 +823,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.

22 changes: 10 additions & 12 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 b09a556

Please sign in to comment.