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

Unified Diff: tools/lexer_generator/dfa_optimizer.py

Issue 152823002: Experimental parser: use sentinal values for actions (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/dfa.py ('k') | tools/lexer_generator/lexer_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/dfa_optimizer.py
diff --git a/tools/lexer_generator/dfa_optimizer.py b/tools/lexer_generator/dfa_optimizer.py
index 99922120d5d56e80347276a41aeda853f79d6189..115ed1c56fb772e50dde5a85e7387bb43e2ed8aa 100644
--- a/tools/lexer_generator/dfa_optimizer.py
+++ b/tools/lexer_generator/dfa_optimizer.py
@@ -172,13 +172,8 @@ class DfaOptimizer(object):
dfa.visit_all_states(build_incoming_transitions)
def is_replacement_candidate(state):
- action = state.action()
- if not action or not action.match_action():
- return False
- if (action.match_action().name() == 'token' or
- action.match_action().name() == 'harmony_token'):
- return True
- return False
+ return (state.action().match_action().name() == 'token' or
+ state.action().match_action().name() == 'harmony_token')
replacements = {}
for state, incoming in incoming_transitions.items():
@@ -241,7 +236,8 @@ class DfaOptimizer(object):
counters['store_harmony_token_and_goto'] += 1
else:
raise Exception(old_action.match_action())
- return Action(old_action.entry_action(), match_action,
+ return Action(old_action.entry_action(),
+ match_action,
old_action.precedence())
# map the old state to the new state, with fewer transitions and
# goto actions
« no previous file with comments | « tools/lexer_generator/dfa.py ('k') | tools/lexer_generator/lexer_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698