[Python-checkins] r54446 - sandbox/trunk/2to3/fixes/macros.py
collin.winter
python-checkins at python.org
Mon Mar 19 22:43:55 CET 2007
Author: collin.winter
Date: Mon Mar 19 22:43:48 2007
New Revision: 54446
Modified:
sandbox/trunk/2to3/fixes/macros.py
Log:
Add Number and Subscript macros.
Modified: sandbox/trunk/2to3/fixes/macros.py
==============================================================================
--- sandbox/trunk/2to3/fixes/macros.py (original)
+++ sandbox/trunk/2to3/fixes/macros.py Mon Mar 19 22:43:48 2007
@@ -54,6 +54,15 @@
"""A newline literal"""
return Leaf(token.NEWLINE, "\n")
+def Number(n):
+ return Leaf(token.NUMBER, n)
+
+def Subscript(index_node):
+ """A numeric or string subscript"""
+ return Node(syms.trailer, [Leaf(token.LBRACE, '['),
+ index_node,
+ Leaf(token.RBRACE, ']')])
+
def is_tuple(node):
"""Does the node represent a tuple literal?"""
More information about the Python-checkins
mailing list