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

Unified Diff: tools/lexer_generator/automaton.py

Issue 77863004: Experimental parser: small cleanups (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/automata_test.py ('k') | tools/lexer_generator/dfa.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/automaton.py
diff --git a/tools/lexer_generator/automaton.py b/tools/lexer_generator/automaton.py
index e37df525487a49259b9ad5c17b29f50f8d99f6b2..dff7f0c75bfd65ab73b287f573ef0fa4c5792847 100644
--- a/tools/lexer_generator/automaton.py
+++ b/tools/lexer_generator/automaton.py
@@ -154,11 +154,10 @@ class Automaton(object):
def visit_all_states(self, visitor, visit_state = None, state_iter = None):
return self.visit_states(self.start_set(), visitor, visit_state, state_iter)
- # TODO use iters
@staticmethod
def epsilon_closure(states):
- f = lambda acc, node: acc | node.epsilon_closure()
- return reduce(f, states, set(iter(states)))
+ f = lambda state : state.epsilon_closure_iter()
+ return set(chain(iter(states), *map(f, states)))
@staticmethod
def __transition_states_for_char(valid_states, c):
« no previous file with comments | « tools/lexer_generator/automata_test.py ('k') | tools/lexer_generator/dfa.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698