Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff pygments_lexer_pseudocode2/lexers/algpseudocode.py @ 289:6fc7f9c1d89d
Remove the old implementation of explicit token types completely
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 22 May 2026 12:41:08 +0200 |
| parents | 298841bc4dee |
| children |
line wrap: on
line diff
--- a/pygments_lexer_pseudocode2/lexers/algpseudocode.py Fri May 22 12:32:38 2026 +0200 +++ b/pygments_lexer_pseudocode2/lexers/algpseudocode.py Fri May 22 12:41:08 2026 +0200 @@ -223,20 +223,6 @@ return _op_symbol - def op_explicit_tokentype(lexer, match, ctx=None): - needed_css = match.group("type") - toktype = REVERSED_STANDARD_TYPES.get(needed_css, None) - if toktype is None: - # Be more error friendly - toktype = Generic.Error - val = match.group() - _logger.warning("Unhandled explicit token type: %s", val) - else: - val = match.group("characters") - yield match.start(), toktype, val - if ctx: - ctx.pos = match.end() - def op_explicit_tokentype_ex_start(lexer, match, ctx): needed_css = match.group("type") toktype = REVERSED_STANDARD_TYPES.get(needed_css, None) @@ -539,28 +525,6 @@ (r"""\\ttX[ \t]*\{(?P<type>[^}]*)\}[ \t]*\{""", op_explicit_tokentype_ex_start, "extended-explicit-tokentype"), - - # - # Old variants - # - - # Multiple characters possible, but no escaping! - (r"""\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)""" - r"""(?P<sep>[/?.,:;%|=*+!\\$~"'#@_-])""" - r"""(?P<characters>(.|\n)+?)(?P=sep)""", - op_explicit_tokentype), - (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)\{(?P<characters>[^}]+?)\}", - op_explicit_tokentype), - (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)\((?P<characters>[^)]+?)\)", - op_explicit_tokentype), - (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)<(?P<characters>[^>]+?)>", - op_explicit_tokentype), - (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)\[(?P<characters>[^\]]+?)\]", - op_explicit_tokentype), - - # Every character is possible: no escaping needed! - (r"\\tt-(?P<type>[^/]+?)/(?P<characters>(?:.|\n))", - op_explicit_tokentype), ], "extended-explicit-tokentype": [ (r"([^\\}]+)", op_explicit_tokentype_ex_value),
