Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison pygments_lexer_pseudocode2/bases.py @ 83:cd79d2c76347
If a Pygments callback gets a "Context" it must set the new position explicitely.
This is **not** done automatically.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 30 Apr 2026 13:21:38 +0200 |
| parents | a2a56d08b860 |
| children | e1663ac707b0 |
comparison
equal
deleted
inserted
replaced
| 82:36a0ef76a6d7 | 83:cd79d2c76347 |
|---|---|
| 83 | 83 |
| 84 def op_ignore(lexer, match, ctx=None): | 84 def op_ignore(lexer, match, ctx=None): |
| 85 """Unconditionally ignore the match.""" | 85 """Unconditionally ignore the match.""" |
| 86 if False: | 86 if False: |
| 87 yield match.start(), Other, "" | 87 yield match.start(), Other, "" |
| 88 if ctx: | |
| 89 ctx.pos = match.end() | |
| 88 | 90 |
| 89 @_staticmethod | 91 @_staticmethod |
| 90 def op_fixed(toktype, value): | 92 def op_fixed(toktype, value): |
| 91 """Unconditionally yield a given token type and value.""" | 93 """Unconditionally yield a given token type and value.""" |
| 92 | 94 |
| 93 def _op_fixed(lexer, match, ctx=None): | 95 def _op_fixed(lexer, match, ctx=None): |
| 94 yield match.start(), toktype, value | 96 yield match.start(), toktype, value |
| 97 if ctx: | |
| 98 ctx.pos = match.end() | |
| 95 | 99 |
| 96 return _op_fixed | 100 return _op_fixed |
| 97 | 101 |
| 98 tokens = { | 102 tokens = { |
| 99 # | 103 # |
