aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-05-24 15:47:06 +0000
committerGuido van Rossum <guido@python.org>2002-05-24 15:47:06 +0000
commit2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4 (patch)
treedf063351c064542b1694701577ad4e14dd5e00a5 /Grammar
parentAdd missing \ to macro definition only used when universal newlines (diff)
downloadcpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.gz
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.bz2
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.zip
Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks, but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar to avoid the ambiguity. Fred: you may want to update the refman.
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar4
1 files changed, 3 insertions, 1 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 27cf1cbbb8a..3f2b4ef1c60 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -80,7 +80,7 @@ arith_expr: term (('+'|'-') term)*
term: factor (('*'|'/'|'%'|'//') factor)*
factor: ('+'|'-'|'~') factor | power
power: atom trailer* ['**' factor]
-atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
+atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+
listmaker: test ( list_for | (',' test)* [','] )
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
@@ -100,3 +100,5 @@ argument: [test '='] test # Really [keyword '='] test
list_iter: list_for | list_if
list_for: 'for' exprlist 'in' testlist_safe [list_iter]
list_if: 'if' test [list_iter]
+
+testlist1: test (',' test)*