annotate docs/details-algpseudocode.rst @ 127:4d55475d61a3

Make the details of the AlgPseudocodeLexer part of the "Details" docs
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 06 May 2026 17:04:58 +0200
parents e91c9dcbeb77
children 5df4403f9e18
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
127
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
4 ***************
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
5 AlgPseudocode
4d55475d61a3 Make the details of the AlgPseudocodeLexer part of the "Details" docs
Franz Glasner <fzglas.hg@dom66.de>
parents: 126
diff changeset
6 ***************
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
7
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
8 .. role:: algpseudocode(code)
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
9 :language: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
10
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
11
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
12 Lexer Options
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
13 =============
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
14
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
15 `no_end`
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
16
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
17 Default: ``False``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
18
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
19 If ``True`` all the ``ENDxxx`` commands will be skipped and yield nothing.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
20
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
21 `gets`
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
22
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
23 Default: ``←``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
24
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
25 The operator symbol to be printed by the command ``\GETS``.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
26
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
27 Often used alternative: ``:=``.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
28
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
29 `remark`
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
30
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
31 Default: ``▷``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
32
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
33 The symbol to be printed as when starting comments with ``\REMARK`` or ``\REM``
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
34
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
35
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
36 Comments
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
37 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
38
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
39 - with the ``\REMARK`` or ``\REM`` keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
40 - 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
41 - 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
42 - 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
43
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
44
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
45 Literals
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
46 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
47
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
48 Strings and numbers as in `Python <https://www.python.org>`_.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
49
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
50 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
51 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
52 :algpseudocode:`f\\'(x) = 0`.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
53
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
54
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
55 Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
56 ========
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
57
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
58 Explicit Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
59 -----------------
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
60
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
61 - 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
62 - Case-insensitive
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
63 - 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
64
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
65 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
66
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
67 - 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
68 - 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
69 - 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
70 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
71 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
72
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
73
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
74 With Required Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
75 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
76
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
77 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
78
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
79 \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
80 \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
81 \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
82 \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
83 \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
84
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
85 \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
86
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
87 \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
88
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
89 \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
90
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
91 \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
92 \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
93
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
94 \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
95 \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
96
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
97 \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
98
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
99 \TEXT{\REQUIRE{Whatever should be required.\}} \REQUIRE{Whatever should be required.}
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
100
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
101 \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
102
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
103 \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
104
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
105
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
106 With Optional Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
107 ~~~~~~~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
108
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
109 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
110
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
111 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
112
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
113 \TEXT{\ENDPROGRAM \ENDPROG} \ENDPROGRAM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
114 \TEXT{\ENDALGORITHM \ENDALGO} \ENDALGORITHM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
115 \TEXT{\ENDPROCEDURE \ENDPROC} \ENDPROCEDURE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
116 \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
117 \TEXT{\ENDCLASS} \ENDCLASS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
118
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
119 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
120
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
121 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
122
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
123 \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
124
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
125 .. 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
126
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
127
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
128 Without Parameters
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
129 ~~~~~~~~~~~~~~~~~~
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
130
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
131 "Normal" Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
132 '''''''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
133
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
134 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
135
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
136 \TEXT{\IF} \IF
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
137 \TEXT{\THEN} \THEN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
138 \TEXT{\ELSE} \ELSE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
139 \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
140 \TEXT{\DO} \DO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
141 \TEXT{\WHILE} \WHILE
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
142 \TEXT{\FORALL} \FORALL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
143 \TEXT{\FOR} \FOR
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
144 \TEXT{\FROM} \FROM
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
145 \TEXT{\TO} \TO
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
146 \TEXT{\STEP} \STEP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
147 \TEXT{\IN} \IN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
148 \TEXT{\LOOP} \LOOP
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
149 \TEXT{\REPEAT} \REPEAT
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
150 \TEXT{\UNTIL} \UNTIL
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
151
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
152 \TEXT{\RETURN} \RETURN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
153
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
154 \TEXT{\BEGIN} \BEGIN
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
155 \TEXT{\END} \END
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
156
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
157 \TEXT{\IS} \IS
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
158 \TEXT{\WITH} \WITH
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
159
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
160 \TEXT{\\REMARK or \\REM} \REMARK A comment with a sigil
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
161
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
162 ``\REMARK`` or ``\REM`` is special: all characters to the end of the
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
163 line are taken as comment; curly braces are not needed -- in fact:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
164 they are interpreted as part of the comment.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
165
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
166
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
167 END-Keywords
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
168 ''''''''''''
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
169
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
170 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
171 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
172
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
173 ``\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
174
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
175
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
176 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
177
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
178 \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
179
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
180 \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
181
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
182 \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
183
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
184 \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
185
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
186 \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
187
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
188 \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
189
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
190 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
191
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
192 .. code-block:: algpseudocode
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
193
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
194 \text{\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
195 \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
196 \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
197 \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
198 \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
199 \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
200 \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
201 \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
202 \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
203 \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
204
88
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
205
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
206 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
207 ====================
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
208
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
209 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
210 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
211
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
212 `XX` represents a value in the :mod:`pygments.token.STANDARD_TYPES` dict.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
213 Its corresponding token type (the associated `key` in this `dict`) is used as
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
214 token type.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
215
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
216 ``\\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
217
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
218 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
219
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
220 `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
221 (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
222
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
223 ``\\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
224
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
225 ``\\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
226
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
227 ``\\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
228
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
229 ``\\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
230
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
231 ``\\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
232
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
233 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
234
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
235 `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
236
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
237
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
238 Examples:
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
239
125
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
240 .. 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
241
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
242 \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
243 \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
244 \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
245 \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
246 \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
247 \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
248 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
249 * The line below has ∈_∌ as (peculiar) function name.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
250 * Their params are automatic.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
251 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
252 \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
253 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
254 * The line below has ∈_∌ as (peculiar) decorator name (as used in Python).
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
255 * Their params are automatic.
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
256 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
257 \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
258 /*
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
259 * 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
260 * 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
261 */
03e9031b5eca Some details and examples about \tt-XXX and \ttx-XXX in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
262 \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
263
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
264 .. 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
265
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
266
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
267 Customized Lexers in Sphinx
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
268 ===========================
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
269
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
270 Defining lexers with non-default options in Sphinx can be done in its
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
271 configuration file :file:`conf.py`:
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
272
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
273 .. code-block:: python
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
274
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
275 from functools import partial
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
276 from pygments_lexer_pseudocode2.algpseudocode import AlgPseudocodeLexer
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
277
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
278 def setup(app):
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
279
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
280 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
281 # 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
282 # option "no_end".
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
283 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
284 # 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
285 # 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
286 # here.
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
287 #
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
288 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
289 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
290
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
291 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
292
3629bf09b30d Much more documentation including most details of the AlgPseudocodeLexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 88
diff changeset
293 For older Sphinx versions your mileage may vary.