From ce5a0e82bf79f79b4cf38055af128a13187b244e Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Wed, 9 Sep 2026 15:09:08 -0400 Subject: [PATCH] tokenize a leading slash or backslash as a symbol so that in eg "/help", the characters should all be highly visible and have the same color. --- changelog.md | 5 +++++ mycli/lexer.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index d1836d253..27ef500ac 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,11 @@ Features * Include a MariaDB server and example data in the Docker image. +Bug Fixes +-------- +* Tokenize leading `/` and `\` as symbol names for better highlighting. + + Documentation -------- * Add `--pull=always` to documented `docker run` command. diff --git a/mycli/lexer.py b/mycli/lexer.py index 4caac56d2..1a726ab30 100644 --- a/mycli/lexer.py +++ b/mycli/lexer.py @@ -1,6 +1,6 @@ from pygments.lexer import inherit from pygments.lexers.sql import MySqlLexer -from pygments.token import Keyword +from pygments.token import Keyword, Name class MyCliLexer(MySqlLexer): @@ -8,6 +8,7 @@ class MyCliLexer(MySqlLexer): tokens = { "root": [ + (r'^[/\\]', Name), (r"\brepair\b", Keyword), (r"\boffset\b", Keyword), inherit,