forked from aniani/vim
runtime(dosbatch): Add syn-sync to syntax file
Closing parentheses were often highlighted as errors. Add a syntax sync command to reduce the error. Also fix that `defined` was not highlighted as an operator inside parentheses. E.g.: ``` if defined foo ( if defined bar ( ... ) ) ``` The first `defined` was highlighted but the second one was not. related: #15453 Signed-off-by: Ken Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
fc762dfc9f
commit
11c92be897
@ -3,6 +3,7 @@
|
|||||||
" Maintainer: Mike Williams <mrmrdubya@gmail.com>
|
" Maintainer: Mike Williams <mrmrdubya@gmail.com>
|
||||||
" Filenames: *.bat
|
" Filenames: *.bat
|
||||||
" Last Change: 3rd February 2024
|
" Last Change: 3rd February 2024
|
||||||
|
" 2024 Aug 14 by Vim Project: improve syntax (#15453)
|
||||||
"
|
"
|
||||||
" Options Flags:
|
" Options Flags:
|
||||||
" dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default]
|
" dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default]
|
||||||
@ -45,7 +46,7 @@ syn match dosbatchString "\<echo\([^)>|]\|\^\@<=[)>|]\)*"lc=4 contains=dosbatchV
|
|||||||
syn match dosbatchEchoOperator "\<echo\s\+\(on\|off\)\s*$"lc=4
|
syn match dosbatchEchoOperator "\<echo\s\+\(on\|off\)\s*$"lc=4
|
||||||
|
|
||||||
" For embedded commands
|
" For embedded commands
|
||||||
syn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator
|
syn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,dosbatchIfOperator
|
||||||
|
|
||||||
" Numbers - surround with ws to not include in dir and filenames
|
" Numbers - surround with ws to not include in dir and filenames
|
||||||
syn match dosbatchInteger "[[:space:]=(/:,!~-]\d\+"lc=1
|
syn match dosbatchInteger "[[:space:]=(/:,!~-]\d\+"lc=1
|
||||||
@ -102,9 +103,11 @@ else
|
|||||||
syn match dosbatchColonCommentErr contained "\s*:\s*:.*$"
|
syn match dosbatchColonCommentErr contained "\s*:\s*:.*$"
|
||||||
endif
|
endif
|
||||||
syn match dosbatchColonCommentErr contained "\s*:\s*:[^)]*\(\(\n\s*\)\?)\)\@="
|
syn match dosbatchColonCommentErr contained "\s*:\s*:[^)]*\(\(\n\s*\)\?)\)\@="
|
||||||
syn region dosbatchCodeBlock transparent start=+(+ end=+)+ contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,@dosbatchCodeBlockComment,dosbatchColonCommentErr,dosbatchCodeBlock
|
syn region dosbatchCodeBlock transparent start=+(+ end=+)+ contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,dosbatchIfOperator,@dosbatchCodeBlockComment,dosbatchColonCommentErr,dosbatchCodeBlock
|
||||||
syn match dosbatchCodeBlockErr ")"
|
syn match dosbatchCodeBlockErr ")"
|
||||||
|
|
||||||
|
syn sync match dosbatchSyncCodeBlock grouphere NONE "^)\s*$"
|
||||||
|
|
||||||
syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir
|
syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir
|
||||||
syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy
|
syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy
|
||||||
syn keyword dosbatchImplicit date del dir diskcomp diskcopy doskey echo endlocal
|
syn keyword dosbatchImplicit date del dir diskcomp diskcopy doskey echo endlocal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user