Skip to content

Commit

Permalink
Added Test cases for sequence operations and added select_suffix to p…
Browse files Browse the repository at this point in the history
…rimary expression
  • Loading branch information
Vishalk91-4 committed Jul 13, 2024
1 parent 87f1074 commit 18583ab
Show file tree
Hide file tree
Showing 5 changed files with 84,540 additions and 81,303 deletions.
5 changes: 3 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ module.exports = grammar({
$.unary_operator,
$.attribute,
$.subscript,
$.select_suffix,
$.call,
$.list,
$.list_comprehension,
Expand Down Expand Up @@ -724,13 +725,13 @@ module.exports = grammar({
field('argument', $.primary_expression),
)),

sequence_operation: $ => seq(choice(
sequence_operation: $ => prec(23, seq(choice(
$.in_operation,
$.not_in_operation,
$.concatenation,
$.subscript,
$.call,
)),
))),

in_operation: $ => prec.left(3, seq(choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary), 'in', choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary))),
not_in_operation: $ => prec.left(11, seq(choice($.list_comprehension, $.dictionary_comprehension, $.list, $.dictionary), 'not', 'in', $.expression)),
Expand Down
66 changes: 37 additions & 29 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,10 @@
"type": "SYMBOL",
"name": "subscript"
},
{
"type": "SYMBOL",
"name": "select_suffix"
},
{
"type": "SYMBOL",
"name": "call"
Expand Down Expand Up @@ -2129,7 +2133,7 @@
},
{
"type": "SYMBOL",
"name": "expression"
"name": "test"
}
]
},
Expand Down Expand Up @@ -2594,34 +2598,38 @@
}
},
"sequence_operation": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "in_operation"
},
{
"type": "SYMBOL",
"name": "not_in_operation"
},
{
"type": "SYMBOL",
"name": "concatenation"
},
{
"type": "SYMBOL",
"name": "subscript"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
]
"type": "PREC",
"value": 23,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "in_operation"
},
{
"type": "SYMBOL",
"name": "not_in_operation"
},
{
"type": "SYMBOL",
"name": "concatenation"
},
{
"type": "SYMBOL",
"name": "subscript"
},
{
"type": "SYMBOL",
"name": "call"
}
]
}
]
}
},
"in_operation": {
"type": "PREC_LEFT",
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@
"type": "schema_expr",
"named": true
},
{
"type": "select_suffix",
"named": true
},
{
"type": "string",
"named": true
Expand Down
Loading

0 comments on commit 18583ab

Please sign in to comment.