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

Unified Diff: tools/lexer_generator/code_generator.py

Issue 180213003: Experimental parser: cleanup logging (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 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/gyp/v8.gyp ('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 ba3855736b1c43987b1d2d1f4cc560f09e474456..3bed432cd5ca1738cb3e0ed7bf504badf2a253bb 100644
--- a/tools/lexer_generator/code_generator.py
+++ b/tools/lexer_generator/code_generator.py
@@ -27,6 +27,7 @@
import os
import sys
+import logging
import jinja2
from copy import deepcopy
from dfa import Dfa
@@ -40,8 +41,7 @@ class CodeGenerator:
minimize_default = True,
inline = True,
switching = True,
- debug_print = False,
- log = False):
+ debug_print = False):
if minimize_default:
dfa = rule_processor.default_automata().minimal_dfa()
else:
@@ -49,7 +49,6 @@ class CodeGenerator:
self.__dfa = dfa
self.__default_action = rule_processor.default_action()
self.__debug_print = debug_print
- self.__log = log
self.__inline = inline
self.__switching = switching
self.__jump_table = []
@@ -380,20 +379,17 @@ class CodeGenerator:
dfa_states = self.__dfa_states
# split transitions
switched = reduce(self.__split_transitions, dfa_states, 0)
- if self.__log:
- print "%s states use switch (instead of if)" % switched
+ logging.info("%s states use switch (instead of if)" % switched)
# rewrite deferred transitions
for state in dfa_states:
self.__rewrite_deferred_transitions(state)
# set nodes to inline
if self.__inline:
inlined = reduce(self.__set_inline, dfa_states, 0)
- if self.__log:
- print "%s states inlined" % inlined
+ logging.info("%s states inlined" % inlined)
# rewrite transitions to use jumps
inlined_nodes = self.__rewrite_transitions_to_jumps(0, len(dfa_states), {})
- if self.__log:
- print "%s inlined nodes created" % inlined_nodes
+ logging.info("%s inlined nodes created" % inlined_nodes)
# mark the entry point in case there are implicit jumps to it
self.__dfa_states[0]['entry_points']['state_entry'] = True
« no previous file with comments | « tools/gyp/v8.gyp ('k') | tools/lexer_generator/dfa_optimizer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698