Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
annotate docs/intro.rst @ 144:b616f9645e37
More referencing with internal and external links
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 07 May 2026 12:21:53 +0200 |
| parents | acd9073cbbe3 |
| children | df9b4962c203 |
| rev | line source |
|---|---|
|
86
0c05dc09c9e2
Customize documentation index and prepare for a "Details" documentation page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
45
diff
changeset
|
1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*- |
|
0c05dc09c9e2
Customize documentation index and prepare for a "Details" documentation page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
45
diff
changeset
|
2 |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 |
|
140
e424fcdd472f
REFACTOR: Change the structure of the documentation: make the README the first page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
138
diff
changeset
|
4 Introduction |
|
e424fcdd472f
REFACTOR: Change the structure of the documentation: make the README the first page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
138
diff
changeset
|
5 ============ |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
6 |
|
141
acd9073cbbe3
Make a lexerlist.rst that contains the table of the lexers because it is used at least twice
Franz Glasner <fzglas.hg@dom66.de>
parents:
140
diff
changeset
|
7 The package contains the following lexers: |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
8 |
|
141
acd9073cbbe3
Make a lexerlist.rst that contains the table of the lexers because it is used at least twice
Franz Glasner <fzglas.hg@dom66.de>
parents:
140
diff
changeset
|
9 .. include:: lexerlist.rst |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
10 |
|
144
b616f9645e37
More referencing with internal and external links
Franz Glasner <fzglas.hg@dom66.de>
parents:
141
diff
changeset
|
11 They may be used in `Sphinx`_ by their aliases: |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
12 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
13 .. code-block:: none |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
14 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
15 .. code-block:: algpseudocode |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
16 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
17 \PROGRAM {The Pseudoprogram} \IS |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
18 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
19 \END PROGRAM {The Pseudoprogram} |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
20 |
|
140
e424fcdd472f
REFACTOR: Change the structure of the documentation: make the README the first page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
138
diff
changeset
|
21 It will be rendered as: |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
22 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
23 .. code-block:: algpseudocode |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
24 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
25 \PROGRAM {The Pseudoprogram} \IS |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
26 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
27 \END PROGRAM {The Pseudoprogram} |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
28 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
29 And the same with the german variant: |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
30 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
31 .. code-block:: algpseudocode-de |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
32 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
33 \PROGRAM {The Pseudoprogram} \IS |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
34 |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
35 \END PROGRAM {The Pseudoprogram} |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
36 |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
37 Expressions: |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
38 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
39 - Strings (single-quote, double-quote, triple-single-quote, triple-double-quote) |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
40 - Numbers (Python style) |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
41 - ``\TEXT{...}`` |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
42 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
43 The curly brace can be quoted with ``\}`` to not end the text mode |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
44 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
45 - Names (`Name.Entity`) |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
46 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
47 .. literalinclude:: example-1.pseudocode |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
48 :language: algpseudocode |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
49 :lines: 2- |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
50 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
51 With a customized `AlgPseudocodeLexer` and its `no_end` |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
52 option set to ``True``. |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
53 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
54 .. literalinclude:: example-1.pseudocode |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
55 :language: NoEndAlgPseudocode |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
56 :lines: 2- |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
57 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
58 Python: |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
59 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
60 .. code-block:: python |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
61 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
62 class HUHU: |
|
86
0c05dc09c9e2
Customize documentation index and prepare for a "Details" documentation page.
Franz Glasner <fzglas.hg@dom66.de>
parents:
45
diff
changeset
|
63 |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
64 # This is a comment |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
65 @classmethod |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
66 def method1(cls_, aparam1, param2): |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
67 return aparam1 + param2 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
68 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
69 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
70 This is Wikipedia's description of *Dinic's Algorithm* |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
71 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm): |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
72 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
73 .. literalinclude:: algorithm-dinic.description |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
74 :language: algpseudocode |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
75 :lines: 2- |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
76 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
77 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm* |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
78 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm): |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
79 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
80 .. literalinclude:: algorithm-ford-fulkerson.pseudocode |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
81 :language: algpseudocode |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
82 :lines: 2- |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
83 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
84 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm* |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
85 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm): |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
86 |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
87 .. literalinclude:: algorithm-edmonds-karp.pseudocode |
|
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
88 :language: NoEndAlgPseudocode |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
89 :lines: 2- |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
90 |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
91 And now the *Edmonds–Karp Algorithm* with french keywords: |
|
107
1c1985532139
A couple of real pseudocode examples.
Franz Glasner <fzglas.hg@dom66.de>
parents:
86
diff
changeset
|
92 |
|
125
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
93 .. literalinclude:: algorithm-edmonds-karp.pseudocode |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
94 :language: algpseudocode-fr |
|
3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents:
107
diff
changeset
|
95 :lines: 2- |
