Skip to content

Commit c3d122b

Browse files
ObserverOfTimeamaanq
authored andcommitted
fix: allow "not in" & "is not" to be queried
1 parent 62165d7 commit c3d122b

File tree

6 files changed

+52225
-54077
lines changed

6 files changed

+52225
-54077
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
!examples/cpython/Lib/test/test_type_params.py
5454
!examples/cpython/Lib/test/test_compile.py
5555
!examples/cpython/Tools/build/generate_re_casefix.py
56+
!examples/cpython/Lib/test/test_annotationlib.py
57+
!examples/cpython/Lib/test/test_type_params.py
5658
invalid-files: |
5759
examples/cpython/Lib/test/tokenizedata/badsyntax_3131.py
5860
fuzz:

grammar.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,10 @@ module.exports = grammar({
807807
field('argument', $.primary_expression),
808808
)),
809809

810+
_not_in: _ => seq('not', 'in'),
811+
812+
_is_not: _ => seq('is', 'not'),
813+
810814
comparison_operator: $ => prec.left(PREC.compare, seq(
811815
$.primary_expression,
812816
repeat1(seq(
@@ -820,9 +824,9 @@ module.exports = grammar({
820824
'>',
821825
'<>',
822826
'in',
823-
alias(seq('not', 'in'), 'not in'),
827+
alias($._not_in, 'not in'),
824828
'is',
825-
alias(seq('is', 'not'), 'is not'),
829+
alias($._is_not, 'is not'),
826830
)),
827831
$.primary_expression,
828832
)),

queries/highlights.scm

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
"is"
9797
"not"
9898
"or"
99+
"is not"
100+
"not in"
99101
] @operator
100102

101103
[

src/grammar.json

+30-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

+10-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)