# HG changeset patch # User Franz Glasner # Date 1777548098 -7200 # Node ID cd79d2c76347cb94b350ada8a7a0fdf00d874846 # Parent 36a0ef76a6d7648746cc310e596df2bd193e0001 If a Pygments callback gets a "Context" it must set the new position explicitely. This is **not** done automatically. diff -r 36a0ef76a6d7 -r cd79d2c76347 pygments_lexer_pseudocode2/algpseudocode.py --- a/pygments_lexer_pseudocode2/algpseudocode.py Thu Apr 30 12:29:08 2026 +0200 +++ b/pygments_lexer_pseudocode2/algpseudocode.py Thu Apr 30 13:21:38 2026 +0200 @@ -99,6 +99,8 @@ def _op_translate(lexer, match, ctx=None): kw = match.group().upper() yield match.start(), toktype, lexer.TRANSLATIONS.get(kw, kw) + if ctx: + ctx.pos = match.end() return _op_translate @@ -112,6 +114,8 @@ lexer.END_TRANSLATIONS.get( kw, lexer.DEFAULT_END_PREFIX + kw)) + if ctx: + ctx.pos = match.end() return _op_end_translate @@ -120,6 +124,8 @@ def _op_opt_ignore(lexer, match, ctx=None): if not lexer.no_end: yield match.start(), toktype, match.group() + if ctx: + ctx.pos = match.end() return _op_opt_ignore @@ -132,6 +138,8 @@ def _op_opt_ignore_or_fixed(lexer, match, ctx=None): if not lexer.no_end: yield match.start(), toktype, value + if ctx: + ctx.pos = match.end() return _op_opt_ignore_or_fixed @@ -140,6 +148,8 @@ def _op_symbol(lexer, match, ctx=None): kw = match.group().upper() yield match.start(), toktype, lexer.SYMBOLS.get(kw, kw) + if ctx: + ctx.pos = match.end() return _op_symbol diff -r 36a0ef76a6d7 -r cd79d2c76347 pygments_lexer_pseudocode2/bases.py --- a/pygments_lexer_pseudocode2/bases.py Thu Apr 30 12:29:08 2026 +0200 +++ b/pygments_lexer_pseudocode2/bases.py Thu Apr 30 13:21:38 2026 +0200 @@ -85,6 +85,8 @@ """Unconditionally ignore the match.""" if False: yield match.start(), Other, "" + if ctx: + ctx.pos = match.end() @_staticmethod def op_fixed(toktype, value): @@ -92,6 +94,8 @@ def _op_fixed(lexer, match, ctx=None): yield match.start(), toktype, value + if ctx: + ctx.pos = match.end() return _op_fixed