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