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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 152513004: Experimental parser: some tuple removal (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 months 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 907d7e6c22c6f94e7a5ce4b6b39d70aa07a2a859..6bc44eb8da20905171050a6d350727dd3ed122da 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -30,6 +30,7 @@ import sys
import jinja2
from copy import deepcopy
from dfa import Dfa
+from automaton import Term
from transition_keys import TransitionKey
class CodeGenerator:
@@ -297,9 +298,9 @@ class CodeGenerator:
states = self.__dfa_states
for state in states:
if (state['match_action'] and
- state['match_action'][0] == 'do_stored_token'):
- assert not state['match_action'][1] in goto_map
- goto_map[state['match_action'][1]] = state['node_number']
+ state['match_action'].name() == 'do_stored_token'):
+ assert not state['match_action'].args()[0] in goto_map
+ goto_map[state['match_action'].args()[0]] = state['node_number']
mapped_actions = set([
'store_harmony_token_and_goto',
'store_token_and_goto',
@@ -307,9 +308,9 @@ class CodeGenerator:
for state in states:
if not state['match_action']:
continue
- action = state['match_action'][0]
+ action = state['match_action'].name()
if action in mapped_actions:
- value = state['match_action'][1]
+ value = state['match_action'].args()
target_id = goto_map[value[-1]]
states[target_id]['must_not_inline'] = True
if action != 'goto_start':
@@ -319,7 +320,8 @@ class CodeGenerator:
states[target_id]['can_elide_read'] = False
label = 'state_entry'
jump_label = self.__register_jump(target_id, label)
- state['match_action'] = (action, tuple(list(value[:-1]) + [jump_label]))
+ new_args = list(value[:-1]) + [str(jump_label)]
+ state['match_action'] = Term(action, *new_args)
def __inlined_state(self, target_id):
state = deepcopy(self.__dfa_states[target_id])
« 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