summaryrefslogtreecommitdiff
path: root/Grammar/python.gram
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2020-06-09 16:32:08 -0700
committerGuido van Rossum <guido@python.org>2020-06-09 16:32:08 -0700
commit64264b65594282a28d12d307ef74823864077aad (patch)
treea63d92bd88d777f9830e14c1bdfee5a205066f6e /Grammar/python.gram
parent5ed19fcc1ae5ea296eb1e398137a9fa51d6a9f54 (diff)
downloadcpython-git-print-statement.tar.gz
Allow any primary as long as it ends in .NAMEprint-statement
Diffstat (limited to 'Grammar/python.gram')
-rw-r--r--Grammar/python.gram7
1 files changed, 7 insertions, 0 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 87725b556a..7c2a8532aa 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -91,6 +91,13 @@ call_stmt[stmt_ty]:
EXTRA), EXTRA) }
simple_primary[expr_ty]:
| a=simple_primary '.' b=NAME { _Py_Attribute(a, b->v.Name.id, Load, EXTRA) }
+ | a=simple_primary b=genexp &('.'|'('|'[') { _Py_Call(a, CHECK(_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
+ | a=simple_primary '(' b=[arguments] ')' &('.'|'('|'[') {
+ _Py_Call(a,
+ (b) ? ((expr_ty) b)->v.Call.args : NULL,
+ (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
+ EXTRA) }
+ | a=simple_primary '[' b=slices ']' &('.'|'('|'[') { _Py_Subscript(a, b, Load, EXTRA) }
| NAME
# NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield'