annotate runtime/syntax/make.vim @ 8591:5bc958a92849 v7.4.1585

commit https://github.com/vim/vim/commit/d22a18928ebcb465393da1418bb88204b97badb1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 17 20:50:47 2016 +0100 patch 7.4.1585 Problem: Partial is not recognized everywhere. Solution: Check for partial in trans_function_name(). (Yasuhiro Matsumoto) Add a test.
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Mar 2016 21:00:04 +0100
parents 3af822eb4da5
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Makefile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Claudio Fleiner <claudio@fleiner.com>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " URL: http://www.fleiner.com/vim/syntax/make.vim
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
5 " Last Change: 2015 Feb 28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
15 let s:cpo_save = &cpo
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
16 set cpo&vim
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
17
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " some special characters
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
20 syn match makeSpecial "^\s*[@+-]\+"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 syn match makeNextLine "\\\n\s*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " some directives
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
24 syn match makePreCondit "^ *\(ifeq\>\|else\>\|endif\>\|ifneq\>\|ifdef\>\|ifndef\>\)"
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
25 syn match makeInclude "^ *[-s]\=include"
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
26 syn match makeStatement "^ *vpath"
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
27 syn match makeExport "^ *\(export\|unexport\)\>"
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
28 syn match makeOverride "^ *override"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 hi link makeOverride makeStatement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 hi link makeExport makeStatement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
32 " catch unmatched define/endef keywords. endef only matches it is by itself on a line, possibly followed by a commend
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
33 syn region makeDefine start="^\s*define\s" end="^\s*endef\s*\(#.*\)\?$" contains=makeStatement,makeIdent,makePreCondit,makeDefine
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Microsoft Makefile specials
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn case ignore
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
37 syn match makeInclude "^! *include"
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
38 syn match makePreCondit "! *\(cmdswitches\|error\|message\|include\|if\|ifdef\|ifndef\|else\|elseif\|else if\|else\s*ifdef\|else\s*ifndef\|endif\|undef\)\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " identifiers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent,makeSString,makeDString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent,makeSString,makeDString
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match makeIdent "\$\$\w*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match makeIdent "\$[^({]"
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
46 syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
47 syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match makeIdent "%"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 " Makefile.in variables
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn match makeConfig "@[A-Za-z0-9_]\+@"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 " make targets
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 " syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>"
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
55 syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 nextgroup=makeSource
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 nextgroup=makeSource
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
58 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
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
59 syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget,makeComment skipnl nextgroup=makeCommands,makeCommandError
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
61 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
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
62 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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match makeCommandError "^\s\+\S.*" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn match makeCmdNextLine "\\\n."he=e-1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " Statements / Functions (GNU make)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1121
diff changeset
70 syn match makeStatement contained "(\(subst\|abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 " Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 if exists("make_microsoft")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 820
diff changeset
74 syn match makeComment "#.*" contains=@Spell,makeTodo
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 242
diff changeset
75 elseif !exists("make_no_comments")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 820
diff changeset
76 syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo
e63691e7c504 updated for version 7.1a
vimboss
parents: 820
diff changeset
77 syn match makeComment "#$" contains=@Spell
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 syn keyword makeTodo TODO FIXME XXX contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " match escaped quotes and any other escaped character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " except for $, as a backslash in front of a $ does
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " not make it a standard character, but instead it will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 " still act as the beginning of a variable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " The escaped char is not highlightet currently
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 syn match makeEscapedChar "\\[^$]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn region makeDString start=+\(\\\)\@<!"+ skip=+\\.+ end=+"+ contains=makeIdent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn region makeSString start=+\(\\\)\@<!'+ skip=+\\.+ end=+'+ contains=makeIdent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn region makeBString start=+\(\\\)\@<!`+ skip=+\\.+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " Syncing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 syn sync minlines=20 maxlines=200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 " Sync on Make command block region: When searching backwards hits a line that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " can't be a command or a comment, use makeCommands if it looks like a target,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 " NONE otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn sync match makeCommandSync groupthere NONE "^[^\t#]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}\s*$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if version >= 508 || !exists("did_make_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 let did_make_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 HiLink makeNextLine makeSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 HiLink makeCmdNextLine makeSpecial
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 HiLink makeSpecTarget Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 if !exists("make_no_commands")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 HiLink makeCommands Number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 HiLink makeImplicit Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 HiLink makeTarget Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 HiLink makeInclude Include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 HiLink makePreCondit PreCondit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 HiLink makeStatement Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 HiLink makeIdent Identifier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 HiLink makeSpecial Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 HiLink makeComment Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 HiLink makeDString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 HiLink makeSString String
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 HiLink makeBString Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 HiLink makeError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 HiLink makeTodo Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 HiLink makeDefine Define
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 HiLink makeCommandError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 HiLink makeConfig PreCondit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 let b:current_syntax = "make"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
141 let &cpo = s:cpo_save
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
142 unlet s:cpo_save
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 " vim: ts=8