3 pygments.lexers.webmisc |
3 pygments.lexers.webmisc |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for misc. web stuff. |
6 Lexers for misc. web stuff. |
7 |
7 |
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
156 yield match.start(), Punctuation, match.group(1) |
156 yield match.start(), Punctuation, match.group(1) |
157 # if we have run out of our state stack, pop whatever is on the pygments |
157 # if we have run out of our state stack, pop whatever is on the pygments |
158 # state stack |
158 # state stack |
159 if len(lexer.xquery_parse_state) == 0: |
159 if len(lexer.xquery_parse_state) == 0: |
160 ctx.stack.pop() |
160 ctx.stack.pop() |
|
161 if not ctx.stack: |
|
162 # make sure we have at least the root state on invalid inputs |
|
163 ctx.stack = ['root'] |
161 elif len(ctx.stack) > 1: |
164 elif len(ctx.stack) > 1: |
162 ctx.stack.append(lexer.xquery_parse_state.pop()) |
165 ctx.stack.append(lexer.xquery_parse_state.pop()) |
163 else: |
166 else: |
164 # i don't know if i'll need this, but in case, default back to root |
167 # i don't know if i'll need this, but in case, default back to root |
165 ctx.stack = ['root'] |
168 ctx.stack = ['root'] |