diff options
author | Georg Brandl <georg@python.org> | 2014-01-09 19:51:19 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-09 19:51:19 +0100 |
commit | 1699c0b24ae29a468b9fbd9d22b56a8e1aef9c16 (patch) | |
tree | 8cfa8da34815767511c7bfea3d692b34a51b170c /pygments/lexers/math.py | |
parent | ad48d5f87c8a485278ffc448b199c7f2c0e3e6e2 (diff) | |
download | pygments-1699c0b24ae29a468b9fbd9d22b56a8e1aef9c16.tar.gz |
matlab session: fix roundtrips
Diffstat (limited to 'pygments/lexers/math.py')
-rw-r--r-- | pygments/lexers/math.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py index f0312865..f275d4b0 100644 --- a/pygments/lexers/math.py +++ b/pygments/lexers/math.py @@ -403,17 +403,22 @@ class MatlabSessionLexer(Lexer): for match in line_re.finditer(text): line = match.group() - if line.startswith('>>'): + if line.startswith('>> '): insertions.append((len(curcode), [(0, Generic.Prompt, line[:3])])) curcode += line[3:] + elif line.startswith('>>'): + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:2])])) + curcode += line[2:] + elif line.startswith('???'): idx = len(curcode) # without is showing error on same line as before...? - line = "\n" + line + #line = "\n" + line token = (0, Generic.Traceback, line) insertions.append((idx, [token])) @@ -427,6 +432,7 @@ class MatlabSessionLexer(Lexer): yield match.start(), Generic.Output, line + print insertions if curcode: # or item: for item in do_insertions( insertions, mlexer.get_tokens_unprocessed(curcode)): |