[pypy-svn] r13352 - pypy/branch/pycompiler/module/parser

adim at codespeak.net adim at codespeak.net
Mon Jun 13 16:46:08 CEST 2005


Author: adim
Date: Mon Jun 13 16:46:05 2005
New Revision: 13352

Modified:
   pypy/branch/pycompiler/module/parser/automata.py
Log:
Made small changes to make each function translatable.
(This breaks for now the parser module)


Modified: pypy/branch/pycompiler/module/parser/automata.py
==============================================================================
--- pypy/branch/pycompiler/module/parser/automata.py	(original)
+++ pypy/branch/pycompiler/module/parser/automata.py	Mon Jun 13 16:46:05 2005
@@ -26,7 +26,7 @@
 
 # ______________________________________________________________________
 
-def chain (states, *stateIndexPairs):
+def chain (states, stateIndexPairs):
     if len(stateIndexPairs) > 1:
         start, lastFinish = stateIndexPairs[0]
         for nStart, nFinish in stateIndexPairs[1:]:
@@ -38,8 +38,8 @@
 
 # ______________________________________________________________________
 
-def chainStr (states, str):
-    return chain(states, *map(lambda x : newArcPair(states, x), str))
+def chainStr(states, str):
+    return chain(states, [newArcPair(states, x) for x in str])
 
 # ______________________________________________________________________
 
@@ -62,7 +62,7 @@
 
 # ______________________________________________________________________
 
-def group (states, *stateIndexPairs):
+def group(states, stateIndexPairs):
     if len(stateIndexPairs) > 1:
         start = len(states)
         finish = start + 1
@@ -78,38 +78,38 @@
 
 # ______________________________________________________________________
 
-def groupStr (states, str):
-    return group(states, *map(lambda x : newArcPair(states, x), str))
+def groupStr(states, str):
+    return group(states, [newArcPair(states, x) for x in str])
 
 # ______________________________________________________________________
 
-def any (states, *stateIndexPairs):
-    start, finish = group(states, *stateIndexPairs)
+def any (states, stateIndexPairs):
+    start, finish = group(states, stateIndexPairs)
     states[finish].append((EMPTY, start))
     return start, start
 
 # ______________________________________________________________________
 
-def maybe (states, *stateIndexPairs):
-    start, finish = group(states, *stateIndexPairs)
+def maybe (states, stateIndexPairs):
+    start, finish = group(states, stateIndexPairs)
     states[start].append((EMPTY, finish))
     return start, finish
 
 # ______________________________________________________________________
 
-def atleastonce (states, *stateIndexPairs):
-    start, finish = group(states, *stateIndexPairs)
+def atleastonce (states, stateIndexPairs):
+    start, finish = group(states, stateIndexPairs)
     states[finish].append((EMPTY, start))
     return start, finish
 
 # ______________________________________________________________________
 
-def notGroup (states, *stateIndexPairs):
+def notGroup (states, stateIndexPairs):
     """Like group, but will add a DEFAULT transition to a new end state,
     causing anything in the group to not match by going to a dead state.
     XXX I think this is right...
     """
-    start, dead = group(states, *stateIndexPairs)
+    start, dead = group(states, stateIndexPairs)
     finish = len(states)
     states.append([])
     states[start].append((DEFAULT, finish))
@@ -118,7 +118,7 @@
 # ______________________________________________________________________
 
 def notGroupStr (states, str):
-    return notGroup(states, *map(lambda x : newArcPair(states, x), str))
+    return notGroup(states, [newArcPair(states, x) for x in str])
 
 # ______________________________________________________________________
 



More information about the Pypy-commit mailing list