Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff pygments_lexer_pseudocode2/algpseudocode.py @ 113:9aea2fd5f037
The \GETS command.
Its output is customizable with the lexer's "gets" option.
It defaults to `←'.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 05 May 2026 20:51:20 +0200 |
| parents | ec8767cc5493 |
| children | be50fe0687d6 |
line wrap: on
line diff
--- a/pygments_lexer_pseudocode2/algpseudocode.py Tue May 05 17:38:49 2026 +0200 +++ b/pygments_lexer_pseudocode2/algpseudocode.py Tue May 05 20:51:20 2026 +0200 @@ -194,6 +194,9 @@ return _op_opt_ignore_or_fixed + def op_gets(lexer, match, ctx=None): + yield match.start(), Operator, lexer.symbol_gets + def op_symbol(toktype): def _op_symbol(lexer, match, ctx=None): @@ -346,6 +349,7 @@ include("escaped-string-start"), include("py-strings"), include("py-numbers"), + (r"(?i)\\gets\b", op_gets), (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-in-expr"), include("explicit-tokentype"), include("remark"), @@ -361,6 +365,7 @@ include("escaped-string-start"), include("py-strings"), include("py-numbers"), + (r"(?i)\\gets\b", op_gets), (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-in-expr"), include("explicit-tokentype"), include("remark"), @@ -498,6 +503,7 @@ def __init__(self, **options): val = pygments.util.get_bool_opt(options, "no_end", default=False) self.no_end = val + self.symbol_gets = options.get("gets", "←") LexBase.__init__(self, **options) @@ -546,7 +552,7 @@ # "LOOP": XXX TBD # noqa "REPEAT": "WIEDERHOLE", "UNTIL": "BIS", -# "RETURN": XXX TBD # noqa +# "RETURN": XXX TBD # noqa "BEGIN": "START", "END": "ENDE", })
