comparison docs/details.rst @ 88:03e9031b5eca

Some details and examples about \tt-XXX and \ttx-XXX in the docs
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 02 May 2026 10:08:29 +0200
parents
children 3629bf09b30d
comparison
equal deleted inserted replaced
87:d8ca835c74ea 88:03e9031b5eca
1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*-
2
3
4 *********
5 Details
6 *********
7
8
9 Explicit Token Types
10 ====================
11
12 Handle keywords and operators that are not handled by default or change
13 the default handling of some expressions.
14
15 `XX` represents a value in the :mod:`pygments.token.STANDARD_TYPES` dict.
16 Its corresponding token type (the associated `key` in this `dict`) is used as
17 token type.
18
19 ``\\tt-XX/SINGLE-CHAR``
20
21 no escaping needed
22
23 `SINGLE-CHAR` is a single character and can be *every* character
24 (including a carriage-return or line-feed)
25
26 ``\\ttx-XX{CHARACTERS}``
27
28 ``\\ttx-XX(CHARACTERS)``
29
30 ``\\ttx-XX[CHARACTERS]``
31
32 ``\\ttx-XX<CHARACTERS>``
33
34 ``\\ttx-XX<SEP>CHARACTERS<SEP>``
35
36 No escaping possible! There are enough alternatives available!
37
38 `SEP` is one of ``/:|=*+!\$~``.
39
40
41 Examples:
42
43 .. code-block:: AlgPseudocode
44
45 \text{• \\tt-kc/C} \tt-kc/C \rem C as Keyword.Constant
46 \text{• \\tt-ow/∈} \tt-ow/∈ \rem ∈ as Operator.Word
47 \text{• \\ttx-kc{A New Constant Keyword\}} \ttx-kc{A New Constant Keyword} \rem As a new Keyword.Constant
48 \text{• \\ttx-nv{A New Variable Name\}} \ttx-nv{A New Variable Name} \rem An explicit Name.Variable
49 \text{• \\ttx-k(∈ ∌)} \ttx-k(∈ ∌) \rem ∈ and ∌ as (ordinary) Keywords
50 \text{• \\ttx-o<∈ ∌>} \ttx-o<∈ ∌> \rem ∈ and ∌ as (ordinary) Operators
51 /*
52 * The line below has ∈_∌ as (peculiar) function name.
53 * Their params are automatic.
54 */
55 \text{• \\ttx-nf<∈_∌>(p1, p2)} \ttx-nf<∈_∌>(p1, p2)
56 /*
57 * The line below has ∈_∌ as (peculiar) decorator name (as used in Python).
58 * Their params are automatic.
59 */
60 \text{• \\ttx-nd[∈_∌](p1, p2)} \ttx-nd[∈_∌](p1, p2)
61 /*
62 * This is a non-existing token type: you get some generic error marking
63 * with a Generic.Error token and no expansion.
64 */
65 \text{• \\ttx-NON-EXISTING[∈_∌](p1, p2)} \ttx-NON_EXISTING[∈_∌](p1, p2)