Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison pygments_lexer_pseudocode2/bases.py @ 65:3f4223a79d2b
Normalize whitespace handling for entity names
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 28 Apr 2026 13:05:15 +0200 |
| parents | 7153e945a3d6 |
| children | 2ea86269e84e |
comparison
equal
deleted
inserted
replaced
| 64:05c53e431c88 | 65:3f4223a79d2b |
|---|---|
| 8 __all__ = ["LexBase", "uni_name", "py_innerstring_rules", "py_name_rules"] | 8 __all__ = ["LexBase", "uni_name", "py_innerstring_rules", "py_name_rules"] |
| 9 | 9 |
| 10 | 10 |
| 11 from pygments import unistring | 11 from pygments import unistring |
| 12 from pygments.lexer import RegexLexer, combined, bygroups, include | 12 from pygments.lexer import RegexLexer, combined, bygroups, include |
| 13 from pygments.token import Error, Name, Number, String, Comment, Other | 13 from pygments.token import (Comment, Error, Name, Number, Other, String, |
| 14 Whitespace) | |
| 14 | 15 |
| 15 | 16 |
| 16 # | 17 # |
| 17 # SPDX-SnippetBegin | 18 # SPDX-SnippetBegin |
| 18 # SPDX-License-Identifier: BSD-2-Clause | 19 # SPDX-License-Identifier: BSD-2-Clause |
| 67 Default flags are not important. | 68 Default flags are not important. |
| 68 | 69 |
| 69 """ | 70 """ |
| 70 | 71 |
| 71 def op_ignore(lexer, match, ctx=None): | 72 def op_ignore(lexer, match, ctx=None): |
| 73 """Ignore the match.""" | |
| 72 if False: | 74 if False: |
| 73 yield match.start(), Other, "" | 75 yield match.start(), Other, "" |
| 76 | |
| 77 def op_space(lexer, match, ctx=None): | |
| 78 """Unconditionally yield a single whitespace ' '.""" | |
| 79 yield match.start(), Whitespace, " " | |
| 74 | 80 |
| 75 tokens = { | 81 tokens = { |
| 76 # | 82 # |
| 77 # These states are borrowed from Pygment's Python lexer. | 83 # These states are borrowed from Pygment's Python lexer. |
| 78 # Their names have been prefixed with `py-'. | 84 # Their names have been prefixed with `py-'. |
