From 811f0e73150eddf621930c58d8150815792aa382 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Fri, 26 Apr 2024 17:17:22 +0300 Subject: [PATCH 1/2] gh-118323: Document `&&` grammar syntax --- Grammar/python.gram | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Grammar/python.gram b/Grammar/python.gram index 3943d7fec5db03..2d1158e265356e 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -78,6 +78,8 @@ _PyPegen_parse(Parser *p) # Fail if e can be parsed, without consuming any input. # ~ # Commit to the current alternative, even if it fails to parse. +# &&e +# Eager parse e. Fail with SyntaxError if e cannot be parsed. # # STARTING RULES From f497b4f8bbf3a1f96799416fc6820d789664c363 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sat, 27 Apr 2024 10:04:44 +0300 Subject: [PATCH 2/2] Address review --- Grammar/python.gram | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 2d1158e265356e..05d7837e3aa6db 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -79,7 +79,8 @@ _PyPegen_parse(Parser *p) # ~ # Commit to the current alternative, even if it fails to parse. # &&e -# Eager parse e. Fail with SyntaxError if e cannot be parsed. +# Eager parse e. The parser will not backtrack and will immediately +# fail with SyntaxError if e cannot be parsed. # # STARTING RULES