4 ~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexer for the `Slash <https://github.com/arturadib/Slash-A>`_ programming |
6 Lexer for the `Slash <https://github.com/arturadib/Slash-A>`_ programming |
7 language. |
7 language. |
8 |
8 |
9 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. |
9 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. |
10 :license: BSD, see LICENSE for details. |
10 :license: BSD, see LICENSE for details. |
11 """ |
11 """ |
12 |
12 |
13 from pygments.lexer import ExtendedRegexLexer, bygroups, DelegatingLexer |
13 from pygments.lexer import ExtendedRegexLexer, bygroups, DelegatingLexer |
14 from pygments.token import Name, Number, String, Comment, Punctuation, \ |
14 from pygments.token import Name, Number, String, Comment, Punctuation, \ |
24 return ("#pop", new_state) |
24 return ("#pop", new_state) |
25 |
25 |
26 def right_angle_bracket(lexer, match, ctx): |
26 def right_angle_bracket(lexer, match, ctx): |
27 if len(ctx.stack) > 1 and ctx.stack[-2] == "string": |
27 if len(ctx.stack) > 1 and ctx.stack[-2] == "string": |
28 ctx.stack.pop() |
28 ctx.stack.pop() |
29 yield match.start(), String.Interpol, u"}" |
29 yield match.start(), String.Interpol, '}' |
30 ctx.pos = match.end() |
30 ctx.pos = match.end() |
31 pass |
31 pass |
32 |
32 |
33 tokens = { |
33 tokens = { |
34 "root": [ |
34 "root": [ |
180 aliases = ['slash'] |
180 aliases = ['slash'] |
181 filenames = ['*.sl'] |
181 filenames = ['*.sl'] |
182 |
182 |
183 def __init__(self, **options): |
183 def __init__(self, **options): |
184 from pygments.lexers.web import HtmlLexer |
184 from pygments.lexers.web import HtmlLexer |
185 super(SlashLexer, self).__init__(HtmlLexer, SlashLanguageLexer, **options) |
185 super().__init__(HtmlLexer, SlashLanguageLexer, **options) |