tree-sitter-python
Advanced tools
Comparing version 0.13.0 to 0.13.1
@@ -210,7 +210,11 @@ ===================================== | ||
(argument_list | ||
(string) | ||
(string | ||
(escape_sequence) | ||
(escape_sequence)) | ||
(dictionary (pair (string) (none))) | ||
(identifier)))) | ||
(expression_statement | ||
(call (identifier) (argument_list (string))))) | ||
(call | ||
(identifier) | ||
(argument_list (string))))) | ||
@@ -217,0 +221,0 @@ ===================================== |
@@ -93,4 +93,2 @@ ===================================== | ||
'"ok"' | ||
r'hi' | ||
ur"bye" | ||
UR'bye' | ||
@@ -114,9 +112,60 @@ b'sup' | ||
(expression_statement (string)) | ||
(expression_statement (string (escape_sequence))) | ||
(expression_statement (string)) | ||
(expression_statement (string (escape_sequence)))) | ||
===================================== | ||
Raw strings | ||
===================================== | ||
'ab\x00cd' | ||
"\n" | ||
# no escape sequences in these | ||
r'ab\x00cd' | ||
ur"\n" | ||
--- | ||
(module | ||
(expression_statement (string (escape_sequence))) | ||
(expression_statement (string (escape_sequence))) | ||
(comment) | ||
(expression_statement (string)) | ||
(expression_statement (string)) | ||
(expression_statement (string)) | ||
(expression_statement (string))) | ||
===================================== | ||
Format strings | ||
===================================== | ||
# nested! | ||
f"a {b(f'c {e} d')} e" | ||
--- | ||
(module | ||
(comment) | ||
(expression_statement (string | ||
(interpolation | ||
(call | ||
(identifier) | ||
(argument_list | ||
(string (interpolation | ||
(identifier))))))))) | ||
===================================== | ||
Unicode escape sequences | ||
===================================== | ||
"\x12 \o123 \u1234" | ||
--- | ||
(module | ||
(expression_statement (string | ||
(escape_sequence) | ||
(escape_sequence) | ||
(escape_sequence)))) | ||
===================================== | ||
Other primitives | ||
@@ -200,3 +249,9 @@ ===================================== | ||
(expression_statement (string)) | ||
(expression_statement (string))) | ||
(expression_statement (string | ||
(escape_sequence) | ||
(escape_sequence) | ||
(escape_sequence) | ||
(escape_sequence) | ||
(escape_sequence) | ||
(escape_sequence)))) | ||
@@ -203,0 +258,0 @@ ===================================== |
@@ -36,2 +36,5 @@ const PREC = { | ||
$._dedent, | ||
$._string_start, | ||
$._string_content, | ||
$._string_end, | ||
], | ||
@@ -172,5 +175,5 @@ | ||
pass_statement: $ => 'pass', | ||
break_statement: $ => 'break', | ||
continue_statement: $ => 'continue', | ||
pass_statement: $ => prec.left('pass'), | ||
break_statement: $ => prec.left('break'), | ||
continue_statement: $ => prec.left('continue'), | ||
@@ -714,29 +717,28 @@ // Compount statements | ||
string: $ => token(seq( | ||
repeat(choice(/[uU]/, /[rR]/, /[bB]/)), | ||
string: $ => seq( | ||
alias($._string_start, '"'), | ||
repeat(choice($.interpolation, $.escape_sequence, $._string_content)), | ||
alias($._string_end, '"') | ||
), | ||
interpolation: $ => seq( | ||
'{', | ||
$._expression, | ||
optional($.type_conversion), | ||
'}' | ||
), | ||
escape_sequence: $ => token(seq( | ||
'\\', | ||
choice( | ||
seq('`', repeat(choice(/[^\\`\n]/, /\\./, /\\\r?\n/)), '`'), | ||
seq('"', repeat(choice(/[^\\"\n]/, /\\./, /\\\r?\n/)), '"'), | ||
seq("'", repeat(choice(/[^\\'\n]/, /\\./, /\\\r?\n/)), "'"), | ||
seq( | ||
'"""', | ||
repeat(choice( | ||
/[^"]/, | ||
/"[^"]/, | ||
/""[^"]/ | ||
)), | ||
'"""' | ||
), | ||
seq( | ||
"'''", | ||
repeat(choice( | ||
/[^']/, | ||
/'[^']/, | ||
/''[^']/ | ||
)), | ||
"'''" | ||
) | ||
/u[a-fA-F\d]{4}/, | ||
/U[a-fA-F\d]{8}/, | ||
/x[a-fA-F\d]{2}/, | ||
/o\d{3}/, | ||
/[^uxo]/ | ||
) | ||
)), | ||
type_conversion: $ => /![a-z]/, | ||
integer: $ => token(choice( | ||
@@ -743,0 +745,0 @@ seq( |
{ | ||
"name": "tree-sitter-python", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"description": "Python grammar for tree-sitter", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tree-sitter-cli": "^0.13.1" | ||
"tree-sitter-cli": "^0.13.2" | ||
}, | ||
@@ -19,0 +19,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
2758739
4718