Revision: 17636
Author:   [email protected]
Date:     Tue Nov 12 11:34:13 2013 UTC
Log:      Experimental lexer generator: Code gen fix.

The generated code now does something reasonable for simple exaples.

BUG=
[email protected]

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

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

=======================================
--- /branches/experimental/parser/tools/lexer_generator/dfa.py Tue Nov 12 07:12:31 2013 UTC +++ /branches/experimental/parser/tools/lexer_generator/dfa.py Tue Nov 12 11:34:13 2013 UTC
@@ -53,7 +53,7 @@
   def transitions(self):
     return self.__transitions

-  def to_code(self):
+  def to_code(self, start_node_number):
     # FIXME: add different check types (if, switch, lookup table)
     # FIXME: add action + break / continue
     # FIXME: add default action
@@ -78,6 +78,7 @@
         code += 'return 1;'
       else:
         code += self.action()[1];
+        code += 'goto code_%s;' % start_node_number

     return code

@@ -165,5 +166,5 @@
 goto code_%s;
 ''' % (self.__start.node_number())
     for n in self.__name_map.values():
-      code += n.to_code()
+      code += n.to_code(self.__start.node_number())
     return code

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