Mercurial > vim
annotate runtime/syntax/dosbatch.vim @ 10048:43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 30 23:26:57 2016 +0200
Updated runtime files. Remove version checks for Vim older than 6.0.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 30 Aug 2016 23:30:09 +0200 |
parents | 7bc41231fbc7 |
children | 46763b01cd9a |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: MSDOS batch file (with NT command extensions) | |
3 " Maintainer: Mike Williams <mrw@eandem.co.uk> | |
4 " Filenames: *.bat | |
2034 | 5 " Last Change: 6th September 2009 |
7 | 6 " Web Page: http://www.eandem.co.uk/mrw/vim |
7 " | |
8 " Options Flags: | |
9 " dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default] | |
10 " | |
11 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
12 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
13 if exists("b:current_syntax") |
7 | 14 finish |
15 endif | |
16 | |
17 " Set default highlighting to Win2k | |
18 if !exists("dosbatch_cmdextversion") | |
19 let dosbatch_cmdextversion = 2 | |
20 endif | |
21 | |
22 " DOS bat files are case insensitive but case preserving! | |
23 syn case ignore | |
24 | |
25 syn keyword dosbatchTodo contained TODO | |
26 | |
27 " Dosbat keywords | |
28 syn keyword dosbatchStatement goto call exit | |
29 syn keyword dosbatchConditional if else | |
30 syn keyword dosbatchRepeat for | |
31 | |
32 " Some operators - first lot are case sensitive! | |
33 syn case match | |
34 syn keyword dosbatchOperator EQU NEQ LSS LEQ GTR GEQ | |
35 syn case ignore | |
2034 | 36 syn match dosbatchOperator "\s[-+\*/%!~]\s" |
7 | 37 syn match dosbatchOperator "=" |
38 syn match dosbatchOperator "[-+\*/%]=" | |
39 syn match dosbatchOperator "\s\(&\||\|^\|<<\|>>\)=\=\s" | |
40 syn match dosbatchIfOperator "if\s\+\(\(not\)\=\s\+\)\=\(exist\|defined\|errorlevel\|cmdextversion\)\="lc=2 | |
41 | |
42 " String - using "'s is a convenience rather than a requirement outside of FOR | |
1623 | 43 syn match dosbatchString "\"[^"]*\"" contains=dosbatchVariable,dosBatchArgument,dosbatchSpecialChar,@dosbatchNumber,@Spell |
44 syn match dosbatchString "\<echo\([^)>|]\|\^\@<=[)>|]\)*"lc=4 contains=dosbatchVariable,dosbatchArgument,dosbatchSpecialChar,@dosbatchNumber,@Spell | |
7 | 45 syn match dosbatchEchoOperator "\<echo\s\+\(on\|off\)\s*$"lc=4 |
46 | |
47 " For embedded commands | |
48 syn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator | |
49 | |
50 " Numbers - surround with ws to not include in dir and filenames | |
2034 | 51 syn match dosbatchInteger "[[:space:]=(/:,!~-]\d\+"lc=1 |
52 syn match dosbatchHex "[[:space:]=(/:,!~-]0x\x\+"lc=1 | |
53 syn match dosbatchBinary "[[:space:]=(/:,!~-]0b[01]\+"lc=1 | |
54 syn match dosbatchOctal "[[:space:]=(/:,!~-]0\o\+"lc=1 | |
7 | 55 syn cluster dosbatchNumber contains=dosbatchInteger,dosbatchHex,dosbatchBinary,dosbatchOctal |
56 | |
57 " Command line switches | |
58 syn match dosbatchSwitch "/\(\a\+\|?\)" | |
59 | |
60 " Various special escaped char formats | |
61 syn match dosbatchSpecialChar "\^[&|()<>^]" | |
62 syn match dosbatchSpecialChar "\$[a-hl-npqstv_$+]" | |
63 syn match dosbatchSpecialChar "%%" | |
64 | |
65 " Environment variables | |
66 syn match dosbatchIdentifier contained "\s\h\w*\>" | |
67 syn match dosbatchVariable "%\h\w*%" | |
68 syn match dosbatchVariable "%\h\w*:\*\=[^=]*=[^%]*%" | |
2034 | 69 syn match dosbatchVariable "%\h\w*:\~[-]\=\d\+\(,[-]\=\d\+\)\=%" contains=dosbatchInteger |
7 | 70 syn match dosbatchVariable "!\h\w*!" |
2034 | 71 syn match dosbatchVariable "!\h\w*:\*\=[^=]*=[^!]*!" |
72 syn match dosbatchVariable "!\h\w*:\~[-]\=\d\+\(,[-]\=\d\+\)\=!" contains=dosbatchInteger | |
7 | 73 syn match dosbatchSet "\s\h\w*[+-]\==\{-1}" contains=dosbatchIdentifier,dosbatchOperator |
74 | |
75 " Args to bat files and for loops, etc | |
76 syn match dosbatchArgument "%\(\d\|\*\)" | |
2034 | 77 syn match dosbatchArgument "%[a-z]\>" |
7 | 78 if dosbatch_cmdextversion == 1 |
79 syn match dosbatchArgument "%\~[fdpnxs]\+\(\($PATH:\)\=[a-z]\|\d\)\>" | |
80 else | |
81 syn match dosbatchArgument "%\~[fdpnxsatz]\+\(\($PATH:\)\=[a-z]\|\d\)\>" | |
82 endif | |
83 | |
84 " Line labels | |
85 syn match dosbatchLabel "^\s*:\s*\h\w*\>" | |
86 syn match dosbatchLabel "\<\(goto\|call\)\s\+:\h\w*\>"lc=4 | |
87 syn match dosbatchLabel "\<goto\s\+\h\w*\>"lc=4 | |
88 syn match dosbatchLabel ":\h\w*\>" | |
89 | |
90 " Comments - usual rem but also two colons as first non-space is an idiom | |
1623 | 91 syn match dosbatchComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
2034 | 92 syn match dosbatchComment "^@rem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
1623 | 93 syn match dosbatchComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
2034 | 94 syn match dosbatchComment "\s@rem\($\|\s.*$\)"lc=5 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
1623 | 95 syn match dosbatchComment "\s*:\s*:.*$" contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
7 | 96 |
97 " Comments in ()'s - still to handle spaces before rem | |
1623 | 98 syn match dosbatchComment "(rem\([^)]\|\^\@<=)\)*"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell |
7 | 99 |
100 syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir | |
101 syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy | |
102 syn keyword dosbatchImplicit date del dir diskcomp diskcopy doskey echo endlocal | |
103 syn keyword dosbatchImplicit erase fc find findstr format ftype | |
104 syn keyword dosbatchImplicit graftabl help keyb label md mkdir mode more move | |
105 syn keyword dosbatchImplicit path pause popd print prompt pushd rd recover rem | |
106 syn keyword dosbatchImplicit ren rename replace restore rmdir set setlocal shift | |
107 syn keyword dosbatchImplicit sort start subst time title tree type ver verify | |
108 syn keyword dosbatchImplicit vol xcopy | |
109 | |
110 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
111 " Only when an item doesn't have highlighting yet |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
112 command -nargs=+ HiLink hi def link <args> |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
113 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
114 HiLink dosbatchTodo Todo |
7 | 115 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
116 HiLink dosbatchStatement Statement |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
117 HiLink dosbatchCommands dosbatchStatement |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
118 HiLink dosbatchLabel Label |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
119 HiLink dosbatchConditional Conditional |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
120 HiLink dosbatchRepeat Repeat |
7 | 121 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
122 HiLink dosbatchOperator Operator |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
123 HiLink dosbatchEchoOperator dosbatchOperator |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
124 HiLink dosbatchIfOperator dosbatchOperator |
7 | 125 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
126 HiLink dosbatchArgument Identifier |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
127 HiLink dosbatchIdentifier Identifier |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
128 HiLink dosbatchVariable dosbatchIdentifier |
7 | 129 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
130 HiLink dosbatchSpecialChar SpecialChar |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
131 HiLink dosbatchString String |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
132 HiLink dosbatchNumber Number |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
133 HiLink dosbatchInteger dosbatchNumber |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
134 HiLink dosbatchHex dosbatchNumber |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
135 HiLink dosbatchBinary dosbatchNumber |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
136 HiLink dosbatchOctal dosbatchNumber |
7 | 137 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
138 HiLink dosbatchComment Comment |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
139 HiLink dosbatchImplicit Function |
7 | 140 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
141 HiLink dosbatchSwitch Special |
7 | 142 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
143 HiLink dosbatchCmd PreProc |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
144 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
145 delcommand HiLink |
7 | 146 |
147 let b:current_syntax = "dosbatch" | |
148 | |
149 " vim: ts=8 |