annotate pygments_lexer_pseudocode2/algpseudocode.py @ 64:05c53e431c88

Simplify case-handling for "BLOCK" and "REMARK"
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 28 Apr 2026 12:40:02 +0200
parents 7153e945a3d6
children 3f4223a79d2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
1
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
3 # :-
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
4 # SPDX-FileCopyrightText: © 2026 Franz Glasner
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
5 # SPDX-License-Identifier: MIT
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
6 # :-
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
7 r"""A pseudocode lexer along the lines of CTAN's algpseudocode or
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
8 algpseudocodex.
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
9
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
10 """
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
11
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
12 __all__ = ["AlgPseudocodeLexer",
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
13 "AlgPseudocodeLexer_DE", "AlgPseudocodeLexer_FR"]
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
14
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
15
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
16 import re
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
17
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
18 import pygments.util
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
19 from pygments.lexer import include, bygroups
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
20 from pygments.token import (Comment, Keyword, Name, Text, Whitespace)
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
21
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
22 #
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23 # Relative imports do not work with pygments.lexers.load_lexer_from_file()
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
24 # in all of our supported Python releases.
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25 #
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26 from pygments_lexer_pseudocode2.bases import LexBase
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
27
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
28
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
29 class AlgPseudocodeLexer(LexBase):
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
30
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
31 """A pseudocode lexer along the lines of CTAN's algpseudocode or
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
32 algpseudocodex.
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
33
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
34 Some ideas (e.g. strings) are borrowed from Pygment's Python lexer.
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
35
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
36 """
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
37
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
38 name = "AlgPseudocode"
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
39 aliases = ["algpseudocode", "algpseudo"]
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
40 filenames = ["*.algpseudo", "*.algpseudocode"]
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
41 mimetypes = []
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
42 flags = re.MULTILINE
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
43
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
44 LANG = "en"
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
45 TRANSLATIONS = {
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
46 "PROG": "PROGRAM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
47 "PROGRAM": "PROGRAM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
48 "ALGO": "ALGORITHM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
49 "ALGORITHM": "ALGORITHM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
50 "PROC": "PROCEDURE",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
51 "PROCEDURE": "PROCEDURE",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
52 "FUNC": "FUNCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
53 "FUNCTION": "FUNCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
54 "FN": "FUNCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
55 "CLASS": "CLASS",
61
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
56 "IS": "IS",
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
57 }
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
58 END_TRANSLATIONS = {
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
59 "PROG": "END OF PROGRAM",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
60 "PROGRAM": "END OF PROGRAM",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
61 "ALGO": "END OF ALGORITHM",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
62 "ALGORITHM": "END OF ALGORITHM",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
63 "PROC": "END OF PROCEDURE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
64 "PROCEDURE": "END OF PROCEDURE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
65 "FUNC": "END OF FUNCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
66 "FUNCTION": "END OF FUNCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
67 "FN": "END OF FUNCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
68 "CLASS": "END OF CLASS",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
69 }
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
70 DEFAULT_END_PREFIX = "END OF "
58
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
71 SYMBOL_REMARK = "▷" # U+25B7: Unicode 1.0 (Geometric Shapes)
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
72 # SYMBOL_REMARK = "▻" # U+25BB: Unicode 1.0 (Geometric Shapes)
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
73 SYMBOL_BLOCK = "◆" # U+25C6: Unicode 1.0 (Geometric Shapes)
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
74 # SYMBOL_BLOCK = "┃" # U+2503: Unicode 1.0 (Bow Drawing)
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
75 # SYMBOL_BLOCK = "●" # U+25CF: Unicode 1.0 (Geometric Shapes)
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
76 SYMBOL_TEXTSTATEMENT = "■" # U+25A0: Unicode 1.0 (Geometric Shapes)
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
77 SYMBOLS = {
58
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
78 "REMARK": SYMBOL_REMARK,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
79 "REM": SYMBOL_REMARK,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
80 "BLOCK": SYMBOL_BLOCK,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
81 "TEXTSTATEMENT": SYMBOL_TEXTSTATEMENT,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
82 "TSTATEMENT": SYMBOL_TEXTSTATEMENT,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
83 "TSTATE": SYMBOL_TEXTSTATEMENT,
be065e5c8042 Prepare symbols for a statement which defaults to token type "Text".
Franz Glasner <fzglas.hg@dom66.de>
parents: 57
diff changeset
84 "TEXT": SYMBOL_TEXTSTATEMENT,
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
85 }
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
86
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
87 def op_translate(toktype):
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
88
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
89 def _op_translate(lexer, match, ctx=None):
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
90 kw = match.group().upper()
38
69522d4cafac Remove another unneeded local variable
Franz Glasner <fzglas.hg@dom66.de>
parents: 35
diff changeset
91 yield match.start(), toktype, lexer.TRANSLATIONS.get(kw, kw)
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
92
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
93 return _op_translate
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
94
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
95 def op_opt_end_translate(toktype):
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
96
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
97 def _op_end_translate(lexer, match, ctx=None):
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
98 if not lexer.no_end:
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
99 kw = match.group().upper()
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
100 yield (match.start(),
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
101 toktype,
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
102 lexer.END_TRANSLATIONS.get(
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
103 kw,
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
104 lexer.DEFAULT_END_PREFIX + kw))
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
105
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
106 return _op_end_translate
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
107
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
108 def op_opt_ignore(toktype):
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
109
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
110 def _op_opt_ignore(lexer, match, ctx=None):
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
111 if not lexer.no_end:
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
112 yield match.start(), toktype, match.group()
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
113
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
114 return _op_opt_ignore
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
115
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
116 def op_symbol(toktype):
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
117
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
118 def _op_symbol(lexer, match, ctx=None):
64
05c53e431c88 Simplify case-handling for "BLOCK" and "REMARK"
Franz Glasner <fzglas.hg@dom66.de>
parents: 62
diff changeset
119 kw = match.group().upper()
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
120 yield match.start(), toktype, lexer.SYMBOLS.get(kw, kw)
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
121
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
122 return _op_symbol
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
123
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
124 tokens = {
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
125 "root": [
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
126 (r"\n", Whitespace),
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
127 (r"/\*", Comment.Multiline, "multiline-nested-comment"),
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
128 (r"//.*$", Comment.Single),
64
05c53e431c88 Simplify case-handling for "BLOCK" and "REMARK"
Franz Glasner <fzglas.hg@dom66.de>
parents: 62
diff changeset
129 (r"(?i)\\(remark|rem)\b(.*)$",
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
130 bygroups(op_symbol(Comment.Single), Comment.Single)),
64
05c53e431c88 Simplify case-handling for "BLOCK" and "REMARK"
Franz Glasner <fzglas.hg@dom66.de>
parents: 62
diff changeset
131 (r"(?i)\\(block)\b(.*)$",
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
132 bygroups(op_symbol(Text), Text)),
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
133 (r"\\\n", Text),
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
134 (r"(?i)\\("
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
135 r"(?:prog(?:ram)?)"
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
136 r"|(?:algo(?:rithm)?)"
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
137 r"|(?:proc(?:edure)?)"
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
138 r"|(?:func(?:tion)?|(?:fn))"
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
139 r"|(?:class)"
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
140 r")(\s*)(\{)",
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
141 bygroups(op_translate(Keyword), Whitespace, LexBase.op_ignore),
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
142 "entity-name"),
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
143 # ENDxxx keywords with optional entity name
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
144 # with name
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
145 (r"(?i)\\end(?:_|-)?("
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
146 r"(?:prog(?:ram)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
147 r"|(?:algo(?:rithm)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
148 r"|(?:proc(?:edure)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
149 r"|(?:func(?:tion)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
150 r"|(?:class)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
151 r")(\s*)(\{)",
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
152 bygroups(op_opt_end_translate(Keyword),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
153 op_opt_ignore(Whitespace),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
154 LexBase.op_ignore),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
155 "entity-name-end"),
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
156 # without name
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
157 (r"(?i)\\end(?:_|-)?("
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
158 r"(?:prog(?:ram)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
159 r"|(?:algo(?:rithm)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
160 r"|(?:proc(?:edure)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
161 r"|(?:func(?:tion)?)"
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
162 r"|(?:class)"
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
163 r")\b",
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
164 bygroups(op_opt_end_translate(Keyword))),
61
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
165 # Keywords
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
166 (r"(?i)\\("
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
167 r"(?:is)"
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
168 r")\b",
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
169 bygroups(op_translate(Keyword))),
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
170 include("expr"),
52
5bfa9113d3c4 First tests with "py-name": names from the Python lexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 41
diff changeset
171 (r"\s+", Text),
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
172 ],
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
173 "entity-name": [ # may be multiline
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
174 (r"[^\\}]+", Name.Entity),
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
175 (r"\\\}", Name.Entity),
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
176 (r"\\", Name.Entity),
62
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
177 (r"\}", LexBase.op_ignore, "#pop"),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
178 ],
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
179 "entity-name-end": [ # may be multiline -- suppressed if no_end
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
180 (r"[^\\}]+", op_opt_ignore(Name.Entity)),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
181 (r"\\\}", op_opt_ignore(Name.Entity)),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
182 (r"\\", op_opt_ignore(Name.Entity)),
7153e945a3d6 Implement ignoring of \ENDxxx including its optional name parts
Franz Glasner <fzglas.hg@dom66.de>
parents: 61
diff changeset
183 (r"\}", LexBase.op_ignore, "#pop"),
40
df08226a6984 Names for some entities (program, algorithm, function, procedure, class).
Franz Glasner <fzglas.hg@dom66.de>
parents: 39
diff changeset
184 ],
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
185 "expr": [
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
186 include("py-strings"),
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
187 include("py-numbers"),
52
5bfa9113d3c4 First tests with "py-name": names from the Python lexer
Franz Glasner <fzglas.hg@dom66.de>
parents: 41
diff changeset
188 include("py-name"),
34
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
189 ]
1f741934205e Begin a new Pseudocode lexer using numbers and strings from Python
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
190 }
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
191
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
192 def __init__(self, **options):
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
193 val = pygments.util.get_bool_opt(options, "no_end", default=False)
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
194 self.no_end = val
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
195 LexBase.__init__(self, **options)
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
196
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
197
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
198 class AlgPseudocodeLexer_DE(AlgPseudocodeLexer):
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
199
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
200 name = "AlgPseudocodeDE"
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
201 aliases = ["algpseudocode-de", "algpseudo-de"]
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
202 filenames = ["*.algpseudo-de", "*.algpseudocode-de"]
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
203
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
204 LANG = "de"
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
205 TRANSLATIONS = AlgPseudocodeLexer.TRANSLATIONS.copy()
41
4ccf9a8d0bf2 For the german and french PseudocodeLexer: Use en translations as fallback.
Franz Glasner <fzglas.hg@dom66.de>
parents: 40
diff changeset
206 TRANSLATIONS.update({
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
207 "PROG": "PROGRAMM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
208 "PROGRAM": "PROGRAMM",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
209 "ALGO": "ALGORITHMUS",
39
a3151d837258 Some basic keywords for programs, algorithms, procedures and functions; also comments (single and multiline) and "remarks"
Franz Glasner <fzglas.hg@dom66.de>
parents: 38
diff changeset
210 "ALGORITHM": "ALGORITHMUS",
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
211 "PROC": "PROZEDUR",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
212 "PROCEDURE": "PROZEDUR",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
213 "FUNC": "FUNKTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
214 "FUNCTION": "FUNKTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
215 "FN": "FUNKTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
216 "CLASS": "KLASSE",
61
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
217 "IS": "IST",
41
4ccf9a8d0bf2 For the german and french PseudocodeLexer: Use en translations as fallback.
Franz Glasner <fzglas.hg@dom66.de>
parents: 40
diff changeset
218 })
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
219 END_TRANSLATIONS = AlgPseudocodeLexer.END_TRANSLATIONS.copy()
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
220 END_TRANSLATIONS.update({
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
221 "PROG": "ENDE DES PROGRAMMS",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
222 "PROGRAM": "ENDE VON PROGRAMMS",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
223 "ALGO": "ENDE DES ALGORITHMUS",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
224 "ALGORITHM": "ENDE DES ALGORITHMUS",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
225 "PROC": "ENDE DER PROZEDUR",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
226 "PROCEDURE": "ENDE DER PROZEDUR",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
227 "FUNC": "ENDE DER FUNKTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
228 "FUNCTION": "ENDE DER FUNKTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
229 "FN": "ENDE DER FUNKTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
230 "CLASS": "ENDE DER KLASSE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
231 })
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
232 DEFAULT_END_PREFIX = "ENDE VON "
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
233
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
234
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
235 class AlgPseudocodeLexer_FR(AlgPseudocodeLexer):
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
236
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
237 name = "AlgPseudocodeFR"
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
238 aliases = ["algpseudocode-fr", "algpseudo-fr"]
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
239 filenames = ["*.algpseudo-fr", "*.algpseudocode-fr"]
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
240
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
241 LANG = "de"
53
39151225fb84 Rename the new pseudocode implementation to AlgPseudocode.
Franz Glasner <fzglas.hg@dom66.de>
parents: 52
diff changeset
242 TRANSLATIONS = AlgPseudocodeLexer.TRANSLATIONS.copy()
41
4ccf9a8d0bf2 For the german and french PseudocodeLexer: Use en translations as fallback.
Franz Glasner <fzglas.hg@dom66.de>
parents: 40
diff changeset
243 TRANSLATIONS.update({
35
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
244 "PROG": "PROGRAMME",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
245 "PROGRAM": "PROGRAMME",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
246 "ALGO": "ALGORITHME",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
247 "ALGORITHM": "ALGORITHME",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
248 "PROC": "PROCÉDURE",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
249 "PROCEDURE": "PROCÉDURE",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
250 "FUNC": "FONCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
251 "FUNCTION": "FOUNCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
252 "FN": "FONCTION",
d9a3551a1038 Basics of translating some keywords
Franz Glasner <fzglas.hg@dom66.de>
parents: 34
diff changeset
253 "CLASS": "CLASSE",
61
392745b66969 The "\IS" keyword expansion
Franz Glasner <fzglas.hg@dom66.de>
parents: 58
diff changeset
254 "IS": "EST",
41
4ccf9a8d0bf2 For the german and french PseudocodeLexer: Use en translations as fallback.
Franz Glasner <fzglas.hg@dom66.de>
parents: 40
diff changeset
255 })
57
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
256 END_TRANSLATIONS = AlgPseudocodeLexer.END_TRANSLATIONS.copy()
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
257 END_TRANSLATIONS.update({
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
258 "PROG": "FIN DE PROGRAMME",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
259 "PROGRAM": "FIN DE PROGRAMME",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
260 "ALGO": "FIN D'ALGORITHME",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
261 "ALGORITHM": "FIN D'ALGORITHME",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
262 "PROC": "FIN DE PROCÉDURE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
263 "PROCEDURE": "FIN DE PROCÉDURE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
264 "FUNC": "FIN DE FONCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
265 "FUNCTION": "FIN DE FOUNCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
266 "FN": "FIN DE FONCTION",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
267 "CLASS": "FIN DE CLASSE",
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
268 })
e8f4af9e20a8 Some "ENDxxx" commands
Franz Glasner <fzglas.hg@dom66.de>
parents: 53
diff changeset
269 DEFAULT_END_PREFIX = "FIN DE "