summaryrefslogtreecommitdiff
path: root/pygments/lexer.py
diff options
context:
space:
mode:
authormitsuhiko <devnull@localhost>2007-09-27 18:13:12 +0200
committermitsuhiko <devnull@localhost>2007-09-27 18:13:12 +0200
commit3dbb6abf983c61577b18cec59bec324be3dec98e (patch)
tree9604a1ac0efe6adfd98b7b6f6cbb3661566df7b8 /pygments/lexer.py
parent88648172f397273cacf9cecc60c762afa1f44616 (diff)
downloadpygments-3dbb6abf983c61577b18cec59bec324be3dec98e.tar.gz
a simple '#pop' is not possible for multiple targets too
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r--pygments/lexer.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py
index 20096677..0850650e 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -403,10 +403,15 @@ class RegexLexerMeta(LexerMeta):
new_state = (new_state,)
elif isinstance(tdef2, tuple):
# push more than one state
+ new_state = []
for state in tdef2:
- assert state in unprocessed, \
- 'unknown new state ' + state
- new_state = tdef2
+ if state == '#pop':
+ new_state.append(-1)
+ else:
+ assert state in unprocessed, \
+ 'unknown new state ' + state
+ new_state.append(state)
+ new_state = tuple(new_state)
else:
assert False, 'unknown new state def %r' % tdef2
tokens.append((rex, tdef[1], new_state))