5252from antlr3 import ANTLRStringStream as StringStream , CommonTokenStream as TokenStream
5353from antlr3 .tree import CommonTreeAdaptor , CommonTree
5454
55- from java2python .lib import colortools
55+ from java2python .lib import colors
5656
5757
5858class Tokens (object ):
@@ -125,15 +125,15 @@ class LocalTree(CommonTree):
125125
126126 """
127127 colorTypeMap = {
128- 'CLASS' : colortools .green ,
129- 'JAVA_SOURCE' : colortools .green ,
130- 'VOID_METHOD_DECL' : colortools .green ,
131- 'IDENT' : colortools .yellow ,
132- 'TYPE' : colortools .magenta ,
133- 'EXPR' : colortools .blue ,
134- 'TRUE' : colortools .yellow ,
135- 'FALSE' : colortools .yellow ,
136- 'NULL' : colortools .yellow ,
128+ 'CLASS' : colors .green ,
129+ 'JAVA_SOURCE' : colors .green ,
130+ 'VOID_METHOD_DECL' : colors .green ,
131+ 'IDENT' : colors .yellow ,
132+ 'TYPE' : colors .magenta ,
133+ 'EXPR' : colors .blue ,
134+ 'TRUE' : colors .yellow ,
135+ 'FALSE' : colors .yellow ,
136+ 'NULL' : colors .yellow ,
137137 }
138138
139139 def __init__ (self , payload , lexer = None , parser = None ):
@@ -146,18 +146,18 @@ def childrenOfType(self, type):
146146
147147 def colorType (self , tokenType ):
148148 """ Returns a color suitable for the given token type. """
149- return self .colorTypeMap .get (tokenType , colortools .white )(tokenType )
149+ return self .colorTypeMap .get (tokenType , colors .white )(tokenType )
150150
151151 def colorText (self , tokenType , tokenText ):
152152 """ Returns a colorized string from the given token type and text. """
153- return self .colorTypeMap .get (tokenType , colortools .white )(tokenText )
153+ return self .colorTypeMap .get (tokenType , colors .white )(tokenText )
154154
155155 def colorComments (self , token ):
156156 """ Formats, colors, and returns the comment text from the given token. """
157157 ttyp = tokens .map .get (token .type )
158158 text = token .text .replace ('\n ' , '\\ n' ).replace ('\r ' , '\\ r' ).replace ('\t ' , '\\ t' )
159159 item = '{0} [{1}:{2}] {3}' .format (ttyp , token .start , token .stop , text )
160- yield colortools .black (item )
160+ yield colors .black (item )
161161
162162 def dump (self , fd , level = 0 ):
163163 """ Writes a debug representation of this tree to the given file. """
@@ -175,7 +175,7 @@ def innerDump(root, offset):
175175 if line :
176176 idxes = 'line={}{}{}' .format (line , ', ' if idxes else '' , idxes )
177177 idxes = ' [{}]' .format (idxes ) if idxes else ''
178- idxes = colortools .black (idxes )
178+ idxes = colors .black (idxes )
179179 args = [indent , self .colorType (ttyp ), '' , idxes , '' ]
180180 if extras (token .text , ttyp ):
181181 args [2 ] = ' ' + self .colorText (ttyp , token .text )
0 commit comments