diff options
author | Georg Brandl <georg@python.org> | 2014-01-09 17:14:07 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-09 17:14:07 +0100 |
commit | 2140f455b5b59d7e29d520c27b6eb9d2db30d006 (patch) | |
tree | bc48c372a71d661f361c6945e82738edcc113a76 /pygments/lexer.py | |
parent | 846195f0fb24e724a611d601494fa5056936b5bc (diff) | |
parent | 8f1d30b59f7720cf99ed508ac720eb7126161e2b (diff) | |
download | pygments-2140f455b5b59d7e29d520c27b6eb9d2db30d006.tar.gz |
Merged in rwtolbert/pygments-main (pull request #238)
Added lexer for new Hy language, a variant of Lisp running under Python
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): |