annotate docs/lexer-algpseudocode.rst @ 168:bff8b900713a

REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 11 May 2026 01:31:12 +0200
parents docs/details-algpseudocode.rst@88f872c50aae
children 3c517c22df9c
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
168
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
4 *************************************
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
5 AlgPseudocode and Language Variants
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
6 *************************************
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
7
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
8 These lexers are heavily heavily inspired by CTAN’s `Algpseudocodex`_.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
9 They recogzize expressions and additionally all sorts of comments and
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
10 commands that are inspired by `Algpseudocodex`_.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
11
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
12 They may be used in `Sphinx`_ by their aliases:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
13
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
14 .. code-block:: none
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
15
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
16 .. code-block:: algpseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
17
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
18 \PROGRAM {The Pseudoprogram} \IS
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
19
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
20 \END PROGRAM {The Pseudoprogram}
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
21
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
22 It will be rendered as:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
23
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
24 .. code-block:: algpseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
25
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
26 \PROGRAM {The Pseudoprogram} \IS
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
27
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
28 \END PROGRAM {The Pseudoprogram}
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
29
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
30 And the same with the german variant
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
31 (using ``.. code-block:: algpseudocode-de`` as language alias):
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
32
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
33 .. code-block:: algpseudocode-de
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
34
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
35 \PROGRAM {The Pseudoprogram} \IS
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
36
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
37 \END PROGRAM {The Pseudoprogram}
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
38
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
39 The AlgPseudocode lexer and its language variants AlgPseudocodeDE and
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
40 AlgPseudocodeFR basically work in three states: `default`,
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
41 `expression` and `text`.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
42
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
43 In expressions it automatically recognizes:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
44
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
45 - Strings (single-quote, double-quote, triple-single-quote,
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
46 triple-double-quote, `Python`_ style)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
47 - Numbers (also `Python`_ style)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
48 - (Mathematical) operators and symbols
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
49 - ``\TEXT{...}``
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
50
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
51 To switch in a text-mode that prohibits automatic expression
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
52 highlighting.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
53
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
54 A closing curly brace can be quoted with ``\}`` to not end the
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
55 text mode prematurely.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
56
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
57 - ``\NAME``, ``\CALL`` and ``\GETS``
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
58
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
59 - ``\REM`` and ``\REMARK`` for remarks (aka comments)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
60
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
61 - Names (`Name.Entity`)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
62
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
63 - :ref:`explicit-token-types`
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
64
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
65 In the default-mode it recogzizes expressions and additionally all
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
66 sorts of comments and commands that look somewhat like `Algpseudocodex`_
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
67 commands.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
68
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
69 In texts it recogzizes:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
70
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
71 - ``\EXPR`` or ``\EXPRESSION``
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
72
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
73 To switch to expression-mode.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
74
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
75 A closing curly brace can be quoted with ``\}`` to not end the expression
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
76 mode prematurely.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
77
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
78 - ``\REM`` and ``\REMARK`` for remarks (aka comments)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
79
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
80 - :ref:`explicit-token-types`
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
81
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
82
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
83 .. rubric:: Some Examples
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
84
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
85 A synthetic example with many features:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
86
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
87 .. literalinclude:: examples/example-1.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
88 :language: algpseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
89 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
90
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
91 With a customized `AlgPseudocodeLexer` and its `no_end`
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
92 option set to ``True``.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
93
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
94 .. literalinclude:: examples/example-1.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
95 :language: NoEndAlgPseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
96 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
97
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
98 This is Wikipedia's description of *Dinic's Algorithm*
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
99 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm):
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
100
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
101 .. literalinclude:: examples/algorithm-dinic.description
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
102 :language: algpseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
103 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
104
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
105 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm*
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
106 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm):
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
107
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
108 .. literalinclude:: examples/algorithm-ford-fulkerson.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
109 :language: algpseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
110 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
111
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
112 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm*
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
113 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm)
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
114 with a custom lexer that skip all ``ENDxxx`` keywords:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
115
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
116 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
117 :language: NoEndAlgPseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
118 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
119
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
120 And now the *Edmonds–Karp Algorithm* with french keywords:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
121
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
122 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
123 :language: algpseudocode-fr
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
124 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
125
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
126 And again the *Edmonds–Karp Algorithm* with german keywords:
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
127
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
128 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
129 :language: algpseudocode-de
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
130 :lines: 2-
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
131
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
132 More details you will find :ref:`here <details-algpseudocode>`.
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
133
bff8b900713a REFACTOR: All documentation pages refactored: merge intro and details for lexers and filters
Franz Glasner <fzglas.hg@dom66.de>
parents: 165
diff changeset
134
156
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
135 .. _details-algpseudocode:
154
b38d10ab914a Link to the details page for AlgPseudocode
Franz Glasner <fzglas.hg@dom66.de>
parents: 153
diff changeset
136
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
137 Lexer Options
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
138 =============
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
139
160
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
140 .. describe:: prohibit_raiseonerror_filter
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
141
165
88f872c50aae Markup of Python objects in docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
142 **Type:** :py:class:`bool`
160
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
143
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
144 **Default:** `False`
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
145
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
146 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
147 `Sphinx`_ when :py:meth:`Lexer.add_filter` is called.
165
88f872c50aae Markup of Python objects in docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
148
160
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
149 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
150 lexer option `filters`.
b4028838e0c8 Implement lexer option "prohibit_raiseonerror_filter".
Franz Glasner <fzglas.hg@dom66.de>
parents: 159
diff changeset
151
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
152 .. describe:: no_end
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
153
165
88f872c50aae Markup of Python objects in docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
154 **Type:** :py:class:`bool`
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
155
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
156 **Default:** `False`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
157
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
158 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
159 nothing.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
160
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
161 .. describe:: gets
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
162
165
88f872c50aae Markup of Python objects in docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
163 **Type:** :py:class:`str` or :py:obj:`None`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
164
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
165 **Default:** `None` (yields ``←``)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
166
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
167 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
168
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
169 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
170
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
171 .. describe:: remark
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
172
165
88f872c50aae Markup of Python objects in docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 164
diff changeset
173 **Type:** :py:class:`str` or :py:obj:`None`
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
174
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
175 **Default:** `None` (yields ``▷``)
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
176
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
177 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
178 ``\REMARK`` or ``\REM``.
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
179
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
180 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
181 :ref:`customized-sphinx-lexers`.
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
182
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
183
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
184 Comments
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
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
187 - 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
188 - 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
189 - 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
190 - 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
191
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
192 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
193
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
194 /*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
195 * A single multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
196 */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
197
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
198 /*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
199 * A multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
200 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
201 * /* This is a nested multi-line comment */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
202 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
203 */
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
204
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
205 (*
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
206 * A multiline comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
207 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
208 * (* This is a nested multi-line comment *)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
209 *
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
210 *)
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
211
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
212 // A single-line comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
213
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
214 # A single-line comment
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
215
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
216 \REM A remark has a leading symbol
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
217
125
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 Literals
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
220 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
221
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
222 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
223 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
224
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
225 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
226 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
227 :algpseudocode:`f\\'(x) = 0`.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
228
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
229 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
230
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
231 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
232
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
233 "A string with an escaped double-quote \" "
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
234
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
235 'Another string with an escaped single-quote \' '
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
236
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
237 """A multiline
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
238 string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
239 """
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
240
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
241 '''Another multiline string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
242
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
243 '''
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
244
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
245 b"A \x20 byte string"
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
246
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
247 u'An explicit Unicode \u1234 string'
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
248
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
249 \" a non string
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
250
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
251 \' a non string also
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
252
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
253
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
254 (Mathematical) Symbols and Operators
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
255 ====================================
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
256
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
257 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
258 Unicode symbol:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
259
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
260 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
261
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
262 \TEXT{<=>} <=>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
263 \TEXT{<->} <->
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
264 \TEXT{<-} <-
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
265 \TEXT{->} ->
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
266 \TEXT{=>} =>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
267 \TEXT{<=} <=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
268 \TEXT{>=} >=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
269 \TEXT{<>} <>
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
270 \TEXT{!=} !=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
271 \TEXT{:=} :=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
272 \TEXT{=:} =:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
273 \TEXT{?=} ?=
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
274
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
275 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
276 and highlighted accordingly.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
277
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
278
159
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
279 Punctuation
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
280 ===========
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
281
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
282 Runs of dots ``.``, ``..``, ``...``, ``....``, ... are handled
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
283 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
284 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
285
4ee0b1536ea6 Handle runs of dots in expressions (., .., ..., ...., ...)
Franz Glasner <fzglas.hg@dom66.de>
parents: 158
diff changeset
286
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
287 Keywords
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
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
290 Explicit Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
291 -----------------
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 - 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
294 - Case-insensitive
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
295 - 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
296
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
297 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
298
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
299 - 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
300 - 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
301 - 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
302 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
303 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
304
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
305 .. 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
306
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
307 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
308
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
309
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
310 With Required Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
311 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
312
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
313 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
314
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
315 \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
316 \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
317 \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
318 \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
319 \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
320
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
321 \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
322
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
323 \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
324
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
325 \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
326
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
327 \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
328 \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
329
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
330 \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
331 \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
332
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
333 \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
334
142
5df4403f9e18 Reformae the description of the lexer options
Franz Glasner <fzglas.hg@dom66.de>
parents: 127
diff changeset
335 \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
336
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
337 \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
338
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
339 \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
340
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
341 \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
342
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
343
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
344 With Optional Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
345 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
346
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
347 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
348
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
349 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
350
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
351 \TEXT{\ENDPROGRAM \ENDPROG} \ENDPROGRAM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
352 \TEXT{\ENDALGORITHM \ENDALGO} \ENDALGORITHM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
353 \TEXT{\ENDPROCEDURE \ENDPROC} \ENDPROCEDURE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
354 \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
355 \TEXT{\ENDCLASS} \ENDCLASS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
356
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
357 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
358
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
359 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
360
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
361 \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
362
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
363 .. 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
364
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
365
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
366 Without Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
367 ~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
368
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
369 "Normal" Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
370 '''''''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
371
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
372 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
373
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
374 \TEXT{\IF} \IF
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
375 \TEXT{\THEN} \THEN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
376 \TEXT{\ELSE} \ELSE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
377 \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
378 \TEXT{\DO} \DO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
379 \TEXT{\WHILE} \WHILE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
380 \TEXT{\FORALL} \FORALL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
381 \TEXT{\FOR} \FOR
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
382 \TEXT{\FROM} \FROM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
383 \TEXT{\TO} \TO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
384 \TEXT{\STEP} \STEP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
385 \TEXT{\IN} \IN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
386 \TEXT{\LOOP} \LOOP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
387 \TEXT{\REPEAT} \REPEAT
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
388 \TEXT{\UNTIL} \UNTIL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
389
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
390 \TEXT{\RETURN} \RETURN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
391
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
392 \TEXT{\BEGIN} \BEGIN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
393 \TEXT{\END} \END
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
394
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
395 \TEXT{\IS} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
396 \TEXT{\WITH} \WITH
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
397
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
398 \TEXT{\GETS} \GETS
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
399
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
400 \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
401
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
402 ``\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
403 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
404 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
405
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
406
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
407 END-Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
408 ''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
409
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
410 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
411 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
412
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
413 ``\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
414
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
415
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
416 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
417
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
418 \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
419
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
420 \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
421
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
422 \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
423
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
424 \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
425
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
426 \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
427
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
428 \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
429
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
430 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
431
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
432 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
433
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
434 \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
435 \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
436 \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
437 \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
438 \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
439 \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
440 \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
441 \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
442 \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
443 \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
444
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
445
150
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
446 Names and Entities
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
447 ==================
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
448
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
449 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
450 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
451
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
452 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
453 As such, many Unicode characters are allowed.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
454
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
455 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
456 use the ``NAME`` command.
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
457
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
458 .. code-block:: algpseudocode
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
459
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
460 \TEXT{entity_name_1} entity_name_1
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
461
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
462 \TEXT{entity_name_2} entity_name_2
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
463
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
464 \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
465
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
466 \TEXT{München} München
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
467
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
468 \TEXT{Genève} Genève
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
469
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
470 .. _explicit-token-types:
4acf578ae93f Much more details in the documentation
Franz Glasner <fzglas.hg@dom66.de>
parents: 148
diff changeset
471
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
472 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
473 ====================
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
474
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
475 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
476 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
477
156
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
478 `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
479 dict.
123aeb2de8aa Explicitely call all markup with the domain
Franz Glasner <fzglas.hg@dom66.de>
parents: 154
diff changeset
480 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
481 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
482
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
483 ``\\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
484
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
485 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
486
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
487 `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
488 (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
489
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
490 ``\\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
491
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
492 ``\\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
493
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
494 ``\\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
495
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
496 ``\\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
497
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
498 ``\\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
499
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
500 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
501
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
502 `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
503
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
504
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
505 Examples:
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
506
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
507 .. 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
508
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
509 \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
510 \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
511 \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
512 \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
513 \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
514 \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
515 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
516 * 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
517 * 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
518 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
519 \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
520 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
521 * 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
522 * 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
523 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
524 \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
525 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
526 * 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
527 * 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
528 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
529 \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
530
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
531 .. 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
532
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
533
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
534 .. _customized-sphinx-lexers:
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
535
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
536 Customized Lexers in Sphinx
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
537 ===========================
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
538
144
b616f9645e37 More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents: 142
diff changeset
539 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
540 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
541
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
542 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
543 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
544
d475f5e252eb Document an alternate variant to apply options to existing lexers
Franz Glasner <fzglas.hg@dom66.de>
parents: 150
diff changeset
545 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
546 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
547
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
548 .. code-block:: python
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
549
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
550 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
551 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
552
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
553 def setup(app):
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
554
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
555 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
556 # 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
557 # option "no_end".
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
558 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
559 # 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
560 # 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
561 # here.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
562 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
563 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
564 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
565
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
566 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
567
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
568 .. 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
569 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
570 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
571 :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
572
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
573 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
574 :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
575 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
576
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
577 For older Sphinx versions your mileage may vary.