diff --git a/lib/build/shell_example_lexer.py b/lib/build/shell_example_lexer.py index c2506156bc933586008a6e8284bb810862b8d4e7..401ad65f2c4d7c913f058892991b234a6ba3944c 100644 --- a/lib/build/shell_example_lexer.py +++ b/lib/build/shell_example_lexer.py @@ -46,12 +46,13 @@ class ShellExampleLexer(RegexLexer): # switch to state input on '$ ' at the start of the line (r"^\$ ", Text, "input"), (r"\s+", Text), - (r"[^#%\s]+", Text), + (r"[^#%\s\\]+", Text), + (r"\\", Text), ], "input": [ include("comments"), include("userinput"), - (r"[^%\\\s]+", Generic.Strong), + (r"[^#%\s\\]+", Generic.Strong), (r"\\\n", Generic.Strong), (r"\\", Generic.Strong), # switch to prev state at non-escaped new-line @@ -62,7 +63,7 @@ class ShellExampleLexer(RegexLexer): (r"#.*\n", Comment.Single), ], "userinput": [ - (r"\\%", Text), + (r"(\\)(%)", bygroups(None, Text)), (r"(%)([^%]*)(%)", bygroups(None, Name.Variable, None)), ], }