@willbooster/tree-sitter-python 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/grammar.js CHANGED
@@ -54,7 +54,6 @@ module.exports = grammar({
54
54
  [$.tuple, $.tuple_pattern],
55
55
  [$.list, $.list_pattern],
56
56
  [$.with_item, $.tuple],
57
- [$.named_expression, $.as_pattern],
58
57
  [$.print_statement, $.primary_expression],
59
58
  [$.match_statement, $.primary_expression],
60
59
  ],
@@ -339,7 +338,10 @@ module.exports = grammar({
339
338
  optional(token(prec(1, '*'))),
340
339
  optional(
341
340
  choice(
342
- seq(field('value', $.expression), optional(seq('as', field('alias', $.expression)))),
341
+ seq(
342
+ field('value', $.expression),
343
+ optional(seq('as', field('alias', choice($.identifier, $.keyword_identifier))))
344
+ ),
343
345
  commaSep1(field('value', $.expression))
344
346
  )
345
347
  ),
@@ -354,7 +356,7 @@ module.exports = grammar({
354
356
  with_clause: ($) =>
355
357
  choice(seq(commaSep1($.with_item), optional(',')), seq('(', commaSep1($.with_item), optional(','), ')')),
356
358
 
357
- with_item: ($) => prec.dynamic(1, seq(field('value', $.expression))),
359
+ with_item: ($) => prec.dynamic(1, field('value', choice($.expression, $.as_pattern))),
358
360
 
359
361
  function_definition: ($) =>
360
362
  seq(
@@ -643,7 +645,7 @@ module.exports = grammar({
643
645
 
644
646
  _expression_within_for_in_clause: ($) => choice($.expression, alias($.lambda_within_for_in_clause, $.lambda)),
645
647
 
646
- expression: ($) => choice($._expression_without_named_expression, $.named_expression, $.as_pattern),
648
+ expression: ($) => choice($._expression_without_named_expression, $.named_expression),
647
649
 
648
650
  _expression_without_named_expression: ($) =>
649
651
  choice(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-python",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "Python grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -50,11 +50,6 @@
50
50
  (identifier) @constructor
51
51
  (tuple (identifier) @constructor)
52
52
  (parenthesized_expression (identifier) @constructor)
53
- (as_pattern [
54
- (identifier) @constructor
55
- (tuple (identifier) @constructor)
56
- (parenthesized_expression (identifier) @constructor)
57
- ])
58
53
  ])
59
54
  (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
60
55
 
@@ -3,10 +3,6 @@
3
3
  "type": "expression",
4
4
  "named": true,
5
5
  "subtypes": [
6
- {
7
- "type": "as_pattern",
8
- "named": true
9
- },
10
6
  {
11
7
  "type": "boolean_operator",
12
8
  "named": true
@@ -306,10 +302,6 @@
306
302
  "multiple": false,
307
303
  "required": true,
308
304
  "types": [
309
- {
310
- "type": "as_pattern",
311
- "named": true
312
- },
313
305
  {
314
306
  "type": "boolean_operator",
315
307
  "named": true
@@ -1643,7 +1635,7 @@
1643
1635
  "required": false,
1644
1636
  "types": [
1645
1637
  {
1646
- "type": "expression",
1638
+ "type": "identifier",
1647
1639
  "named": true
1648
1640
  }
1649
1641
  ]
@@ -3603,6 +3595,10 @@
3603
3595
  "multiple": false,
3604
3596
  "required": true,
3605
3597
  "types": [
3598
+ {
3599
+ "type": "as_pattern",
3600
+ "named": true
3601
+ },
3606
3602
  {
3607
3603
  "type": "expression",
3608
3604
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "metadata": {
22
- "version": "7.0.0",
22
+ "version": "8.0.0",
23
23
  "license": "MIT",
24
24
  "description": "Python grammar for tree-sitter",
25
25
  "authors": [