diff options
author | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2009-03-31 10:26:55 -0500 |
commit | 7b95efab48d9ec79e995bf4d6db10fd049e3395a (patch) | |
tree | 48fc9b840dab83976a85af85d1c705dbaa051a0b /pygments/lexers/special.py | |
parent | f12c878ed096137c91658a0f62f0070e08c2afea (diff) | |
download | pygments-7b95efab48d9ec79e995bf4d6db10fd049e3395a.tar.gz |
Port Pygments to Python 3.1.
Diffstat (limited to 'pygments/lexers/special.py')
-rw-r--r-- | pygments/lexers/special.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pygments/lexers/special.py b/pygments/lexers/special.py index 1f6b74af..31d01c90 100644 --- a/pygments/lexers/special.py +++ b/pygments/lexers/special.py @@ -14,7 +14,7 @@ import cStringIO from pygments.lexer import Lexer from pygments.token import Token, Error, Text -from pygments.util import get_choice_opt +from pygments.util import get_choice_opt, b __all__ = ['TextLexer', 'RawTokenLexer'] @@ -35,7 +35,7 @@ class TextLexer(Lexer): _ttype_cache = {} -line_re = re.compile('.*?\n') +line_re = re.compile(b('.*?\n')) class RawTokenLexer(Lexer): """ @@ -73,7 +73,7 @@ class RawTokenLexer(Lexer): # do not call Lexer.get_tokens() because we do not want Unicode # decoding to occur, and stripping is not optional. - text = text.strip('\n') + '\n' + text = text.strip(b('\n')) + b('\n') for i, t, v in self.get_tokens_unprocessed(text): yield t, v @@ -81,7 +81,7 @@ class RawTokenLexer(Lexer): length = 0 for match in line_re.finditer(text): try: - ttypestr, val = match.group().split('\t', 1) + ttypestr, val = match.group().split(b('\t'), 1) except ValueError: val = match.group().decode(self.encoding) ttype = Error |