comparison pygments_lexer_pseudocode2/utils.py @ 85:ae5e741d2a9b

Optimize op_explicit_tokentype(): use a pref-computed reversed pygments.token.STANDARD_TYPES
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 30 Apr 2026 19:56:39 +0200
parents
children 298841bc4dee
comparison
equal deleted inserted replaced
84:3ac1c4502ad0 85:ae5e741d2a9b
1 # -*- coding: utf-8; -*-
2 # :-
3 # SPDX-FileCopyrightText: © 2026 Franz Glasner
4 # SPDX-License-Identifier: MIT
5 # :-
6 r"""Some helper utility functions and data.
7
8 """
9
10 __all__ = ["REVERSED_STANDARD_TYPES"]
11
12
13 import pygments.token
14
15
16 REVERSED_STANDARD_TYPES = {}
17
18 # Side-effect on import
19 for _toktype, _cssstyle in pygments.token.STANDARD_TYPES.items():
20 REVERSED_STANDARD_TYPES[_cssstyle] = _toktype
21 del _toktype, _cssstyle