3 pygments.formatters.other |
3 pygments.formatters.other |
4 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Other formatters: NullFormatter, RawTokenFormatter. |
6 Other formatters: NullFormatter, RawTokenFormatter. |
7 |
7 |
8 :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 from pygments.formatter import Formatter |
12 from pygments.formatter import Formatter |
13 from pygments.util import OptionError, get_choice_opt, b |
13 from pygments.util import OptionError, get_choice_opt, b |
100 else: |
100 else: |
101 def write(text): |
101 def write(text): |
102 outfile.write(text.encode()) |
102 outfile.write(text.encode()) |
103 flush = outfile.flush |
103 flush = outfile.flush |
104 |
104 |
105 lasttype = None |
|
106 lastval = '' |
|
107 if self.error_color: |
105 if self.error_color: |
108 for ttype, value in tokensource: |
106 for ttype, value in tokensource: |
109 line = "%s\t%r\n" % (ttype, value) |
107 line = "%s\t%r\n" % (ttype, value) |
110 if ttype is Token.Error: |
108 if ttype is Token.Error: |
111 write(colorize(self.error_color, line)) |
109 write(colorize(self.error_color, line)) |