comparison pygments_lexer_pseudocode2/lexers/algpseudocode.py @ 212:18553f595b34

Allow nested \TEXT and \EXPR commands. \TEXT within \TEXT and \EXPR within \EXPR is allowed!
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 14 May 2026 07:30:38 +0200
parents 33a722c8ae17
children f365d9d2c0ad
comparison
equal deleted inserted replaced
211:33a722c8ae17 212:18553f595b34
363 include("py-strings"), 363 include("py-strings"),
364 include("py-numbers"), 364 include("py-numbers"),
365 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"), 365 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"),
366 (r"(?i)\\gets\b", op_gets), 366 (r"(?i)\\gets\b", op_gets),
367 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-statement"), 367 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-statement"),
368 (r"(?i)\\expr(?:ession)?[ \t]*\{",
369 LexBase.op_ignore,
370 "block-expr"),
368 include("explicit-tokentype"), 371 include("explicit-tokentype"),
369 include("remark"), 372 include("remark"),
370 include("keyword-constants"), 373 include("keyword-constants"),
371 include("word-operators"), 374 include("word-operators"),
372 include("math-builtins"), 375 include("math-builtins"),
380 include("py-strings"), 383 include("py-strings"),
381 include("py-numbers"), 384 include("py-numbers"),
382 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"), 385 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"),
383 (r"(?i)\\gets\b", op_gets), 386 (r"(?i)\\gets\b", op_gets),
384 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-statement"), 387 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-statement"),
388 (r"(?i)\\expr(?:ession)?[ \t]*\{",
389 LexBase.op_ignore,
390 "block-expr"),
385 include("explicit-tokentype"), 391 include("explicit-tokentype"),
386 include("remark"), 392 include("remark"),
387 include("keyword-constants"), 393 include("keyword-constants"),
388 include("word-operators"), 394 include("word-operators"),
389 include("math-builtins"), 395 include("math-builtins"),
406 (r"\n", Whitespace), 412 (r"\n", Whitespace),
407 (r"\\\}", LexBase.op_fixed(Text, "}")), 413 (r"\\\}", LexBase.op_fixed(Text, "}")),
408 (r"(?i)\\expr(?:ession)?[ \t]*\{", 414 (r"(?i)\\expr(?:ession)?[ \t]*\{",
409 LexBase.op_ignore, 415 LexBase.op_ignore,
410 "block-expr"), 416 "block-expr"),
417 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "#push"),
411 include("explicit-tokentype"), 418 include("explicit-tokentype"),
412 include("remark"), 419 include("remark"),
413 (r"\\\\", LexBase.op_fixed(Text, "\\")), 420 (r"\\\\", LexBase.op_fixed(Text, "\\")),
414 (r"\\", LexBase.op_fixed(Text, "\\")), # in text-mode: leave Text 421 (r"\\", LexBase.op_fixed(Text, "\\")), # in text-mode: leave Text
415 (r".", Error), 422 (r".", Error),