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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 73023005: Experimental lexer generator: random refactoring + comments. (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/dfa.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 39129989cac49c26dbdba1f708799b1df0ed40ed..16dce4d79ddcf6bbbff5881436bce929d145a7c0 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -148,6 +148,8 @@ class CodeGenerator:
@staticmethod
def __split_transitions(split_count, state):
+ '''Goes through the transitions for 'state' and decides which of them should
+ use the if statement and which should use the switch statement.'''
assert not state['switch_transitions']
(class_keys, distinct_keys, ranges) = (0, 0, 0)
for (t, r) in state['disjoint_keys']:
@@ -198,14 +200,14 @@ class CodeGenerator:
if self.__inline:
inlined = reduce(CodeGenerator.__set_inline, dfa_states, 0)
if self.__log:
- print "inlined %s" % inlined
+ print "%s states inlined" % inlined
elif self.__log:
print "no inlining"
# split transitions
if self.__switching:
switched = reduce(CodeGenerator.__split_transitions, dfa_states, 0)
if self.__log:
- print "switched states %s" % inlined
+ print "%s states use switch (instead of if)" % switched
elif self.__log:
print "no switching"
# store states
« no previous file with comments | « no previous file | tools/lexer_generator/dfa.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698