Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison pygments_lexer_pseudocode2/algpseudocode.py @ 78:abb2e8c65d0f
Implement "TEXTSTATEMENT"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 30 Apr 2026 09:28:39 +0200 |
| parents | 1a5e192aa950 |
| children | f487f0d322a5 |
comparison
equal
deleted
inserted
replaced
| 77:1a5e192aa950 | 78:abb2e8c65d0f |
|---|---|
| 84 "STATEMENT": SYMBOL_BLOCK, | 84 "STATEMENT": SYMBOL_BLOCK, |
| 85 "STATE": SYMBOL_BLOCK, | 85 "STATE": SYMBOL_BLOCK, |
| 86 "BLOCK": SYMBOL_BLOCK, | 86 "BLOCK": SYMBOL_BLOCK, |
| 87 # Group TEXTSTATEMENT | 87 # Group TEXTSTATEMENT |
| 88 "TEXTSTATEMENT": SYMBOL_TEXTSTATEMENT, | 88 "TEXTSTATEMENT": SYMBOL_TEXTSTATEMENT, |
| 89 "TEXTSTATE": SYMBOL_TEXTSTATEMENT, | |
| 89 "TSTATEMENT": SYMBOL_TEXTSTATEMENT, | 90 "TSTATEMENT": SYMBOL_TEXTSTATEMENT, |
| 90 "TSTATE": SYMBOL_TEXTSTATEMENT, | 91 "TSTATE": SYMBOL_TEXTSTATEMENT, |
| 91 "TEXTBLOCK": SYMBOL_TEXTSTATEMENT, | 92 "TEXTBLOCK": SYMBOL_TEXTSTATEMENT, |
| 92 "TBLOCK": SYMBOL_TEXTSTATEMENT, | 93 "TBLOCK": SYMBOL_TEXTSTATEMENT, |
| 93 } | 94 } |
| 148 (r"//.*$", Comment.Single), | 149 (r"//.*$", Comment.Single), |
| 149 include("remark"), | 150 include("remark"), |
| 150 (r"(?i)\\(block|state(?:ment)?)\s*(\{)", | 151 (r"(?i)\\(block|state(?:ment)?)\s*(\{)", |
| 151 bygroups(op_symbol(Text), LexBase.op_fixed(Whitespace, " ")), | 152 bygroups(op_symbol(Text), LexBase.op_fixed(Whitespace, " ")), |
| 152 "block-expr"), | 153 "block-expr"), |
| 154 (r"(?i)\\(" | |
| 155 r"(?:textstate(?:ment)?)" | |
| 156 r"|(?:tstate(?:ment)?)" | |
| 157 r"|(?:textblock)" | |
| 158 r"|(?:tblock)" | |
| 159 r")\s*(\{)", | |
| 160 bygroups(op_symbol(Text), LexBase.op_fixed(Whitespace, " ")), | |
| 161 "text-statement"), | |
| 153 (r"\\\n", Text), | 162 (r"\\\n", Text), |
| 154 (r"(?i)\\(" | 163 (r"(?i)\\(" |
| 155 r"(?:prog(?:ram)?)" | 164 r"(?:prog(?:ram)?)" |
| 156 r"|(?:algo(?:rithm)?)" | 165 r"|(?:algo(?:rithm)?)" |
| 157 r"|(?:proc(?:edure)?)" | 166 r"|(?:proc(?:edure)?)" |
| 224 include("expr-in-braces"), | 233 include("expr-in-braces"), |
| 225 (r"\\\\", LexBase.op_fixed(Text, "\\")), | 234 (r"\\\\", LexBase.op_fixed(Text, "\\")), |
| 226 (r"\\", LexBase.op_fixed(Text, "\\")), | 235 (r"\\", LexBase.op_fixed(Text, "\\")), |
| 227 (r"\s+", Text), | 236 (r"\s+", Text), |
| 228 ], | 237 ], |
| 238 "text-statement": [ # like block but default to text-mode | |
| 239 (r"[^\\}\n]+", Text), | |
| 240 (r"\}", LexBase.op_ignore, "#pop"), | |
| 241 (r"\n", Whitespace), | |
| 242 (r"\\\}", LexBase.op_fixed(Text, "}")), | |
| 243 (r"(?i)\\expr(?:ession)?\s*\{", | |
| 244 LexBase.op_ignore, | |
| 245 "block-expr"), | |
| 246 include("remark"), | |
| 247 (r"\\\\", LexBase.op_fixed(Text, "\\")), | |
| 248 (r"\\", LexBase.op_fixed(Text, "\\")), | |
| 249 ], | |
| 229 "expr-in-braces": [ | 250 "expr-in-braces": [ |
| 230 include("punctuation-in-braces"), | 251 include("punctuation-in-braces"), |
| 231 include("py-strings"), | 252 include("py-strings"), |
| 232 include("py-numbers"), | 253 include("py-numbers"), |
| 233 (r"(?i)\\text\s*\{", LexBase.op_ignore, "text-in-expr"), | 254 (r"(?i)\\text\s*\{", LexBase.op_ignore, "text-in-expr"), |
| 239 "text-in-expr": [ | 260 "text-in-expr": [ |
| 240 (r"[^\\}\n]+", Text), | 261 (r"[^\\}\n]+", Text), |
| 241 (r"\}", LexBase.op_ignore, "#pop"), | 262 (r"\}", LexBase.op_ignore, "#pop"), |
| 242 (r"\n", Whitespace), | 263 (r"\n", Whitespace), |
| 243 (r"\\\}", LexBase.op_fixed(Text, "}")), | 264 (r"\\\}", LexBase.op_fixed(Text, "}")), |
| 265 (r"(?:i)\\(expr(?:ession)?)\s*(\{)", | |
| 266 bygroups(LexBase.op_ignore, LexBase.op_ignore), | |
| 267 "expr-in-braces"), | |
| 268 (r"\\\\", LexBase.op_fixed(Text, "\\")), | |
| 244 (r"\\", LexBase.op_fixed(Text, "\\")), | 269 (r"\\", LexBase.op_fixed(Text, "\\")), |
| 245 ], | 270 ], |
| 246 "math-builtins": [ | 271 "math-builtins": [ |
| 247 (words(("sqrt", "pow", "cos", "sin", "tan", "arcos", "arcsin", | 272 (words(("sqrt", "pow", "cos", "sin", "tan", "arcos", "arcsin", |
| 248 "arctan", "arctan2", "mod", "exp", "ln", "log"), | 273 "arctan", "arctan2", "mod", "exp", "ln", "log"), |
