annotate docs/details-algpseudocode.rst @ 164:a4317957148b

Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers. This is to prepare for a new subpackage with filters.
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 08 May 2026 21:19:54 +0200
parents 11ce0903ff8b
children 88f872c50aae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*-
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3
156
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
4 .. _details-algpseudocode:
154
b38d10ab914a Link to the details page for AlgPseudocode
Franz Glasner <fzglas.hg@dom66.de>
parents: 153
diff changeset
5
127
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
6 ***************
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
7 AlgPseudocode
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
8 ***************
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
9
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
10 Lexer Options
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
11 =============
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
12
160
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
13 .. describe:: prohibit_raiseonerror_filter
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
14
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
15 **Type:** `bool`
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
16
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
17 **Default:** `False`
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
18
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
19 If ``True`` the `raiseonerror` filter is not allowed to be applied by
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
20 `Sphinx`_ when :py:meth:`Lexer.add_filter` is called.
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
21
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
22 This setting does not apply to filters that are set by the standard
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
23 lexer option `filters`.
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
24
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
25 .. describe:: no_end
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
26
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
27 **Type:** `bool`
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
28
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
29 **Default:** `False`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
30
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
31 If ``True`` all the ``\ENDxxx`` commands will be skipped and yield
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
32 nothing.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
33
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
34 .. describe:: gets
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
35
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
36 **Type:** `str` or `None`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
37
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
38 **Default:** `None` (yields ``←``)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
39
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
40 The operator symbol to be printed by the command ``\GETS``.
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
41
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
42 An often used alternative is ``:=``.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
43
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
44 .. describe:: remark
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
45
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
46 **Type:** `str` or `None`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
47
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
48 **Default:** `None` (yields ``▷``)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
49
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
50 The symbol to be printed as when starting comments with
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
51 ``\REMARK`` or ``\REM``.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
52
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
53 To use a lexer with non-default options in `Sphinx`_ see section
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
54 :ref:`customized-sphinx-lexers`.
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
55
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
56
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
57 Comments
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
58 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
59
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
60 - with the ``\REMARK`` or ``\REM`` keywords (this includes a leading symbol)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
61 - multi-line comments with ``/* ... */``; they can be **nested**
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
62 - multi-line comments with ``(* ... *)``; they can be **nested**
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
63 - single-line comments with ``//`` or ``#`` (until the end of the line)
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
64
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
65 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
66
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
67 /*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
68 * A single multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
69 */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
70
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
71 /*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
72 * A multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
73 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
74 * /* This is a nested multi-line comment */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
75 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
76 */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
77
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
78 (*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
79 * A multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
80 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
81 * (* This is a nested multi-line comment *)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
82 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
83 *)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
84
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
85 // A single-line comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
86
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
87 # A single-line comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
88
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
89 \REM A remark has a leading symbol
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
90
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
91
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
92 Literals
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
93 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
94
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
95 Strings and numbers as in `Python`_. String prefixes ``r``, ``f`` and ``t``
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
96 are not supported -- ``u`` and ``b`` are.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
97
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
98 To yield non-string-delimiting single- and double-quotes you have to escape them
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
99 using ``\'`` or ``\"``. This must be used to typeset something as
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
100 :algpseudocode:`f\\'(x) = 0`.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
101
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
102 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
103
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
104 0 0xdead 0b100001 0o720 2.7 2.7e-54
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
105
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
106 "A string with an escaped double-quote \" "
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
107
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
108 'Another string with an escaped single-quote \' '
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
109
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
110 """A multiline
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
111 string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
112 """
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
113
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
114 '''Another multiline string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
115
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
116 '''
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
117
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
118 b"A \x20 byte string"
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
119
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
120 u'An explicit Unicode \u1234 string'
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
121
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
122 \" a non string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
123
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
124 \' a non string also
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
125
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
126
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
127 (Mathematical) Symbols and Operators
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
128 ====================================
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
129
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
130 Some ASCII symbol combinations are recognized and replaced by a
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
131 Unicode symbol:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
132
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
133 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
134
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
135 \TEXT{<=>} <=>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
136 \TEXT{<->} <->
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
137 \TEXT{<-} <-
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
138 \TEXT{->} ->
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
139 \TEXT{=>} =>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
140 \TEXT{<=} <=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
141 \TEXT{>=} >=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
142 \TEXT{<>} <>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
143 \TEXT{!=} !=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
144 \TEXT{:=} :=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
145 \TEXT{=:} =:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
146 \TEXT{?=} ?=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
147
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
148 Unicode codepoints with property ``Sm`` are recognized as mathematical symbol
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
149 and highlighted accordingly.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
150
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
151
159
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
152 Punctuation
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
153 ===========
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
154
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
155 Runs of dots ``.``, ``..``, ``...``, ``....``, ... are handled
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
156 properly in expressions and yield a punctuation token.
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
157 They are not replaced by corresponding Unicode symbols.
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
158
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
159
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
160 Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
161 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
162
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
163 Explicit Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
164 -----------------
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
165
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
166 - Start with a backslash character ``\``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
167 - Case-insensitive
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
168 - Translated if a translation is found
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
169
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
170 Parameter handling is as follows:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
171
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
172 - Parameters are enclosed in curly braces ``{`` and ``}``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
173 - Escaping within the braces is possible using the backslash ``\``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
174 - Parameters are separated from the keyword/command by a (possibly empty) run
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
175 of space or TAB characters.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
176 This is true for required and optional parameters.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
177
162
11ce0903ff8b Yield lone backslash characters in expressions that not really escape anything as "Generic.Error" now.
Franz Glasner <fzglas.hg@dom66.de>
parents: 160
diff changeset
178 .. todo:: Escaping
11ce0903ff8b Yield lone backslash characters in expressions that not really escape anything as "Generic.Error" now.
Franz Glasner <fzglas.hg@dom66.de>
parents: 160
diff changeset
179
11ce0903ff8b Yield lone backslash characters in expressions that not really escape anything as "Generic.Error" now.
Franz Glasner <fzglas.hg@dom66.de>
parents: 160
diff changeset
180 A single backslash is a Generic.Error token
11ce0903ff8b Yield lone backslash characters in expressions that not really escape anything as "Generic.Error" now.
Franz Glasner <fzglas.hg@dom66.de>
parents: 160
diff changeset
181
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
182
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
183 With Required Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
184 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
185
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
186 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
187
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
188 \TEXT{\PROGRAM {A Program\} or \PROG {A Program\}} \PROGRAM {A Program}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
189 \TEXT{\ALGORITHM{An Algorithm\} or \ALGO{An Algorithm\}} \ALGORITHM{An Algorithm}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
190 \TEXT{\PROCEDURE{A Procedure\} or \PROC{A Procedure\}} \PROCEDURE{A Procedure}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
191 \TEXT{\FUNCTION{A Function\} or \FUNC{A Function\} or \FN{A Function\}} \FUNCTION{A Function}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
192 \TEXT{\CLASS{A Class\}} \CLASS{A Class}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
193
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
194 \TEXT{\STATEMENT{the expression\} \STATE{the expression\} \BLOCK{the expression\}} \STATEMENT{the expression}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
195
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
196 \TEXT{expr1: \\EXPRESSION{expression a in b\} expr2: \\EXPR{expression b in a\}} \TEXT{expr1: \EXPRESSION{expression a in b} expr2: \EXPR{expression b in a}}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
197
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
198 \TEXT{\TEXTSTATEMENT{the text\} \TEXTSTATE{the text\} \TSTATEMENT{the text\} \TSTATE{the text\} \TEXTBLOCK{the text\} \TBLOCK{the text\}} \TEXTSTATEMENT{the text}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
199
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
200 \TEXT{\INPUT{Input 1\}} \INPUT{Input 1}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
201 \TEXT{\INPUTS{Input 2\}} \INPUTS{Input 2}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
202
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
203 \TEXT{\OUTPUT{Output 1\}} \OUTPUT{Output 1}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
204 \TEXT{\OUTPUTS{Output 2\}} \OUTPUTS{Output 2}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
205
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
206 \TEXT{\ENSURE{Whatever should be ensured!\}} \ENSURE{Whatever should be ensured!}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
207
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
208 \TEXT{\REQUIRE{Whatever should be required.\}} \REQUIRE{Whatever should be required.}
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
209
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
210 \TEXT{\RETURNS{Return 2\}} \RETURNS{Return 2}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
211
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
212 \TEXT{\CALL{a function\}(p1, p2)} \CALL{a function}(p1, p2)
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
213
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
214 \TEXT{\NAME{an entity name\}} \NAME{an entity name}
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
215
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
216
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
217 With Optional Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
218 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
219
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
220 Some ``END``-keywords have optional parameters:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
221
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
222 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
223
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
224 \TEXT{\ENDPROGRAM \ENDPROG} \ENDPROGRAM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
225 \TEXT{\ENDALGORITHM \ENDALGO} \ENDALGORITHM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
226 \TEXT{\ENDPROCEDURE \ENDPROC} \ENDPROCEDURE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
227 \TEXT{\ENDFUNCTION \ENDFUNC \ENDFN} \ENDFUNCTION
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
228 \TEXT{\ENDCLASS} \ENDCLASS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
229
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
230 They are used like this:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
231
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
232 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
233
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
234 \TEXT{\CLASS{Foo Bar Class\} ... \END CLASS {Foo Bar Class\}} \TEXT{yields} \CLASS{Foo Bar Class} ... \END CLASS {Foo Bar Class}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
235
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
236 .. seealso:: Syntax variants: `END-Keywords`_
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
237
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
238
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
239 Without Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
240 ~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
241
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
242 "Normal" Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
243 '''''''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
244
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
245 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
246
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
247 \TEXT{\IF} \IF
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
248 \TEXT{\THEN} \THEN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
249 \TEXT{\ELSE} \ELSE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
250 \TEXT{\ELSEIF or \ELSIF or \ELIF} \ELSEIF \text{or} \ELSIF \text{or} \ELIF
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
251 \TEXT{\DO} \DO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
252 \TEXT{\WHILE} \WHILE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
253 \TEXT{\FORALL} \FORALL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
254 \TEXT{\FOR} \FOR
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
255 \TEXT{\FROM} \FROM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
256 \TEXT{\TO} \TO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
257 \TEXT{\STEP} \STEP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
258 \TEXT{\IN} \IN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
259 \TEXT{\LOOP} \LOOP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
260 \TEXT{\REPEAT} \REPEAT
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
261 \TEXT{\UNTIL} \UNTIL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
262
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
263 \TEXT{\RETURN} \RETURN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
264
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
265 \TEXT{\BEGIN} \BEGIN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
266 \TEXT{\END} \END
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
267
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
268 \TEXT{\IS} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
269 \TEXT{\WITH} \WITH
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
270
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
271 \TEXT{\GETS} \GETS
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
272
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
273 \TEXT{\\REMARK or \\REM} \REMARK A comment with a leading symbol
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
274
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
275 ``\REMARK`` or ``\REM`` is special: all characters to the end of the
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
276 line are taken as comment; curly braces are not needed---in fact:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
277 they are interpreted to be part of the comment.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
278
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
279
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
280 END-Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
281 ''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
282
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
283 The separator character can be empty, a run of ASCII spaces, a run of TAB characters,
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
284 a single underscore ``_`` or a single hyphen ``-`` like:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
285
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
286 ``\ENDIF``, ``\END IF``, ``\END-IF``, ``\END_IF`` or ``\END IF``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
287
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
288
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
289 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
290
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
291 \text{\ENDIF} \ENDIF \rem empty
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
292
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
293 \text{\END IF} \END IF \rem a single space
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
294
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
295 \text{\END IF} \END IF \rem two spaces
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
296
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
297 \text{\END-IF} \END-IF \rem a single hyphen
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
298
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
299 \text{\END_IF} \END_IF \rem a single underscore
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
300
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
301 \text{\END IF} \END IF \rem a single TAB character
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
302
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
303 The list of END-keywords (here always just with ``-`` as separator):
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
304
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
305 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
306
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
307 \text{\END-PROGRAM \END-PROG} \END-PROGRAM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
308 \text{\END-ALGORITHM \END-ALGO} \END-ALGORITHM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
309 \text{\END-PROCEDURE \END-PROC} \END-PROCEDURE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
310 \text{\END-FUNCTION \END-FUNC \END-FN} \END-FUNCTION
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
311 \text{\END-CLASS} \END-CLASS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
312 \text{\END-IF} \END-IF
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
313 \text{\END-WHILE} \END-WHILE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
314 \text{\END-FOR} \END-FOR
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
315 \text{\END-FORALL} \END-FORALL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
316 \text{\END-LOOP} \END-LOOP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
317
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
318
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
319 Names and Entities
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
320 ==================
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
321
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
322 In an expression context all other words are interpreted as entity
156
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
323 names (token type :py:class:`pygments.token.Token.Name.Entity`).
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
324
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
325 Allowed characters in the words follow the corresponding `Python`_ rules.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
326 As such, many Unicode characters are allowed.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
327
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
328 To highlight entity names with whitespace or other "special" characters in it
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
329 use the ``NAME`` command.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
330
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
331 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
332
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
333 \TEXT{entity_name_1} entity_name_1
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
334
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
335 \TEXT{entity_name_2} entity_name_2
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
336
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
337 \TEXT{\NAME{entity-name 3\}} \NAME{entity-name 3}
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
338
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
339 \TEXT{München} München
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
340
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
341 \TEXT{Genève} Genève
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
342
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
343 .. _explicit-token-types:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
344
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
345 Explicit Token Types
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
346 ====================
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
347
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
348 Handle keywords and operators that are not handled by default or change
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
349 the default handling of some expressions.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
350
156
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
351 `XX` represents a `value` in the :py:data:`pygments.token.STANDARD_TYPES`
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
352 dict.
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
353 Its corresponding token type (the associated `key` in this `dict`) is
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
354 used as token type.
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
355
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
356 ``\\tt-XX/SINGLE-CHAR``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
357
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
358 no escaping needed
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
359
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
360 `SINGLE-CHAR` is a single character and can be *every* character
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
361 (including a carriage-return or line-feed)
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
362
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
363 ``\\ttx-XX{CHARACTERS}``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
364
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
365 ``\\ttx-XX(CHARACTERS)``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
366
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
367 ``\\ttx-XX[CHARACTERS]``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
368
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
369 ``\\ttx-XX<CHARACTERS>``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
370
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
371 ``\\ttx-XX<SEP>CHARACTERS<SEP>``
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
372
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
373 No escaping possible! There are enough alternatives available!
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
374
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
375 `SEP` is one of ``/:|=*+!\$~``.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
376
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
377
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
378 Examples:
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
379
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
380 .. code-block:: algpseudocode
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
381
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
382 \text{• \\tt-kc/C} \tt-kc/C \rem C as Keyword.Constant
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
383 \text{• \\tt-ow/∈} \tt-ow/∈ \rem ∈ as Operator.Word
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
384 \text{• \\ttx-kc{A New Constant Keyword\}} \ttx-kc{A New Constant Keyword} \rem As a new Keyword.Constant
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
385 \text{• \\ttx-nv{A New Variable Name\}} \ttx-nv{A New Variable Name} \rem An explicit Name.Variable
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
386 \text{• \\ttx-k(∈ ∌)} \ttx-k(∈ ∌) \rem ∈ and ∌ as (ordinary) Keywords
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
387 \text{• \\ttx-o<∈ ∌>} \ttx-o<∈ ∌> \rem ∈ and ∌ as (ordinary) Operators
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
388 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
389 * The line below has ∈_∌ as (peculiar) function name.
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
390 * Their params are automatic (i.e. a normal expression).
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
391 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
392 \text{• \\ttx-nf<∈_∌>(p1, p2)} \ttx-nf<∈_∌>(p1, p2)
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
393 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
394 * The line below has ∈_∌ as (peculiar) decorator name (as used in Python).
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
395 * Their params are automatic (i.e. a normal expression).
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
396 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
397 \text{• \\ttx-nd[∈_∌](p1, p2)} \ttx-nd[∈_∌](p1, p2)
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
398 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
399 * This is a non-existing token type: you get some generic error marking
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
400 * with a Generic.Error token and no expansion.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
401 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
402 \text{• \\ttx-NON-EXISTING[∈_∌](p1, p2)} \ttx-NON_EXISTING[∈_∌](p1, p2)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
403
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
404 .. note:: Explicit token types are **case-sensitive**.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
405
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
406
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
407 .. _customized-sphinx-lexers:
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
408
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
409 Customized Lexers in Sphinx
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
410 ===========================
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
411
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
412 Defining lexers with non-default options in `Sphinx`_ can be done in its
153
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
413 configuration file :file:`conf.py`.
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
414
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
415 The first option is to apply the Sphinx config value ``highlight_options``
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
416 properly. An existing lexer can be customized by options.
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
417
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
418 A more flexible alternative is to define a new lexer in the Sphinx
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
419 application. The very same lexer class can be used with different options:
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
420
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
421 .. code-block:: python
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
422
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
423 from functools import partial
164
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 162
diff changeset
424 from pygments_lexer_pseudocode2.lexers.algpseudocode import AlgPseudocodeLexer
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
425
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
426 def setup(app):
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
427
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
428 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
429 # Add a custom lexer: AlgPseudocodeLexer with custom init
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
430 # option "no_end".
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
431 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
432 # In modern Sphinx versions given lexer must be callable and may
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
433 # not be a lexer instance. So use an indirection with "partial"
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
434 # here.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
435 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
436 app.add_lexer("noend-algpseudocode",
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
437 partial(AlgPseudocodeLexer, no_end=True))
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
438
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
439 Similarily it works for custom styles and filters.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
440
158
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
441 .. note:: Lexers in Sphinx are instantiated with the `raiseonerror` filter
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
442 applied by default.
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
443 This is also true for custom lexers that are added by
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
444 :py:meth:`Sphinx.add_lexer`.
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
445
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
446 Lexer *instances* that are added to
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
447 :py:data:`sphinx.highlighting.lexers` somehow are taken as is by
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
448 Sphinx and are not augmented with any default filters.
f08d77b8cbf7 Document the default filter "raiseonerror" that is applied by Sphinx by default for lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 156
diff changeset
449
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
450 For older Sphinx versions your mileage may vary.