summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-09-05 13:59:50 +0200
committerGeorg Brandl <georg@python.org>2010-09-05 13:59:50 +0200
commit50fa254a87edad52591222bdb7f1f183829a1ff8 (patch)
tree84e682aa9c7bd5722ec8724fe20fe952f335b25a
parenteb6be43ff90b0f67440297e93e23302e11731ba4 (diff)
downloadpygments-50fa254a87edad52591222bdb7f1f183829a1ff8.tar.gz
Be sure to insert Unicode tokens.
-rw-r--r--pygments/lexers/agile.py12
-rw-r--r--pygments/lexers/math.py2
2 files changed, 7 insertions, 7 deletions
diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py
index ecf432c4..817355a7 100644
--- a/pygments/lexers/agile.py
+++ b/pygments/lexers/agile.py
@@ -310,17 +310,17 @@ class PythonConsoleLexer(Lexer):
tb = 0
for match in line_re.finditer(text):
line = match.group()
- if line.startswith('>>> ') or line.startswith('... '):
+ if line.startswith(u'>>> ') or line.startswith(u'... '):
tb = 0
insertions.append((len(curcode),
[(0, Generic.Prompt, line[:4])]))
curcode += line[4:]
- elif line.rstrip() == '...' and not tb:
+ elif line.rstrip() == u'...' and not tb:
# only a new >>> prompt can end an exception block
# otherwise an ellipsis in place of the traceback frames
# will be mishandled
insertions.append((len(curcode),
- [(0, Generic.Prompt, '...')]))
+ [(0, Generic.Prompt, u'...')]))
curcode += line[3:]
else:
if curcode:
@@ -329,8 +329,8 @@ class PythonConsoleLexer(Lexer):
yield item
curcode = ''
insertions = []
- if (line.startswith('Traceback (most recent call last):') or
- re.match(r' File "[^"]+", line \d+\n$', line)):
+ if (line.startswith(u'Traceback (most recent call last):') or
+ re.match(ur' File "[^"]+", line \d+\n$', line)):
tb = 1
curtb = line
tbindex = match.start()
@@ -338,7 +338,7 @@ class PythonConsoleLexer(Lexer):
yield match.start(), Name.Class, line
elif tb:
curtb += line
- if not (line.startswith(' ') or line.strip() == '...'):
+ if not (line.startswith(' ') or line.strip() == u'...'):
tb = 0
for i, t, v in tblexer.get_tokens_unprocessed(curtb):
yield tbindex+i, t, v
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py
index bf609a68..5f00c08e 100644
--- a/pygments/lexers/math.py
+++ b/pygments/lexers/math.py
@@ -228,7 +228,7 @@ class MatlabSessionLexer(Lexer):
# without is showing error on same line as before...?
line = "\n" + line
token = (0, Generic.Traceback, line)
- insertions.append( (idx, [token,]) )
+ insertions.append((idx, [token]))
else:
if curcode: