From f5d847736a1b998af352c0acfc879a83961ce8b4 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 10 May 2026 14:20:40 +0100 Subject: [PATCH] bshell.vim: fix highlighting of nested parentheses in string interpolation --- bshell.vim/syntax/bshell.vim | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bshell.vim/syntax/bshell.vim b/bshell.vim/syntax/bshell.vim index 8d3439a..2ae8f84 100755 --- a/bshell.vim/syntax/bshell.vim +++ b/bshell.vim/syntax/bshell.vim @@ -14,8 +14,29 @@ syn keyword bshellKeyword func syn keyword bshellTodo contained TODO FIXME XXX NOTE HACK TBD syn match bshellLineComment /#.*$/ contains=bshellTodo -syn region bshellInterpolatedString matchgroup=bshellString start=+"+ end=+"+ extend contains=bshellVariable +syn region bshellInterpolation matchgroup=bshellInterpolationDelimiter start=+$(+ end=+)+ keepend contained contains=@bshellAll +syn region bshellInterpolation matchgroup=bshellInterpolationDelimiter start="$(" end=")" contained contains=ALL +syn region bshellInterpolatedString matchgroup=bshellString start=+"+ end=+"+ extend contains=bshellVariable,bshellInterpolation syn region bshellLiteralString matchgroup=bshellString start=+\'+ end=+\'+ extend contains=bshellSpecialChar,bshellSpecialError,bshellUnicodeNumber,@Spell +syn region bshell1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=bshellInterpolation end=")" transparent contained + +syn case ignore +syn match bshellInteger "\<0b[01_]*[01]\%([lu]\|lu\|ul\)\=\>" display +syn match bshellInteger "\<\d\+\%(_\+\d\+\)*\%([lu]\|lu\|ul\)\=\>" display +syn match bshellInteger "\<-\d\+\%(_\+\d\+\)*\%([lu]\|lu\|ul\)\=\>" display +syn match bshellInteger "\<0x[[:xdigit:]_]*\x\%([lu]\|lu\|ul\)\=\>" display +syn match bshellReal "\<\d\+\%(_\+\d\+\)*\.\d\+\%(_\+\d\+\)*\%\(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=" display +syn match bshellReal "\.\d\+\%(_\+\d\+\)*\%(e[-+]\=\d\+\%(_\+\d\+\)*\)\=[fdm]\=\>" display +syn match bshellReal "\<\d\+\%(_\+\d\+\)*e[-+]\=\d\+\%(_\+\d\+\)*[fdm]\=\>" display +syn match bshellReal "\<\d\+\%(_\+\d\+\)*[fdm]\>" display +syn case match +syn cluster bshellNumber contains=bshellInteger,bshellReal + +syn cluster bshellLiteral contains=@bshellNumber,@bshellString +syn cluster bshellAll contains=@bshellLiteral,bshellVariable,bshellKeyword,bshellArgFlag,bshellFunctionRef,bshellSymbolOp,bshellKeywordOp + +syn match bshellSymbolOp "[+]" display +syn keyword bshellKeywordOp is not understands and or hi def link bshellKeyword Statement hi def link bshellArgFlag Tag @@ -25,7 +46,12 @@ hi def link bshellFunctionRef Function hi def link bshellString String hi def link bshellInterpolatedString String hi def link bshellLiteralString String +hi def link bshellInteger Number +hi def link bshellReal Float +hi def link bshellInterpolationDelimiter Delimiter +hi def link bshellSymbolOp Operator +hi def link bshellKeywordOp Operator " The default highlighting. " hi def link bshellUnspecifiedStatement Statement