comparison pygments_lexer_pseudocode2/__init__.py @ 26:92576c1b05d9

Use standard regex flags (re.MULTILINE) and use re.IGNORECASE in expressions that really need it
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 21 Apr 2026 01:07:20 +0200
parents 4a33ec6f476a
children bf13850f21fb
comparison
equal deleted inserted replaced
25:4a33ec6f476a 26:92576c1b05d9
32 ''' 32 '''
33 name = 'Pseudocode' 33 name = 'Pseudocode'
34 aliases = ['pseudocode', 'pseudo', 'algorithm', 'algo'] 34 aliases = ['pseudocode', 'pseudo', 'algorithm', 'algo']
35 filenames = ['*.algo', '*.pseudocode'] 35 filenames = ['*.algo', '*.pseudocode']
36 mimetypes = [] 36 mimetypes = []
37 flags = re.IGNORECASE 37 flags = re.MULTILINE
38 38
39 REPLACEMENTS = { 39 REPLACEMENTS = {
40 '<=': '≤', 40 '<=': '≤',
41 '>=': '≥', 41 '>=': '≥',
42 '<>': '≠', 42 '<>': '≠',
74 (r'(\/\/|#).*\n', Comment), 74 (r'(\/\/|#).*\n', Comment),
75 (r'\|', Comment), 75 (r'\|', Comment),
76 (r'\{(.*)\}', scomment), 76 (r'\{(.*)\}', scomment),
77 include('strings'), 77 include('strings'),
78 include('core'), 78 include('core'),
79 (r'[a-zéàùçèÉÀÙÇÈ][a-z0-9éàùçèÉÀÙÇÈ_]*', Name.Variable), 79 (r'(?i)[a-zéàùçèÉÀÙÇÈ][a-z0-9éàùçèÉÀÙÇÈ_]*', Name.Variable),
80 include('numbers'), 80 include('numbers'),
81 (r'[\s]+', Text) 81 (r'[\s]+', Text)
82 ], 82 ],
83 'core': [ # Statements 83 'core': [ # Statements
84 (r'\b(debut|début|fin|si|alors|sinon|fin[_ ]si|tant[ _]que|tantque|fin[ _]tantque|faire|répéter' 84 (r'(?i)\b(debut|début|fin|si|alors|sinon|fin[_ ]si|tant[ _]que|tantque|fin[ _]tantque|faire|répéter'
85 r'repeter|type|structure|fin[ _]structure|fonction|procédure|procedure|retourner|renvoyer|' 85 r'repeter|type|structure|fin[ _]structure|fonction|procédure|procedure|retourner|renvoyer|'
86 r'pour|fin[ _]pour|à|déclarations?|juqsque|spécialise|specialise|comporte|super|public|privé|protégé|' 86 r'pour|fin[ _]pour|à|déclarations?|juqsque|spécialise|specialise|comporte|super|public|privé|protégé|'
87 r'classe' 87 r'classe'
88 r')\s*\b', Keyword), 88 r')\s*\b', Keyword),
89 89
90 # Data Types 90 # Data Types
91 (r'\b(entiers?|chaines?|chaînes?|réels?|reels?|caractères?|caracteres?|booléens?|' 91 (r'(?i)\b(entiers?|chaines?|chaînes?|réels?|reels?|caractères?|caracteres?|booléens?|'
92 r'booleens?|tableaux?|rien)\s*\b', 92 r'booleens?|tableaux?|rien)\s*\b',
93 Keyword.Type), 93 Keyword.Type),
94 94
95 (r'\b(vrai|faux|nil)\s*\b', 95 (r'(?i)\b(vrai|faux|nil)\s*\b',
96 Name.Constant), 96 Name.Constant),
97 97
98 # Operators 98 # Operators
99 (r'(<->|<=>|<=|>=|<>|!=|<-|->|=>|\^|\*|\+|-|\/|<|>|=|\\\\|mod|←|↑|≤|≥|≠|÷|×|\.\.|\[|\]|\.|non|xou|et|ou)', 99 (r'(?i)(<->|<=>|<=|>=|<>|!=|<-|->|=>|\^|\*|\+|-|\/|<|>|=|\\\\|mod|←|↑|≤|≥|≠|÷|×|\.\.|\[|\]|\.|non|xou|et|ou)',
100 op_replace), 100 op_replace),
101 101
102 (r'(\(|\)|\,|\;|:)', 102 (r'(\(|\)|\,|\;|:)',
103 Punctuation), 103 Punctuation),
104 104
105 #(r'\b(\[(VE|VS|VE/S)\])\s*\b', 105 #(r'\b(\[(VE|VS|VE/S)\])\s*\b',
106 # Keyword.Declaration), 106 # Keyword.Declaration),
107 107
108 # Intrinsics 108 # Intrinsics
109 (r'\b(sqrt|pow|cos|sin|tan|arccos|arcsin|arctan|arctan2|lire|ecrire|écrire|' 109 (r'(?i)\b(sqrt|pow|cos|sin|tan|arccos|arcsin|arctan|arctan2|lire|ecrire|écrire|'
110 r'exp|ln|log|détruire|detruire' 110 r'exp|ln|log|détruire|detruire'
111 r')\s*\b', Name.Builtin) 111 r')\s*\b', Name.Builtin)
112 ], 112 ],
113 113
114 'strings': [ 114 'strings': [