tree-sitter-python
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -274,2 +274,30 @@ ===================================== | ||
===================================== | ||
Binary Addition / Subtraction With Floats | ||
===================================== | ||
.1-.0 | ||
.1+.0 | ||
.1-0 | ||
.1+0 | ||
1-.0 | ||
1+.0 | ||
--- | ||
(module | ||
(expression_statement | ||
(binary_operator (float) (float))) | ||
(expression_statement | ||
(binary_operator (float) (float))) | ||
(expression_statement | ||
(binary_operator (float) (integer))) | ||
(expression_statement | ||
(binary_operator (float) (integer))) | ||
(expression_statement | ||
(binary_operator (integer) (float))) | ||
(expression_statement | ||
(binary_operator (integer) (float)))) | ||
===================================== | ||
Bitwise operators | ||
@@ -378,2 +406,16 @@ ===================================== | ||
==================================================== | ||
Assignments with type annotations | ||
==================================================== | ||
tail_leaves: List[Leaf] = [] | ||
--- | ||
(module | ||
(expression_statement (assignment | ||
(expression_list (identifier)) | ||
(type (subscript (identifier) (identifier))) | ||
(expression_list (list))))) | ||
==================================================== | ||
Augmented assignments | ||
@@ -492,1 +534,20 @@ ==================================================== | ||
(identifier) (identifier)))) | ||
======================================== | ||
Async context managers and iterators | ||
======================================== | ||
async with a as b: | ||
async for c in d: | ||
[e async for f in g] | ||
--- | ||
(module | ||
(with_statement | ||
(with_item (identifier) (identifier)) | ||
(for_statement | ||
(variables (identifier)) | ||
(expression_list (identifier)) | ||
(expression_statement | ||
(list_comprehension (identifier) (for_in_clause (variables (identifier)) (identifier))))))) |
@@ -7,2 +7,3 @@ ===================================== | ||
import b.c as d | ||
import a.b.c | ||
@@ -18,3 +19,5 @@ --- | ||
(dotted_name (identifier) (identifier)) | ||
(identifier)))) | ||
(identifier))) | ||
(import_statement | ||
(dotted_name (identifier) (identifier) (identifier)))) | ||
@@ -28,2 +31,7 @@ ===================================== | ||
from a import (b, c) | ||
from a.b import c | ||
from . import b | ||
from .. import b | ||
from .a import b | ||
from ..a import b | ||
@@ -42,3 +50,22 @@ --- | ||
(dotted_name (identifier)) | ||
(dotted_name (identifier)))) | ||
(dotted_name (identifier))) | ||
(import_from_statement | ||
(dotted_name (identifier) (identifier)) | ||
(dotted_name (identifier))) | ||
(import_from_statement | ||
(relative_import (import_prefix)) | ||
(dotted_name (identifier))) | ||
(import_from_statement | ||
(relative_import (import_prefix)) | ||
(dotted_name (identifier))) | ||
(import_from_statement | ||
(relative_import | ||
(import_prefix) | ||
(dotted_name (identifier))) | ||
(dotted_name (identifier))) | ||
(import_from_statement | ||
(relative_import | ||
(import_prefix) | ||
(dotted_name (identifier))) | ||
(dotted_name (identifier)))) | ||
@@ -382,22 +409,22 @@ ===================================== | ||
(module | ||
(async_function_definition (identifier) | ||
(function_definition (identifier) | ||
(parameters) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
(parameters (identifier)) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
(parameters (identifier) (identifier)) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
(parameters (typed_parameter (identifier) (type (identifier)))) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
(parameters (typed_parameter (identifier) (type (attribute (identifier) (identifier))))) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
@@ -407,3 +434,3 @@ (parameters (typed_parameter (identifier) (type (subscript (identifier) (identifier))))) | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
@@ -416,3 +443,3 @@ (parameters | ||
(expression_statement (identifier))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
@@ -422,3 +449,3 @@ (parameters (typed_parameter (identifier) (type (identifier)))) | ||
(return_statement (expression_list (none)))) | ||
(async_function_definition | ||
(function_definition | ||
(identifier) | ||
@@ -675,3 +702,3 @@ (parameters | ||
(argument_list)) | ||
(async_function_definition (identifier) (parameters) (expression_statement (identifier))))))) | ||
(function_definition (identifier) (parameters) (expression_statement (identifier))))))) | ||
@@ -678,0 +705,0 @@ ==================================================== |
@@ -83,10 +83,14 @@ const PREC = { | ||
import_prefix: $ => repeat1('.'), | ||
relative_import: $ => seq( | ||
$.import_prefix, | ||
optional($.dotted_name) | ||
), | ||
import_from_statement: $ => seq( | ||
'from', | ||
choice( | ||
seq( | ||
repeat('.'), | ||
$.dotted_name | ||
), | ||
repeat1('.') | ||
$.relative_import, | ||
$.dotted_name | ||
), | ||
@@ -178,3 +182,2 @@ 'import', | ||
$.with_statement, | ||
$.async_function_definition, | ||
$.function_definition, | ||
@@ -208,2 +211,3 @@ $.class_definition, | ||
for_statement: $ => seq( | ||
optional('async'), | ||
'for', | ||
@@ -260,2 +264,3 @@ $.variables, | ||
with_statement: $ => seq( | ||
optional('async'), | ||
'with', | ||
@@ -275,10 +280,4 @@ commaSep1($.with_item), | ||
async_function_definition: $ => seq( | ||
'async', | ||
$._function_definition | ||
), | ||
function_definition: $ => $._function_definition, | ||
_function_definition: $ => seq( | ||
function_definition: $ => seq( | ||
optional('async'), | ||
'def', | ||
@@ -391,4 +390,3 @@ $.identifier, | ||
$.class_definition, | ||
$.function_definition, | ||
$.async_function_definition | ||
$.function_definition | ||
) | ||
@@ -532,2 +530,3 @@ ), | ||
$.expression_list, | ||
optional(seq(':', $.type)), | ||
'=', | ||
@@ -689,2 +688,3 @@ $._right_hand_side | ||
for_in_clause: $ => seq( | ||
optional('async'), | ||
'for', | ||
@@ -770,4 +770,4 @@ $.variables, | ||
choice( | ||
seq(repeat(/[0-9]+_?/), '.', repeat(/[0-9]+_?/), optional(/[eE]/), optional(/[\+-]/), repeat(/[0-9]+_?/)), | ||
seq(repeat(/[0-9]+_?/), /[eE]/, optional(/[\+-]/), repeat1(/[0-9]+_?/)) | ||
seq(repeat(/[0-9]+_?/), '.', repeat(/[0-9]+_?/), optional(/[eE][\+-]?/), repeat(/[0-9]+_?/)), | ||
seq(repeat(/[0-9]+_?/), optional(/[eE][\+-]?/), repeat1(/[0-9]+_?/)) | ||
), | ||
@@ -774,0 +774,0 @@ optional( |
{ | ||
"name": "tree-sitter-python", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Python grammar for tree-sitter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2685791
4727