[Python-checkins] python/dist/src/Parser Python.asdl, 1.1.2.7, 1.1.2.8 asdl_c.py, 1.1.2.3, 1.1.2.4

nnorwitz at users.sourceforge.net nnorwitz at users.sourceforge.net
Sun Jan 16 18:09:14 CET 2005


Update of /cvsroot/python/python/dist/src/Parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14168/Parser
Modified Files:
 Tag: ast-branch
	Python.asdl asdl_c.py 
Log Message:
Handle generator comps a little, lots more to do to get working
Index: Python.asdl
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/Attic/Python.asdl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- Python.asdl	28 Mar 2003 02:05:27 -0000	1.1.2.7
+++ Python.asdl	16 Jan 2005 17:09:11 -0000	1.1.2.8
@@ -52,7 +52,8 @@
 	 | UnaryOp(unaryop op, expr operand)
 	 | Lambda(arguments args, expr body)
 	 | Dict(expr* keys, expr *values)
-	 | ListComp(expr elt, listcomp* generators)
+	 | ListComp(expr elt, comprehension* generators)
+	 | GeneratorComp(expr elt, comprehension* generators)
 	 -- need sequences for compare to distinguish between
 	 -- x < 4 < 3 and (x < 4) < 3
 	 | Compare(expr left, cmpop* ops, expr* comparators)
@@ -85,7 +86,7 @@
 
 	cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn
 
-	listcomp = (expr target, expr iter, expr* ifs)
+	comprehension = (expr target, expr iter, expr* ifs)
 
 	-- not sure what to call the first argument for raise and except
 
Index: asdl_c.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/Attic/asdl_c.py,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- asdl_c.py	13 Apr 2004 14:54:43 -0000	1.1.2.3
+++ asdl_c.py	16 Jan 2005 17:09:11 -0000	1.1.2.4
@@ -44,7 +44,10 @@
 padding = ""
 while len(cur) > size:
 i = cur.rfind(' ', 0, size)
- assert i != -1, "Impossible line to reflow: %s" % `s`
+ # XXX this should be fixed for real
+ if i == -1 and 'GeneratorComp' in cur:
+ i = size + 3
+ assert i != -1, "Impossible line %d to reflow: %s" % (size, `s`)
 lines.append(padding + cur[:i])
 if len(lines) == 1:
 # find new size based on brace


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /