summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-05-24 15:47:06 (GMT)
committerGuido van Rossum <guido@python.org>2002-05-24 15:47:06 (GMT)
commit2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4 (patch)
treedf063351c064542b1694701577ad4e14dd5e00a5 /Grammar
parenta0a6c5a042818461fa199c8a3daefb7fd00ffe1b (diff)
downloadcpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.zip
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.gz
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.bz2
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 27cf1cb..3f2b4ef 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)*