[pypy-svn] r14878 - in pypy/dist/pypy/interpreter/pyparser: . test
adim at codespeak.net
adim at codespeak.net
Thu Jul 21 18:06:06 CEST 2005
Author: adim
Date: Thu Jul 21 18:05:03 2005
New Revision: 14878
Modified:
pypy/dist/pypy/interpreter/pyparser/astbuilder.py
pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
Log:
recognize expression like "x = 'a' 'b' 'c'"
Modified: pypy/dist/pypy/interpreter/pyparser/astbuilder.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/astbuilder.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/astbuilder.py Thu Jul 21 18:05:03 2005
@@ -67,7 +67,7 @@
L = get_atoms( builder, nb )
top = L[0]
if isinstance(top, TokenObject):
- print "\t reducing atom (%s) (top.name) = %s" % (nb, tok.name)
+ print "\t reducing atom (%s) (top.name) = %s" % (nb, top.name)
if top.name == tok.LPAR:
builder.push( L[1] )
elif top.name == tok.LSQB:
@@ -80,8 +80,11 @@
builder.push( ast.Const(eval(top.value)) )
elif top.name == tok.STRING:
# need to concatenate strings in L
- # builder.push( ast.Const(eval(top.value)) )
- assert False, "TODO (String)"
+ s = ''
+ for token in L:
+ s += eval(token.value)
+ builder.push( ast.Const(s) )
+ # assert False, "TODO (String)"
else:
raise ValueError, "unexpected tokens (%d): %s" % (nb,[ str(i) for i in L] )
Modified: pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py (original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_astbuilder.py Thu Jul 21 18:05:03 2005
@@ -25,8 +25,8 @@
"x, y, z = 1, 2, 3",
"x = 'a' 'b' 'c'",
]
-expression_tests = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] # = range(len(expressions))
-failed_expression_tests = [ 13, 14, 15 ]
+expression_tests = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15] # = range(len(expressions))
+failed_expression_tests = [ 13, 14]
comparisons = [
"a < b",
More information about the Pypy-commit
mailing list