#NEWLINE# def _analyze_token( self , match , linenum ) : #NEWLINE# #INDENT# "\n        Given a line number and a regexp match for a token on that\n        line, colorize the token.  Note that the regexp match gives us\n        the token's text, start index (on the line), and end index (on\n        the line).\n        " #NEWLINE# if ( match . group ( ) [ 0 ] in '\'"' ) : #NEWLINE# #INDENT# tag = 'terminal' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( match . group ( ) in ( '->' , self . ARROW ) ) : #NEWLINE# #INDENT# tag = 'arrow' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tag = ( 'nonterminal_' + match . group ( ) ) #NEWLINE# if ( linenum not in self . _textwidget . tag_names ( ) ) : #NEWLINE# #INDENT# self . _init_nonterminal_tag ( tag ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# start = ( '%d.%d' % ( linenum , match . start ( ) ) ) #NEWLINE# end = ( '%d.%d' % ( linenum , match . end ( ) ) ) #NEWLINE# self . _textwidget . tag_add ( tag , start , end )