7
|
1 " Vim syntax file
|
|
2 " Language: M4
|
632
|
3 " Maintainer: Claudio Fleiner (claudio@fleiner.com)
|
7
|
4 " URL: http://www.fleiner.com/vim/syntax/m4.vim
|
632
|
5 " Last Change: 2005 Jan 15
|
7
|
6
|
|
7 " This file will highlight user function calls if they use only
|
|
8 " capital letters and have at least one argument (i.e. the '('
|
|
9 " must be there). Let me know if this is a problem.
|
|
10
|
|
11 " For version 5.x: Clear all syntax items
|
|
12 " For version 6.x: Quit when a syntax file was already loaded
|
|
13 if !exists("main_syntax")
|
|
14 if version < 600
|
|
15 syntax clear
|
|
16 elseif exists("b:current_syntax")
|
|
17 finish
|
|
18 endif
|
|
19 " we define it here so that included files can test for it
|
|
20 let main_syntax='m4'
|
|
21 endif
|
|
22
|
|
23 " define the m4 syntax
|
|
24 syn match m4Variable contained "\$\d\+"
|
|
25 syn match m4Special contained "$[@*#]"
|
632
|
26 syn match m4Comment "\<\(m4_\)\=dnl\>.*" contains=SpellErrors
|
|
27 syn match m4Constants "\<\(m4_\)\=__file__"
|
|
28 syn match m4Constants "\<\(m4_\)\=__line__"
|
7
|
29 syn keyword m4Constants divnum sysval m4_divnum m4_sysval
|
|
30 syn region m4Paren matchgroup=m4Delimiter start="(" end=")" contained contains=@m4Top
|
|
31 syn region m4Command matchgroup=m4Function start="\<\(m4_\)\=\(define\|defn\|pushdef\)(" end=")" contains=@m4Top
|
|
32 syn region m4Command matchgroup=m4Preproc start="\<\(m4_\)\=\(include\|sinclude\)("he=e-1 end=")" contains=@m4Top
|
|
33 syn region m4Command matchgroup=m4Statement start="\<\(m4_\)\=\(syscmd\|esyscmd\|ifdef\|ifelse\|indir\|builtin\|shift\|errprint\|m4exit\|changecom\|changequote\|changeword\|m4wrap\|debugfile\|divert\|undivert\)("he=e-1 end=")" contains=@m4Top
|
|
34 syn region m4Command matchgroup=m4builtin start="\<\(m4_\)\=\(len\|index\|regexp\|substr\|translit\|patsubst\|format\|incr\|decr\|eval\|maketemp\)("he=e-1 end=")" contains=@m4Top
|
|
35 syn keyword m4Statement divert undivert
|
|
36 syn region m4Command matchgroup=m4Type start="\<\(m4_\)\=\(undefine\|popdef\)("he=e-1 end=")" contains=@m4Top
|
|
37 syn region m4Function matchgroup=m4Type start="\<[_A-Z][_A-Z0-9]*("he=e-1 end=")" contains=@m4Top
|
|
38 syn region m4String start="`" end="'" contained contains=@m4Top,@m4StringContents,SpellErrors
|
|
39 syn cluster m4Top contains=m4Comment,m4Constants,m4Special,m4Variable,m4String,m4Paren,m4Command,m4Statement,m4Function
|
|
40
|
|
41 " Define the default highlighting.
|
|
42 " For version 5.7 and earlier: only when not done already
|
|
43 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
44 if version >= 508 || !exists("did_m4_syn_inits")
|
|
45 if version < 508
|
|
46 let did_m4_syn_inits = 1
|
|
47 command -nargs=+ HiLink hi link <args>
|
|
48 else
|
|
49 command -nargs=+ HiLink hi def link <args>
|
|
50 endif
|
|
51 HiLink m4Delimiter Delimiter
|
|
52 HiLink m4Comment Comment
|
|
53 HiLink m4Function Function
|
|
54 HiLink m4Keyword Keyword
|
|
55 HiLink m4Special Special
|
|
56 HiLink m4String String
|
|
57 HiLink m4Statement Statement
|
|
58 HiLink m4Preproc PreProc
|
|
59 HiLink m4Type Type
|
|
60 HiLink m4Special Special
|
|
61 HiLink m4Variable Special
|
|
62 HiLink m4Constants Constant
|
|
63 HiLink m4Builtin Statement
|
|
64 delcommand HiLink
|
|
65 endif
|
|
66
|
|
67 let b:current_syntax = "m4"
|
|
68
|
|
69 if main_syntax == 'm4'
|
|
70 unlet main_syntax
|
|
71 endif
|
|
72
|
|
73 " vim: ts=4
|