mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Co-authored-by: Dave Peck <davepeck@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
0d87bb66d3
commit
af8d1f56f5
13 changed files with 2098 additions and 2134 deletions
|
|
@ -985,7 +985,10 @@ tstring[expr_ty] (memo):
|
|||
_PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }
|
||||
|
||||
string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }
|
||||
strings[expr_ty] (memo): a[asdl_expr_seq*]=(fstring|string|tstring)+ { _PyPegen_concatenate_strings(p, a, EXTRA) }
|
||||
strings[expr_ty] (memo):
|
||||
| invalid_string_tstring_concat
|
||||
| a[asdl_expr_seq*]=(fstring|string)+ { _PyPegen_concatenate_strings(p, a, EXTRA) }
|
||||
| a[asdl_expr_seq*]=tstring+ { _PyPegen_concatenate_tstrings(p, a, EXTRA) }
|
||||
|
||||
list[expr_ty]:
|
||||
| '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }
|
||||
|
|
@ -1546,6 +1549,12 @@ invalid_tstring_conversion_character:
|
|||
| '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: missing conversion character") }
|
||||
| '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("t-string: invalid conversion character") }
|
||||
|
||||
invalid_string_tstring_concat:
|
||||
| a=(fstring|string)+ b[expr_ty]=tstring {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, "cannot mix t-string literals with string or bytes literals") }
|
||||
| a=tstring+ b[expr_ty]=(fstring|string) {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, "cannot mix t-string literals with string or bytes literals") }
|
||||
|
||||
invalid_arithmetic:
|
||||
| sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "'not' after an operator must be parenthesized") }
|
||||
invalid_factor:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue