diff options
author | Georg Brandl <georg@python.org> | 2014-01-09 17:35:34 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-09 17:35:34 +0100 |
commit | bd5ae968ec3442d12e7a6d453c7973145d364ba0 (patch) | |
tree | cfbe4b22b8d8591d5f0e2a43dcf67d36aff6d39f /pygments/lexer.py | |
parent | ad252410a347ad13c8206c8c9fa0a9e33632e10f (diff) | |
parent | dbcb3df465137d3645a1cea00184fbb55af1d141 (diff) | |
download | pygments-bd5ae968ec3442d12e7a6d453c7973145d364ba0.tar.gz |
Merged in j3lamp/pygments-main (pull request #206)
Fix for Issue #875
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r-- | pygments/lexer.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py index 8f88dfda..8538fe7c 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -192,7 +192,9 @@ class Lexer(object): def get_tokens_unprocessed(self, text): """ - Return an iterable of (tokentype, value) pairs. + Return an iterable of (index, tokentype, value) pairs where "index" + is the starting position of the token within the input text. + In subclasses, implement this method as a generator to maximize effectiveness. """ @@ -673,7 +675,7 @@ class ExtendedRegexLexer(RegexLexer): if state == '#pop': ctx.stack.pop() elif state == '#push': - ctx.stack.append(statestack[-1]) + ctx.stack.append(ctx.stack[-1]) else: ctx.stack.append(state) elif isinstance(new_state, int): |