[pypy-svn] r13105 - pypy/branch/pycompiler/module/recparser

adim at codespeak.net adim at codespeak.net
Mon Jun 6 15:35:58 CEST 2005


Author: adim
Date: Mon Jun  6 15:35:55 2005
New Revision: 13105

Modified:
   pypy/branch/pycompiler/module/recparser/grammar.py
   pypy/branch/pycompiler/module/recparser/syntaxtree.py
Log:
removed other pointless *varargs constructions


Modified: pypy/branch/pycompiler/module/recparser/grammar.py
==============================================================================
--- pypy/branch/pycompiler/module/recparser/grammar.py	(original)
+++ pypy/branch/pycompiler/module/recparser/grammar.py	Mon Jun  6 15:35:55 2005
@@ -94,7 +94,7 @@
         # Do nothing, keep rule on top of the stack
         if rule.is_root():
             elems = self.stack[-1].expand()
-            self.stack[-1] = SyntaxNode(rule.name, source, *elems)
+            self.stack[-1] = SyntaxNode(rule.name, source, elems)
             if self.debug:
                 self.stack[-1].dumpstr()
         return True
@@ -110,11 +110,11 @@
             node_type = TempSyntaxNode
         # replace N elements with 1 element regrouping them
         if elts_number >= 1:
-            elem = node_type(rule.name, source, *items)
+            elem = node_type(rule.name, source, items)
             del self.stack[-elts_number:]
             self.stack.append(elem)
         elif elts_number == 0:
-            self.stack.append(node_type(rule.name, source))
+            self.stack.append(node_type(rule.name, source, []))
         if self.debug:
             self.stack[-1].dumpstr()
         return True

Modified: pypy/branch/pycompiler/module/recparser/syntaxtree.py
==============================================================================
--- pypy/branch/pycompiler/module/recparser/syntaxtree.py	(original)
+++ pypy/branch/pycompiler/module/recparser/syntaxtree.py	Mon Jun  6 15:35:55 2005
@@ -71,9 +71,9 @@
 
 class SyntaxNode(object):
     """A syntax node"""
-    def __init__(self, name, source, *args):
+    def __init__(self, name, source, args):
         self.name = name
-        self.nodes = list(args)
+        self.nodes = args
         self.lineno = source.current_line()
         
     def dumptree(self, treenodes, indent):
@@ -128,7 +128,7 @@
 class TokenNode(SyntaxNode):
     """A token node"""
     def __init__(self, name, source, value):
-        SyntaxNode.__init__(self, name, source)
+        SyntaxNode.__init__(self, name, source, [])
         self.value = value
 
     def dumptree(self, treenodes, indent):



More information about the Pypy-commit mailing list