Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison pygments_lexer_pseudocode2/lexers/bases.py @ 285:afbca50b7dc1
Implement an alternate syntax for "Explicit Token Types".
Uses a generic two-argument syntax and allows escaping of characters using
the common excaping rules.
For this to work the AlgPseudocodeLexer is now based on Pygment's
ExtendedRegexLexer instead of RegexLexer.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 20 May 2026 20:35:37 +0200 |
| parents | a4317957148b |
| children |
comparison
equal
deleted
inserted
replaced
| 284:1683a10eabb2 | 285:afbca50b7dc1 |
|---|---|
| 9 | 9 |
| 10 | 10 |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 from pygments import unistring | 13 from pygments import unistring |
| 14 from pygments.lexer import RegexLexer, combined, bygroups, include | 14 from pygments.lexer import ExtendedRegexLexer, combined, bygroups, include |
| 15 from pygments.token import (Comment, Error, Name, Number, Other, String) | 15 from pygments.token import (Comment, Error, Name, Number, Other, String) |
| 16 | 16 |
| 17 | 17 |
| 18 PY2 = sys.version_info[0] <= 2 | 18 PY2 = sys.version_info[0] <= 2 |
| 19 | 19 |
| 71 ] | 71 ] |
| 72 | 72 |
| 73 # SPDX-SnippetEnd | 73 # SPDX-SnippetEnd |
| 74 | 74 |
| 75 | 75 |
| 76 class LexBase(RegexLexer): | 76 class LexBase(ExtendedRegexLexer): |
| 77 | 77 |
| 78 """A base that defines some common lexer states. | 78 """A base that defines some common lexer states. |
| 79 | 79 |
| 80 Default flags are not important. | 80 Default flags are not important. |
| 81 | 81 |
