Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
changeset 33:db1bc740a201
FIX: ADD: Forgotten bases.py.
When renaming PseudocodeLexer2 there accidentally "LexBase" was introduced
also. This was too early.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 21 Apr 2026 12:33:17 +0200 |
| parents | eaa99d5c719a |
| children | 1f741934205e |
| files | pygments_lexer_pseudocode2/bases.py tox.ini |
| diffstat | 2 files changed, 43 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pygments_lexer_pseudocode2/bases.py Tue Apr 21 12:33:17 2026 +0200 @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# :- +# SPDX-FileCopyrightText: © 2026 Franz Glasner +# SPDX-License-Identifier: MIT +# :- +r"""Some common bases for the lexers.""" + + +__all__ = [] + + +from pygments.lexer import RegexLexer +from pygments.token import Number + + +class LexBase(RegexLexer): + + """A base that defines some common lexer states. + + Default flags are not important. + + """ + + tokens = { +# +# This state is borrowed from Pygment's Python lexer. +# +# SPDX-SnippetBegin +# SPDX-License-Identifier: BSD-2-Clause +# SPDX-SnippetCopyrightText: Copyright 2006-2023 by the Pygments team + 'py-numbers': [ + (r'(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)' + r'([eE][+-]?\d(?:_?\d)*)?', Number.Float), + (r'\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?', Number.Float), + (r'0[oO](?:_?[0-7])+', Number.Oct), + (r'0[bB](?:_?[01])+', Number.Bin), + (r'0[xX](?:_?[a-fA-F0-9])+', Number.Hex), + (r'\d(?:_?\d)*', Number.Integer), + ], +# SPDX-SnippetEnd + }
--- a/tox.ini Tue Apr 21 12:15:22 2026 +0200 +++ b/tox.ini Tue Apr 21 12:33:17 2026 +0200 @@ -3,6 +3,8 @@ [flake8] per-file-ignores = # E122: continuation line missing indentation or outdented + pygments_lexer_pseudocode2/bases.py: E122 + # E122: continuation line missing indentation or outdented # E131: continuation line unaligned for hanging indent # E261: at least two spaces before inline comment # E265: block comment should start with '# '
