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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 61023006: Experimental lexer generator: build 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 | « no previous file | tools/lexer_generator/rule_parser.py » ('j') | 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 598c562701cf7ce8b3bfcec37175b1135b6f7c8e..8fa43ac872012ac4ecf75bad868ad05c196ebd0e 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -121,16 +121,25 @@ uint32_t EvenMoreExperimentalScanner::DoLex() {
code += CodeGenerator.dfa_state_to_code(state, start_node_number)
return code
code = dfa.visit_all_states(f, code)
- code += '''
- CHECK(false);
+
+ default_action_code = ''
+ if rule_processor.default_action:
+ if rule_processor.default_action.type() == 'push_token':
+ default_action_code = '''
default_action:
//fprintf(stderr, "default action\\n");
- %s
- goto code_%s;
+ PUSH_TOKEN(Token::%s)
+ goto code_%s;''' % (rule_processor.default_action.data(), start_node_number)
+ else:
+ raise Exception("Default action type %s not supported" % action.type())
+
+ code += '''
+ CHECK(false);
+%s
return 0;
}
}
}
-''' % (rule_processor.default_action, start_node_number)
+''' % default_action_code
return code
« no previous file with comments | « no previous file | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698