Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
changeset 90:2af4684c8e78
Restrict whitespace before required and optional arguments.
Instead of "\s*" use explicit allowed whitespace chars (" " and "\t").
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 02 May 2026 14:46:28 +0200 |
| parents | 7414eed7b275 |
| children | feb41c8d72d2 |
| files | pygments_lexer_pseudocode2/algpseudocode.py |
| diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pygments_lexer_pseudocode2/algpseudocode.py Sat May 02 13:21:45 2026 +0200 +++ b/pygments_lexer_pseudocode2/algpseudocode.py Sat May 02 14:46:28 2026 +0200 @@ -181,7 +181,7 @@ (r"/\*", Comment.Multiline, "multiline-nested-comment"), (r"//.*$", Comment.Single), include("remark"), - (r"(?i)\\(block|state(?:ment)?)\s*(\{)", + (r"(?i)\\(block|state(?:ment)?)[ \t]*(\{)", bygroups(op_symbol(Text), LexBase.op_fixed(Whitespace, " ")), "block-expr"), (r"(?i)\\(" @@ -189,7 +189,7 @@ r"|(?:tstate(?:ment)?)" r"|(?:textblock)" r"|(?:tblock)" - r")\s*(\{)", + r")[ \t]*(\{)", bygroups(op_symbol(Text), LexBase.op_fixed(Whitespace, " ")), "text-statement"), (r"\\\n", Text), @@ -199,7 +199,7 @@ r"|(?:proc(?:edure)?)" r"|(?:func(?:tion)?|(?:fn))" r"|(?:class)" - r")\s*(\{)", + r")[ \t]*(\{)", bygroups(op_translate(Keyword), LexBase.op_fixed(Whitespace, " ")), "entity-name"), @@ -211,7 +211,7 @@ r"|(?:proc(?:edure)?)" r"|(?:func(?:tion)?)" r"|(?:class)" - r")\s*(\{)", + r")(?:_|(?:[\t -]+))?(\{)", bygroups(op_opt_end_translate(Keyword), op_opt_ignore_or_fixed(Whitespace, " ")), "entity-name-end"), @@ -255,7 +255,7 @@ include("punctuation"), include("py-strings"), include("py-numbers"), - (r"(?i)\\text\s*\{", LexBase.op_ignore, "text-in-expr"), + (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-in-expr"), include("explicit-tokentype"), include("remark"), include("keyword-constants"), @@ -267,7 +267,7 @@ include("punctuation-in-braces"), include("py-strings"), include("py-numbers"), - (r"(?i)\\text\s*\{", LexBase.op_ignore, "text-in-expr"), + (r"(?i)\\text[ \t]*\{", LexBase.op_ignore, "text-in-expr"), include("explicit-tokentype"), include("remark"), include("keyword-constants"), @@ -288,7 +288,7 @@ (r"\}", LexBase.op_ignore, "#pop"), (r"\n", Whitespace), (r"\\\}", LexBase.op_fixed(Text, "}")), - (r"(?i)\\expr(?:ession)?\s*\{", + (r"(?i)\\expr(?:ession)?[ \t]*\{", LexBase.op_ignore, "block-expr"), include("explicit-tokentype"), @@ -301,7 +301,7 @@ (r"\}", LexBase.op_ignore, "#pop"), (r"\n", Whitespace), (r"\\\}", LexBase.op_fixed(Text, "}")), - (r"(?:i)\\(expr(?:ession)?)\s*(\{)", + (r"(?:i)\\(expr(?:ession)?)[ \t]*(\{)", bygroups(LexBase.op_ignore, LexBase.op_ignore), "expr-in-braces"), include("explicit-tokentype"),
