diff pygments_lexer_pseudocode2/lexers/algpseudocode.py @ 276:397ed930a5ba

Allow more separator characters for explicit token types. Extensive tests including a special test when using the backslash.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 20 May 2026 12:10:01 +0200
parents f365d9d2c0ad
children ee512932d603
line wrap: on
line diff
--- a/pygments_lexer_pseudocode2/lexers/algpseudocode.py	Wed May 20 10:16:58 2026 +0200
+++ b/pygments_lexer_pseudocode2/lexers/algpseudocode.py	Wed May 20 12:10:01 2026 +0200
@@ -491,8 +491,9 @@
             # All these REs are CASE-SENSITIVE!
 
             # Multiple characters possible, but no escaping!
-            (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)(?P<sep>[/:|=*+!\\$~])"
-             r"(?P<character>(.|\n)+?)(?P=sep)",
+            (r"""\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)"""
+             r"""(?P<sep>[/?.,:;%|=*+!\\$~"'#@_-])"""
+             r"""(?P<character>(.|\n)+?)(?P=sep)""",
              op_explicit_tokentype),
             (r"\\ttx\-(?P<type>[a-zA-Z0-9_-]+?)\{(?P<character>[^}]+?)\}",
              op_explicit_tokentype),