[pypy-svn] r34102 - pypy/dist/pypy/lang/automata

rxe at codespeak.net rxe at codespeak.net
Fri Nov 3 14:40:03 CET 2006


Author: rxe
Date: Fri Nov  3 14:40:02 2006
New Revision: 34102

Modified:
   pypy/dist/pypy/lang/automata/dfa.py
Log:
new goal for jit - (arigo, arre, rxe)

Modified: pypy/dist/pypy/lang/automata/dfa.py
==============================================================================
--- pypy/dist/pypy/lang/automata/dfa.py	(original)
+++ pypy/dist/pypy/lang/automata/dfa.py	Fri Nov  3 14:40:02 2006
@@ -98,3 +98,23 @@
         indx += 1
     res = hint(res, variable=True)
     return res
+
+def recognizeparts(trans, finals, s):
+    " a less simple recognizer "
+    trans = hint(trans, deepfreeze=True)
+    finals = hint(finals, deepfreeze=True)
+    
+    state = 0
+    try:
+        hint(None, global_mp_to_follow=True)
+        for char in s:
+            char = hint(char, promote=True)
+            state = trans[state, char]
+            hint(state, concrete=True)
+
+    except KeyError:
+        return False
+
+    res = state in finals
+    res = hint(res, variable=True)
+    return res



More information about the Pypy-commit mailing list