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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 63363004: Experimental lexer generator: comment fixes. (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 | « src/lexer/lexer_py.re ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/code_generator.py
diff --git a/tools/lexer_generator/code_generator.py b/tools/lexer_generator/code_generator.py
index c8298cd82f44ad45bd52419285622ae461f76590..7c14c99e710c5df9f9cfd1154d02ceb19a27cbe3 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -64,7 +64,7 @@ class CodeGenerator:
@staticmethod
def __skip_code(value):
assert value == None
- return 'SKIP(); goto code_start;'
+ return 'SKIP();'
@staticmethod
def __push_line_terminator_code(value):
@@ -81,6 +81,10 @@ class CodeGenerator:
assert value != None
return '%s\n' % value
+ @staticmethod
+ def __skip_and_terminate_code(value):
+ return 'SKIP(); --start_; ' + CodeGenerator.__terminate_code(value)
+
def __init__(self, dfa, default_action):
self.__dfa = dfa
self.__start_node_number = dfa.start_state().node_number()
@@ -93,6 +97,7 @@ class CodeGenerator:
"push_line_terminator" : self.__push_line_terminator_code,
"skip" : self.__skip_code,
"code" : self.__code_code,
+ "skip_and_terminate" : self.__skip_and_terminate_code,
}
def __dfa_state_to_code(self, state):
@@ -156,7 +161,7 @@ uint32_t EvenMoreExperimentalScanner::DoLex() {
action = default_action.match_action()
default_action_code = self.__action_code_map[action[0]](action[1])
code += '''
- CHECK(false);
+ CHECK(false); goto code_start;
default_action:
//fprintf(stderr, "default action\\n");
%s
« no previous file with comments | « src/lexer/lexer_py.re ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698