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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 85853003: Experimental parser: simplify goto logic (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 | « tools/lexer_generator/code_generator.jinja ('k') | tools/lexer_generator/dfa_optimizer.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 03c830387d5603af8985a47f15844eb72777919e..75b7c1ec2559742cd60b6355086bed9fe293df80 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -299,9 +299,17 @@ class CodeGenerator:
assert not state['match_action'][1] in goto_map
goto_map[state['match_action'][1]] = state['node_number']
state['has_goto_after_entry'] = True
+ mapped_actions = set([
+ 'store_harmony_token_and_goto',
+ 'store_token_and_goto',
+ 'goto_start'])
for state in self.__dfa_states:
- if state['match_action'] and state['match_action'][0] == 'goto':
- state['match_action'] = ('goto', goto_map[state['match_action'][1]])
+ if not state['match_action']:
+ continue
+ if state['match_action'][0] in mapped_actions:
+ value = state['match_action'][1]
+ value = tuple(list(value[:-1]) + [goto_map[value[-1]]])
+ state['match_action'] = (state['match_action'][0], value)
def process(self):
« no previous file with comments | « tools/lexer_generator/code_generator.jinja ('k') | tools/lexer_generator/dfa_optimizer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698