From 7abc9ea9c79af45e3e5c986688dfcce6a5b6f1e4 Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sat, 7 Feb 2026 19:37:03 +0300 Subject: [PATCH 1/3] Ticket #4933: improve TOML syntax highlighting * Fix broken comments handling. * Support escapes in basic (double-quoted) strings. * Highlight literal (single-quoted) strings. * Support multi-line strings. * Make tables (sections) easily distinguishable from comments. * Make highlighting of inline tables consistent. * Unify colors with other syntax files like YAML / C / Shell. Signed-off-by: Sergey Naumov --- misc/syntax/toml.syntax | 62 +++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/misc/syntax/toml.syntax b/misc/syntax/toml.syntax index 0a1dff44f9..09c04b838c 100644 --- a/misc/syntax/toml.syntax +++ b/misc/syntax/toml.syntax @@ -1,22 +1,54 @@ # TOML: Tom's Obvious Minimal Language +# +# Specification: https://toml.io/en/v1.1.0 -context default white +define table yellow +define key cyan +define equal white +define brace brightcyan +define bool cyan +define number cyan +define string green +define escape brightgreen +define comment brown -# groups -context [ \n brown - keyword [ yellow - keyword ] yellow +context default + keyword linestart \[\t\s\][[*]] table + keyword linestart \[\t\s\][*] table -# assignment -context exclusive = \n write - keyword "*" brightgreen - keyword whole false brightcyan - keyword whole true brightcyan - keyword \{0123456789\} brightcyan + keyword = equal + keyword [ brace + keyword ] brace + keyword { brace + keyword } brace -# comments -context # \n brown + keyword linestart \[\t\s\]\{0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-\}\[0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.\] key + + keyword whole true bool + keyword whole false bool + + keyword whole inf number + keyword whole nan number + + keyword whole 0\{box\}\{0123456789ABCDEFabcdef\}\[0123456789ABCDEFabcdef_\] number + keyword whole \{0123456789\}\[0123456789_\]\{eE\}\[0123456789_\] number + keyword whole \{0123456789\}\[0123456789_\] number + +context # \n comment spellcheck -# other strings -context " " brightgreen +context """ """ string + keyword \\" escape + keyword \\\\ escape + keyword \\\{uU\}\[0123456789\] escape + keyword \\\{bfnrt\} escape + +context ''' ''' string + +context " " string + keyword \\" escape + keyword \\\\ escape + keyword \\\{uU\}\[0123456789\] escape + keyword \\\{bfnrt\} escape + +context ' ' string From 1b1a788e0c3fac36580142cd1d10bba3df4822e9 Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sat, 7 Feb 2026 19:37:11 +0300 Subject: [PATCH 2/3] Ticket #5003: add syntax highlighting for Kconfig * Implement Kconfig specification with Kconfiglib extensions. * Highlight the following files: - Kconfig / Kconfig.* - for Linux kernel, U-Boot, Zephyr. - Config.in / Config.in.* / Config.src - for Buildroot, Busybox. - *.kconf / *.kconfig - just alternative extension-based variant. Signed-off-by: Sergey Naumov --- misc/syntax/Makefile.am | 1 + misc/syntax/Syntax.in | 3 ++ misc/syntax/kconfig.syntax | 83 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 misc/syntax/kconfig.syntax diff --git a/misc/syntax/Makefile.am b/misc/syntax/Makefile.am index 1428256958..d39580b6bb 100644 --- a/misc/syntax/Makefile.am +++ b/misc/syntax/Makefile.am @@ -50,6 +50,7 @@ SYNTAXFILES = \ java.syntax \ js.syntax \ json.syntax \ + kconfig.syntax \ kotlin.syntax \ latex.syntax \ lisp.syntax \ diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in index 4a4aedb6d2..cec0c3d327 100644 --- a/misc/syntax/Syntax.in +++ b/misc/syntax/Syntax.in @@ -366,5 +366,8 @@ include caddyfile.syntax file Dockerfile.\*$ Dockerfile include dockerfile.syntax +file (/Kconfig(\\.[A-z0-9-]\+)\*|/Config\\.(in|src)(\\.[A-z0-9-]\+)\*|.\*\\.kconf(ig)?)$ Kconfig +include kconfig.syntax + file .\* unknown include unknown.syntax diff --git a/misc/syntax/kconfig.syntax b/misc/syntax/kconfig.syntax new file mode 100644 index 0000000000..07df494c57 --- /dev/null +++ b/misc/syntax/kconfig.syntax @@ -0,0 +1,83 @@ +# Kconfig syntax +# +# Specifications: +# https://docs.kernel.org/kbuild/kconfig-language.html +# https://github.com/ulfalizer/Kconfiglib?tab=readme-ov-file#kconfig-extensions + +define kword yellow +define type brightmagenta +define property brightmagenta +define condition yellow +define operator brightcyan +define brace brightcyan +define number cyan +define string green +define escape brightgreen +define comment brown + +context default + keyword whole linestart \[\t\s\]config kword + keyword whole linestart \[\t\s\]menuconfig kword + keyword whole linestart \[\t\s\]menu kword + keyword whole linestart \[\t\s\]endmenu kword + keyword whole linestart \[\t\s\]mainmenu kword + keyword whole linestart \[\t\s\]choice kword + keyword whole linestart \[\t\s\]endchoice kword + keyword whole linestart \[\t\s\]comment kword + keyword whole linestart \[\t\s\]source kword + keyword whole linestart \[\t\s\]osource kword + keyword whole linestart \[\t\s\]rsource kword + keyword whole linestart \[\t\s\]orsource kword + + keyword whole if condition + keyword whole linestart \[\t\s\]endif condition + + keyword whole linestart \[\t\s\]bool type + keyword whole linestart \[\t\s\]tristate type + keyword whole linestart \[\t\s\]string type + keyword whole linestart \[\t\s\]hex type + keyword whole linestart \[\t\s\]int type + + keyword whole linestart \[\t\s\]def_bool type + keyword whole linestart \[\t\s\]def_tristate type + keyword whole linestart \[\t\s\]def_string type + keyword whole linestart \[\t\s\]def_hex type + keyword whole linestart \[\t\s\]def_int type + + keyword whole linestart \[\t\s\]prompt property + keyword whole linestart \[\t\s\]default property + keyword whole linestart \[\t\s\]depends\son property + keyword whole linestart \[\t\s\]select property + keyword whole linestart \[\t\s\]imply property + keyword whole linestart \[\t\s\]transitional property + keyword whole linestart \[\t\s\]visible\sif property + keyword whole linestart \[\t\s\]range property + keyword whole linestart \[\t\s\]option property + keyword whole linestart \[\t\s\]optional property + keyword whole linestart \[\t\s\]help property + keyword whole linestart \[\t\s\]---help--- property + + keyword = operator + keyword > operator + keyword < operator + keyword >= operator + keyword <= operator + keyword || operator + keyword && operator + keyword ! operator + + keyword ( brace + keyword ) brace + + keyword whole 0x\{0123456789ABCDEFabcdef\}\[0123456789ABCDEFabcdef\] number + keyword whole \{0123456789\}\[0123456789\] number + + # sometimes quotes are escaped in help like \"foo\" => do not start string context + keyword \\" + +context # \n comment + spellcheck + +context " " string + keyword \\" escape + keyword \\\\ escape From ab71e52daa042e170ba7fb014b366f16d8ccff10 Mon Sep 17 00:00:00 2001 From: Sergey Naumov Date: Sat, 7 Feb 2026 19:37:14 +0300 Subject: [PATCH 3/3] Ticket #5003: highlight Kconfig output files * .config is already highlighted as Java properties => reuse it. It is not ideal, but better than nothing. * Additionally hightlight: - .config.* - e.g. .config.old produced by Kconfig. - *defconfig - used in Linux kernel, Buildroot, Busybox, U-Boot, Zephyr. * Kconfig.defconfig should still be treated as Kconfig definition file, not as its output. Signed-off-by: Sergey Naumov --- misc/syntax/Syntax.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in index cec0c3d327..79b1fdcfbf 100644 --- a/misc/syntax/Syntax.in +++ b/misc/syntax/Syntax.in @@ -369,5 +369,8 @@ include dockerfile.syntax file (/Kconfig(\\.[A-z0-9-]\+)\*|/Config\\.(in|src)(\\.[A-z0-9-]\+)\*|.\*\\.kconf(ig)?)$ Kconfig include kconfig.syntax +file ..\*(\\.config(\\.[A-z0-9-]\+)\*|defconfig)$ Kconfig\soutput +include properties.syntax + file .\* unknown include unknown.syntax