From 1699c0b24ae29a468b9fbd9d22b56a8e1aef9c16 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 9 Jan 2014 19:51:19 +0100 Subject: matlab session: fix roundtrips --- pygments/lexers/math.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pygments/lexers/math.py') 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)): -- cgit v1.2.1