comparison pygments_lexer_pseudocode2/lexers/algpseudocode.py @ 281:ee512932d603

Make "\T" and "\E" aliases for "\TEXT" and "\EXPRESSION"
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 20 May 2026 17:23:41 +0200
parents 397ed930a5ba
children 90946f87d77d
comparison
equal deleted inserted replaced
280:1b0e58f60f73 281:ee512932d603
362 include("escaped-string-start"), 362 include("escaped-string-start"),
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)\\e(?:xpr(?:ession)?)?[ \t]*\{",
368 (r"(?i)\\expr(?:ession)?[ \t]*\{",
369 LexBase.op_ignore, 368 LexBase.op_ignore,
370 "block-expr"), 369 "block-expr"),
371 include("explicit-tokentype"), 370 include("explicit-tokentype"),
371 (r"(?i)\\t(?:ext)?[ \t]*\{", LexBase.op_ignore, "text-statement"),
372 include("remark"), 372 include("remark"),
373 include("keyword-constants"), 373 include("keyword-constants"),
374 include("word-operators"), 374 include("word-operators"),
375 include("math-builtins"), 375 include("math-builtins"),
376 include("py-name"), 376 include("py-name"),
382 include("escaped-string-start"), 382 include("escaped-string-start"),
383 include("py-strings"), 383 include("py-strings"),
384 include("py-numbers"), 384 include("py-numbers"),
385 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"), 385 (r"(?i)\\(call|name)[ \t]*(\{)", LexBase.op_ignore, "entity-name"),
386 (r"(?i)\\gets\b", op_gets), 386 (r"(?i)\\gets\b", op_gets),
387 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-statement"), 387 (r"(?i)\\e(?:xpr(?:ession)?)?[ \t]*\{",
388 (r"(?i)\\expr(?:ession)?[ \t]*\{",
389 LexBase.op_ignore, 388 LexBase.op_ignore,
390 "block-expr"), 389 "block-expr"),
391 include("explicit-tokentype"), 390 include("explicit-tokentype"),
391 (r"(?i)\\t(?:ext)?[ \t]*\{", LexBase.op_ignore, "text-statement"),
392 include("remark"), 392 include("remark"),
393 include("keyword-constants"), 393 include("keyword-constants"),
394 include("word-operators"), 394 include("word-operators"),
395 include("math-builtins"), 395 include("math-builtins"),
396 include("py-name"), 396 include("py-name"),
409 "text-statement": [ # like block but default to text-mode 409 "text-statement": [ # like block but default to text-mode
410 (r"[^\\}\n]+", Text), 410 (r"[^\\}\n]+", Text),
411 (r"\}", LexBase.op_ignore, "#pop"), 411 (r"\}", LexBase.op_ignore, "#pop"),
412 (r"\n", Whitespace), 412 (r"\n", Whitespace),
413 (r"\\\}", LexBase.op_fixed(Text, "}")), 413 (r"\\\}", LexBase.op_fixed(Text, "}")),
414 (r"(?i)\\expr(?:ession)?[ \t]*\{", 414 (r"(?i)\\e(?:xpr(?:ession)?)?[ \t]*\{",
415 LexBase.op_ignore, 415 LexBase.op_ignore,
416 "block-expr"), 416 "block-expr"),
417 (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "#push"),
418 include("explicit-tokentype"), 417 include("explicit-tokentype"),
418 (r"(?i)\\t(?:ext)?[ \t]*\{", LexBase.op_ignore, "#push"),
419 include("remark"), 419 include("remark"),
420 (r"\\\\", LexBase.op_fixed(Text, "\\")), 420 (r"\\\\", LexBase.op_fixed(Text, "\\")),
421 (r"\\", LexBase.op_fixed(Text, "\\")), # in text-mode: leave Text 421 (r"\\", LexBase.op_fixed(Text, "\\")), # in text-mode: leave Text
422 (r".", Error), 422 (r".", Error),
423 ], 423 ],