[pypy-svn] r65626 - in pypy/branch/parser-compiler/pypy/interpreter/pyparser: . test

benjamin at codespeak.net benjamin at codespeak.net
Sat Jun 6 19:24:55 CEST 2009


Author: benjamin
Date: Sat Jun  6 19:24:53 2009
New Revision: 65626

Modified:
   pypy/branch/parser-compiler/pypy/interpreter/pyparser/metaparser.py
   pypy/branch/parser-compiler/pypy/interpreter/pyparser/test/test_metaparser.py
Log:
fix typo in dfa simplification

Modified: pypy/branch/parser-compiler/pypy/interpreter/pyparser/metaparser.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/pyparser/metaparser.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/pyparser/metaparser.py	Sat Jun  6 19:24:53 2009
@@ -28,6 +28,8 @@
         self.arcs.append((label, to_state))
 
     def find_unlabeled_states(self, into):
+        if self in into:
+            return
         into.add(self)
         for label, state in self.arcs:
             if label is None:
@@ -102,7 +104,7 @@
                 if state == other_state:
                     del dfa[j]
                     for sub_state in dfa:
-                        state.unify_state(state, other_state)
+                        sub_state.unify_state(other_state, state)
                     changes = True
                     break
 

Modified: pypy/branch/parser-compiler/pypy/interpreter/pyparser/test/test_metaparser.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/pyparser/test/test_metaparser.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/pyparser/test/test_metaparser.py	Sat Jun  6 19:24:53 2009
@@ -104,6 +104,7 @@
         assert g1.dfas != g2.dfas
 
         g = self.gram_for("foo: (NAME | STRING)*")
+        g = self.gram_for("foo: (NAME | STRING)+")
 
     def test_error(self):
         exc = py.test.raises(PgenError, self.gram_for, "hi").value



More information about the Pypy-commit mailing list