annotate docs/intro.rst @ 166:6a7dace0141e

Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 08 May 2026 23:54:06 +0200
parents a4317957148b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
0c05dc09c9e2 Customize documentation index and prepare for a "Details" documentation page.
Franz Glasner <fzglas.hg@dom66.de>
parents: 45
diff changeset
1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*-
0c05dc09c9e2 Customize documentation index and prepare for a "Details" documentation page.
Franz Glasner <fzglas.hg@dom66.de>
parents: 45
diff changeset
2
45
6ac1ea5d2d4a Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3
166
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
4 **************
152
66d49e49b06b FIX: Normalize reST for chapter in intro.rst
Franz Glasner <fzglas.hg@dom66.de>
parents: 151
diff changeset
5 Introduction
66d49e49b06b FIX: Normalize reST for chapter in intro.rst
Franz Glasner <fzglas.hg@dom66.de>
parents: 151
diff changeset
6 **************
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
7
166
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
8 Lexer
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
9 =====
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
10
141
acd9073cbbe3 Make a lexerlist.rst that contains the table of the lexers because it is used at least twice
Franz Glasner <fzglas.hg@dom66.de>
parents: 140
diff changeset
11 The package contains the following lexers:
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
12
141
acd9073cbbe3 Make a lexerlist.rst that contains the table of the lexers because it is used at least twice
Franz Glasner <fzglas.hg@dom66.de>
parents: 140
diff changeset
13 .. include:: lexerlist.rst
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
14
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 141
diff changeset
15 They may be used in `Sphinx`_ by their aliases:
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
16
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
17 .. code-block:: none
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
18
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
19 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
20
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
21 \PROGRAM {The Pseudoprogram} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
22
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
23 \END PROGRAM {The Pseudoprogram}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
24
140
e424fcdd472f REFACTOR: Change the structure of the documentation: make the README the first page.
Franz Glasner <fzglas.hg@dom66.de>
parents: 138
diff changeset
25 It will be rendered as:
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
26
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
27 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
28
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
29 \PROGRAM {The Pseudoprogram} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
30
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
31 \END PROGRAM {The Pseudoprogram}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
32
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
33 And the same with the german variant
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
34 (using ``.. code-block:: algpseudocode-de`` as language alias):
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
35
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
36 .. code-block:: algpseudocode-de
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
37
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
38 \PROGRAM {The Pseudoprogram} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
39
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
40 \END PROGRAM {The Pseudoprogram}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
41
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
42 A basic documentation for FrPseudocode you find on its
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
43 :ref:`detail page <fr-pseudocode>`.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
44
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
45 The AlgPseudocode lexer and its friends AlgPseudocodeDE and AlgPseudocodeFR
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
46 basically work in three states: `default`, `expression` and `text`.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
47
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
48 In expressions it automatically recognizes:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
49
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
50 - Strings (single-quote, double-quote, triple-single-quote,
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
51 triple-double-quote, `Python`_ style)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
52 - Numbers (also `Python`_ style)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
53 - (Mathematical) operators and symbols
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
54 - ``\TEXT{...}``
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
55
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
56 To switch in a text-mode that prohibits automatic expression
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
57 highlighting.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
58
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
59 A closing curly brace can be quoted with ``\}`` to not end the
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
60 text mode prematurely.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
61
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
62 - ``\NAME``, ``\CALL`` and ``\GETS``
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
63
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
64 - ``\REM`` and ``\REMARK`` for remarks (aka comments)
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
65
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
66 - Names (`Name.Entity`)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
67
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
68 - :ref:`explicit-token-types`
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
69
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
70 In the default-mode it recogzizes expressions and additionally all
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
71 sorts of comments and commands that are inspired by CTAN's
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
72 `Algpseudocodex`_.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
73
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
74 In texts it recogzizes:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
75
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
76 - ``\EXPR`` or ``\EXPRESSION``
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
77
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
78 To switch to expression-mode.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
79
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
80 A closing curly brace can be quoted with ``\}`` to not end the expression
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
81 mode prematurely.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
82
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
83 - ``\REM`` and ``\REMARK`` for remarks (aka comments)
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
84
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
85 - :ref:`explicit-token-types`
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
86
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
87
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
88 .. rubric:: Some Examples
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 147
diff changeset
89
163
315cfe0a836f Wording
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
90 A synthetic example with many features:
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
91
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
92 .. literalinclude:: examples/example-1.pseudocode
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
93 :language: algpseudocode
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
94 :lines: 2-
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
95
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
96 With a customized `AlgPseudocodeLexer` and its `no_end`
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
97 option set to ``True``.
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
98
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
99 .. literalinclude:: examples/example-1.pseudocode
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
100 :language: NoEndAlgPseudocode
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
101 :lines: 2-
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
102
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
103 This is Wikipedia's description of *Dinic's Algorithm*
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
104 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm):
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
105
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
106 .. literalinclude:: examples/algorithm-dinic.description
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
107 :language: algpseudocode
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
108 :lines: 2-
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
109
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
110 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm*
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
111 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm):
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
112
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
113 .. literalinclude:: examples/algorithm-ford-fulkerson.pseudocode
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
114 :language: algpseudocode
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
115 :lines: 2-
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
116
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
117 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm*
159
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
118 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm)
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
119 with a custom lexer that skip all ``ENDxxx`` keywords:
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
120
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
121 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
122 :language: NoEndAlgPseudocode
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
123 :lines: 2-
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
124
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
125 And now the *Edmonds–Karp Algorithm* with french keywords:
107
1c1985532139 A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents: 86
diff changeset
126
151
4a8c122725b0 Move all the example files to "examples/"
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
127 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
128 :language: algpseudocode-fr
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 107
diff changeset
129 :lines: 2-
154
b38d10ab914a Link to the details page for AlgPseudocode
Franz Glasner <fzglas.hg@dom66.de>
parents: 152
diff changeset
130
164
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 163
diff changeset
131 And again the *Edmonds–Karp Algorithm* with german keywords:
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 163
diff changeset
132
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 163
diff changeset
133 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 163
diff changeset
134 :language: algpseudocode-de
166
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
135 :lines: 2-
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
136
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
137 More details you will find :ref:`here <details-algpseudocode>`.
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
138
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
139
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
140 Filter
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
141 ======
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
142
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
143 The package contains the following filters:
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
144
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
145 .. include:: filterlist.rst
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
146
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
147 The AlgPseudocode lexer yields an error token for the following code block.
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
148 `Sphinx`_ therefore suppresses highlighting completely:
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
149
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
150 .. code-block:: none
164
a4317957148b Move all lexers into a subpackage pygments_lexer_pseudocode2.lexers.
Franz Glasner <fzglas.hg@dom66.de>
parents: 163
diff changeset
151
166
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
152 \EXPR{TEST}
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
153
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
154 With a custom AlgPseudocode lexer that has ``prohibit_raiseonerror_filter``
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
155 activated the output in `Sphinx`_ is as:
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
156
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
157 .. code-block:: no-raiseonerror-algpseudocode
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
158
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
159 \EXPR{TEST}
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
160
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
161
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
162 With the "errortogenericerror" filter the very same block is highlighted
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
163 as:
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
164
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
165 .. code-block:: genericerror-algpseudocode
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
166
6a7dace0141e Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
167 \EXPR{TEST}