Merge pull request #19929 from github/tausbn/python-update-tree-sitter-dependency

Python: Update `tree-sitter` dependency
This commit is contained in:
Taus
2025-09-17 13:40:13 +02:00
committed by GitHub
17 changed files with 213 additions and 384 deletions

View File

@@ -6,16 +6,6 @@
(module) @mod
{ let @mod.node = (ast-node @mod "Module") }
(_) @anynode
{
scan (node-type @anynode) {
"^(ERROR|MISSING)$" {
let @anynode.node = (ast-node @anynode "SyntaxErrorNode")
attr (@anynode.node) source = (source-text @anynode)
}
}
}
(parenthesized_expression) @nd
{ let @nd.node = (ast-node @nd "Expr") }
@@ -416,13 +406,13 @@
attr (@if.node) _location_end = (location-end @expr)
}
(generator_expression . "(" . (comment)* . (expression) @start (for_in_clause) @child [(for_in_clause) (if_clause)] @end . (comment)* . ")" .) @genexpr
(generator_expression . "(" . (comment)* . (expression) @start (for_in_clause) @child [(for_in_clause) (if_clause)] @end . (comment)* . ")" .) @_genexpr
{
attr (@child.node) _location_start = (location-start @start)
attr (@child.node) _location_end = (location-end @end)
}
(generator_expression . "(" . (comment)* . (expression) @start (for_in_clause) @end . (comment)* . ")" .) @genexpr
(generator_expression . "(" . (comment)* . (expression) @start (for_in_clause) @end . (comment)* . ")" .) @_genexpr
{
attr (@end.node) _location_start = (location-start @start)
attr (@end.node) _location_end = (location-end @end)
@@ -524,7 +514,7 @@
attr (@del.node -> @target.node) targets = (named-child-index @target)
}
(delete_statement target: (_) @target) @del
(delete_statement target: (_) @target) @_del
{
attr (@target.node) ctx = "del"
}
@@ -798,8 +788,8 @@
(dictionary_comprehension
body: (pair
key: (_) @key
value: (_) @value
key: (_) @_key
value: (_) @_value
)
) @genexpr
{
@@ -1299,7 +1289,7 @@
; the index of the left-hand side of the current assignment.
; Base case, for the outermost assignment we set the outermost node to this node, and the index to zero.
(expression_statement (assignment !type) @assign) @expr
(expression_statement (assignment !type) @assign) @_expr
{
let @assign.outermost_assignment = @assign.node
let @assign.target_index = 0
@@ -1358,7 +1348,7 @@
}
(assignment
left: (_) @target
left: (_) @_target
type: (_)
right: (_) @value
) @assign
@@ -2330,7 +2320,7 @@
attr (@operand.node) ctx = "load"
}
(unary_operator "~" @op) @unaryop
(unary_operator "~" @_op) @unaryop
{
attr (@unaryop.node) op = "~"
}
@@ -2614,7 +2604,7 @@
; Async status
; NOTE: We only set the `is_async` field on the _first_ clause of the `with` statement,
; as this is the behaviour of the old parser.
(with_statement "async" "with" @with_keyword (with_clause . (with_item) @with))
(with_statement "async" "with" @_with_keyword (with_clause . (with_item) @with))
{
attr (@with.node) is_async = #true
}
@@ -2800,7 +2790,7 @@
(identifier) @obj
.
(identifier) @attr
) @match_value_pattern
) @_match_value_pattern
{
let attribute = (ast-node @attr "Attribute")
attr (@attr.node) _skip_to = attribute
@@ -2814,7 +2804,7 @@
(match_value_pattern
.
(identifier) @id
) @match_value_pattern
) @_match_value_pattern
{
attr (@id.node) ctx = "load"
}
@@ -3267,8 +3257,8 @@
(decorated_definition
(decorator (expression) @exp1) @dec1
. (comment)* .
(decorator (expression) @exp2) @dec2
) @decorator
(decorator (expression) @_exp2) @dec2
) @_decorator
{
attr (@dec1.node) func = @exp1.node
edge @dec1.node -> @dec2.node
@@ -3279,7 +3269,7 @@
(decorator (expression) @exp) @last
. (comment)* .
definition: (function_definition) @funcdef
) @decorator
) @_decorator
{
attr (@last.node) func = @exp.node
edge @last.node -> @funcdef.funcexpr
@@ -3291,7 +3281,7 @@
(decorator (expression) @exp) @last
. (comment)* .
definition: (class_definition) @class
) @decorator
) @_decorator
{
attr (@last.node) func = @exp.node
edge @last.node -> @class.class_expr