Revision: 17498
Author:   [email protected]
Date:     Tue Nov  5 15:42:39 2013 UTC
Log:      Experimental rule generator: fix previous commit.

BUG=
[email protected]

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

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

=======================================
--- /branches/experimental/parser/tools/lexer_generator/regex_lexer.py Tue Nov 5 15:16:01 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/regex_lexer.py Tue Nov 5 15:42:39 2013 UTC
@@ -58,10 +58,11 @@

   states = (
     ('class','exclusive'),
+    ('repeat','exclusive'),
   )

   def t_ESCAPED_LITERAL(self, t):
-    r'\\\(|\\\)|\\\[|\\\]|\\\||\\\+|\\\*|\\\?|\\\.|\\\\'
+    r'\\\(|\\\)|\\\[|\\\]|\\\||\\\+|\\\*|\\\?|\\\.|\\\\|\\\{|\\\}'
     t.type = 'LITERAL'
     t.value = t.value[1:]
     return t
@@ -69,17 +70,11 @@
   t_GROUP_BEGIN = r'\('
   t_GROUP_END = r'\)'

-  t_REPEAT_BEGIN = r'\{'
-  t_REPEAT_END = r'\}'
-
   t_OR = r'\|'
   t_ONE_OR_MORE = r'\+'
   t_ZERO_OR_MORE = r'\*'
   t_ZERO_OR_ONE = r'\?'

-  t_NUMBER = r'[0-9]+'
-  t_COMMA = r','
-
   t_ANY = r'\.'

   t_LITERAL = r'.'
@@ -106,6 +101,19 @@

   t_class_CLASS_LITERAL = r'[\w $_+]' # fix this

+  def t_REPEAT_BEGIN(self, t):
+    r'\{'
+    self.lexer.push_state('repeat')
+    return t
+
+  def t_repeat_REPEAT_END(self, t):
+    r'\}'
+    self.lexer.pop_state()
+    return t
+
+  t_repeat_NUMBER = r'[0-9]+'
+  t_repeat_COMMA = r','
+
   t_ANY_ignore  = '\n'

   def t_ANY_error(self, t):

--
--
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