Revision: 17633
Author:   [email protected]
Date:     Tue Nov 12 09:23:37 2013 UTC
Log:      Experimental parser: more assertions

[email protected]

BUG=

Review URL: https://codereview.chromium.org/68173004
http://code.google.com/p/v8/source/detail?r=17633

Modified:
 /branches/experimental/parser/tools/lexer_generator/transition_keys.py

=======================================
--- /branches/experimental/parser/tools/lexer_generator/transition_keys.py Tue Nov 12 07:12:31 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/transition_keys.py Tue Nov 12 09:23:37 2013 UTC
@@ -166,13 +166,19 @@

   def matches_key(self, key):
     assert isinstance(key, self.__class__)
-    assert key != TransitionKey.epsilon()
+    assert key != TransitionKey.epsilon() and not key.__is_unique()
     assert len(key.__ranges) == 1
     subkey = key.__ranges[0]
+    matches = False
     for k in self.__ranges:
-      if k[0] <= subkey[0] and k[1] >= subkey[1]: return True
-    # TODO assert disjoint
-    return False
+      if k[0] <= subkey[0]:
+        assert subkey[1] <= k[1] or subkey[0] > k[1]
+      if subkey[0] < k[0]:
+        assert subkey[1] < k[0]
+      if k[0] <= subkey[0] and k[1] >= subkey[1]:
+        assert not matches
+        matches = True
+    return matches

   def __hash__(self):
     if self.__cached_hash == None:

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to