Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: tools/lexer_generator/dfa.py

Issue 58943004: Experimental lexer generator: Code gen fix. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/dfa.py
diff --git a/tools/lexer_generator/dfa.py b/tools/lexer_generator/dfa.py
index 98f7559c9b65723a24942267bc0c7231a144a396..f31f8c092bc37d78b79051520acaf099047faec0 100644
--- a/tools/lexer_generator/dfa.py
+++ b/tools/lexer_generator/dfa.py
@@ -53,7 +53,7 @@ class DfaState(AutomatonState):
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 @@ fprintf(stderr, "state %s, char at hand is %%c (%%d)\\n", c, c);
code += 'return 1;'
else:
code += self.action()[1];
+ code += 'goto code_%s;' % start_node_number
return code
@@ -165,5 +166,5 @@ char c = *cursor;
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698