Mercurial > vim
annotate runtime/syntax/make.vim @ 23568:e6f7afb1564b
Added tag v8.2.2326 for changeset cd6b9bc51d58275b1c27c690479111e745f1f8f4
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 10 Jan 2021 23:00:05 +0100 |
parents | 2334bf788e8a |
children | 67f31c24291b |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Makefile | |
19163 | 3 " Maintainer: Roland Hieber <rohieb+vim-iR0jGdkV@rohieb.name>, <https://github.com/rohieb> |
15878 | 4 " Previous Maintainer: Claudio Fleiner <claudio@fleiner.com> |
19163 | 5 " URL: https://github.com/vim/vim/blob/master/runtime/syntax/make.vim |
20317 | 6 " Last Change: 2020 May 03 |
7 | 7 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
8 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
9 if exists("b:current_syntax") |
7 | 10 finish |
11 endif | |
12 | |
3854 | 13 let s:cpo_save = &cpo |
14 set cpo&vim | |
15 | |
7 | 16 " some special characters |
820 | 17 syn match makeSpecial "^\s*[@+-]\+" |
7 | 18 syn match makeNextLine "\\\n\s*" |
19 | |
3854 | 20 " catch unmatched define/endef keywords. endef only matches it is by itself on a line, possibly followed by a commend |
19646 | 21 syn region makeDefine start="^\s*define\s" end="^\s*endef\s*\(#.*\)\?$" |
22 \ contains=makeStatement,makeIdent,makePreCondit,makeDefine | |
7 | 23 |
24 " Microsoft Makefile specials | |
25 syn case ignore | |
18797
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
26 syn match makeInclude "^!\s*include\s.*$" |
16208 | 27 syn match makePreCondit "^!\s*\(cmdswitches\|error\|message\|include\|if\|ifdef\|ifndef\|else\|else\s*if\|else\s*ifdef\|else\s*ifndef\|endif\|undef\)\>" |
7 | 28 syn case match |
29 | |
30 " identifiers | |
18797
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
31 syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent |
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
32 syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent |
7 | 33 syn match makeIdent "\$\$\w*" |
34 syn match makeIdent "\$[^({]" | |
6647 | 35 syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2 |
19163 | 36 syn match makeIdent "^ *[^:#= \t]*\s*::="me=e-3 |
6647 | 37 syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1 |
7 | 38 syn match makeIdent "%" |
39 | |
40 " Makefile.in variables | |
41 syn match makeConfig "@[A-Za-z0-9_]\+@" | |
42 | |
43 " make targets | |
18797
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
44 syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 |
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
45 syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 |
7 | 46 |
19646 | 47 syn region makeTarget transparent matchgroup=makeTarget |
48 \ start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 | |
49 \ end=";"re=e-1,me=e-1 end="[^\\]$" | |
50 \ keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment,makeDString | |
51 \ skipnl nextGroup=makeCommands | |
52 syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" | |
53 \ contains=makeIdent,makeSpecTarget,makeComment | |
54 \ skipnl nextgroup=makeCommands,makeCommandError | |
7 | 55 |
19646 | 56 syn region makeSpecTarget transparent matchgroup=makeSpecTarget |
57 \ start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 | |
58 \ end="[^\\]$" keepend | |
59 \ contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands | |
60 syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" | |
61 \ contains=makeIdent,makeComment | |
62 \ skipnl nextgroup=makeCommands,makeCommandError | |
7 | 63 |
64 syn match makeCommandError "^\s\+\S.*" contained | |
19646 | 65 syn region makeCommands contained start=";"hs=s+1 start="^\t" |
66 \ end="^[^\t#]"me=e-1,re=e-1 end="^$" | |
67 \ contains=makeCmdNextLine,makeSpecial,makeComment,makeIdent,makePreCondit,makeDefine,makeDString,makeSString | |
68 \ nextgroup=makeCommandError | |
7 | 69 syn match makeCmdNextLine "\\\n."he=e-1 contained |
70 | |
19646 | 71 " some directives |
72 syn match makePreCondit "^ *\(ifn\=\(eq\|def\)\>\|else\(\s\+ifn\=\(eq\|def\)\)\=\>\|endif\>\)" | |
73 syn match makeInclude "^ *[-s]\=include\s.*$" | |
74 syn match makeStatement "^ *vpath" | |
75 syn match makeExport "^ *\(export\|unexport\)\>" | |
20317 | 76 syn match makeOverride "^ *override\>" |
7 | 77 " Statements / Functions (GNU make) |
15878 | 78 syn match makeStatement contained "(\(abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|file\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|guile\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|subst\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1 |
7 | 79 |
80 " Comment | |
81 if exists("make_microsoft") | |
1121 | 82 syn match makeComment "#.*" contains=@Spell,makeTodo |
820 | 83 elseif !exists("make_no_comments") |
1121 | 84 syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo |
85 syn match makeComment "#$" contains=@Spell | |
7 | 86 endif |
87 syn keyword makeTodo TODO FIXME XXX contained | |
88 | |
89 " match escaped quotes and any other escaped character | |
90 " except for $, as a backslash in front of a $ does | |
91 " not make it a standard character, but instead it will | |
92 " still act as the beginning of a variable | |
93 " The escaped char is not highlightet currently | |
94 syn match makeEscapedChar "\\[^$]" | |
95 | |
96 | |
18797
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
97 syn region makeDString start=+\(\\\)\@<!"+ skip=+\\.+ end=+"+ contained contains=makeIdent |
76af6d0ea316
Update version 8.2 notes and make syntax.
Bram Moolenaar <Bram@vim.org>
parents:
16208
diff
changeset
|
98 syn region makeSString start=+\(\\\)\@<!'+ skip=+\\.+ end=+'+ contained contains=makeIdent |
7 | 99 syn region makeBString start=+\(\\\)\@<!`+ skip=+\\.+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine |
100 | |
101 " Syncing | |
102 syn sync minlines=20 maxlines=200 | |
103 | |
104 " Sync on Make command block region: When searching backwards hits a line that | |
105 " can't be a command or a comment, use makeCommands if it looks like a target, | |
106 " NONE otherwise. | |
107 syn sync match makeCommandSync groupthere NONE "^[^\t#]" | |
108 syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]" | |
109 syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}\s*$" | |
110 | |
111 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
112 " Only when an item doesn't have highlighting yet |
7 | 113 |
16208 | 114 hi def link makeNextLine makeSpecial |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
115 hi def link makeCmdNextLine makeSpecial |
19646 | 116 hi link makeOverride makeStatement |
117 hi link makeExport makeStatement | |
118 | |
16208 | 119 hi def link makeSpecTarget Statement |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
6647
diff
changeset
|
120 if !exists("make_no_commands") |
16208 | 121 hi def link makeCommands Number |
7 | 122 endif |
16208 | 123 hi def link makeImplicit Function |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link makeTarget Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link makeInclude Include |
16208 | 126 hi def link makePreCondit PreCondit |
127 hi def link makeStatement Statement | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link makeIdent Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link makeSpecial Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
130 hi def link makeComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
131 hi def link makeDString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
132 hi def link makeSString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
133 hi def link makeBString Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
134 hi def link makeError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
135 hi def link makeTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
136 hi def link makeDefine Define |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
137 hi def link makeCommandError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
138 hi def link makeConfig PreCondit |
7 | 139 |
140 let b:current_syntax = "make" | |
141 | |
3854 | 142 let &cpo = s:cpo_save |
143 unlet s:cpo_save | |
7 | 144 " vim: ts=8 |