1071d4279SBram Moolenaar" Vim syntax file 2071d4279SBram Moolenaar" Language: M4 38ada17c4SBram Moolenaar" Maintainer: Claudio Fleiner ([email protected]) 4071d4279SBram Moolenaar" URL: http://www.fleiner.com/vim/syntax/m4.vim 58ada17c4SBram Moolenaar" Last Change: 2005 Jan 15 6071d4279SBram Moolenaar 7071d4279SBram Moolenaar" This file will highlight user function calls if they use only 8071d4279SBram Moolenaar" capital letters and have at least one argument (i.e. the '(' 9071d4279SBram Moolenaar" must be there). Let me know if this is a problem. 10071d4279SBram Moolenaar 1189bcfda6SBram Moolenaar" quit when a syntax file was already loaded 12071d4279SBram Moolenaarif !exists("main_syntax") 1389bcfda6SBram Moolenaar if exists("b:current_syntax") 14071d4279SBram Moolenaar finish 15071d4279SBram Moolenaar endif 16071d4279SBram Moolenaar " we define it here so that included files can test for it 17071d4279SBram Moolenaar let main_syntax='m4' 18071d4279SBram Moolenaarendif 19071d4279SBram Moolenaar 20071d4279SBram Moolenaar" define the m4 syntax 21071d4279SBram Moolenaarsyn match m4Variable contained "\$\d\+" 22071d4279SBram Moolenaarsyn match m4Special contained "$[@*#]" 238ada17c4SBram Moolenaarsyn match m4Comment "\<\(m4_\)\=dnl\>.*" contains=SpellErrors 248ada17c4SBram Moolenaarsyn match m4Constants "\<\(m4_\)\=__file__" 258ada17c4SBram Moolenaarsyn match m4Constants "\<\(m4_\)\=__line__" 26071d4279SBram Moolenaarsyn keyword m4Constants divnum sysval m4_divnum m4_sysval 27071d4279SBram Moolenaarsyn region m4Paren matchgroup=m4Delimiter start="(" end=")" contained contains=@m4Top 28071d4279SBram Moolenaarsyn region m4Command matchgroup=m4Function start="\<\(m4_\)\=\(define\|defn\|pushdef\)(" end=")" contains=@m4Top 29071d4279SBram Moolenaarsyn region m4Command matchgroup=m4Preproc start="\<\(m4_\)\=\(include\|sinclude\)("he=e-1 end=")" contains=@m4Top 30071d4279SBram Moolenaarsyn 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 31071d4279SBram Moolenaarsyn region m4Command matchgroup=m4builtin start="\<\(m4_\)\=\(len\|index\|regexp\|substr\|translit\|patsubst\|format\|incr\|decr\|eval\|maketemp\)("he=e-1 end=")" contains=@m4Top 32071d4279SBram Moolenaarsyn keyword m4Statement divert undivert 33071d4279SBram Moolenaarsyn region m4Command matchgroup=m4Type start="\<\(m4_\)\=\(undefine\|popdef\)("he=e-1 end=")" contains=@m4Top 34071d4279SBram Moolenaarsyn region m4Function matchgroup=m4Type start="\<[_A-Z][_A-Z0-9]*("he=e-1 end=")" contains=@m4Top 35071d4279SBram Moolenaarsyn region m4String start="`" end="'" contained contains=@m4Top,@m4StringContents,SpellErrors 36071d4279SBram Moolenaarsyn cluster m4Top contains=m4Comment,m4Constants,m4Special,m4Variable,m4String,m4Paren,m4Command,m4Statement,m4Function 37071d4279SBram Moolenaar 38071d4279SBram Moolenaar" Define the default highlighting. 3989bcfda6SBram Moolenaar" Only when an item doesn't have highlighting yet 40*f37506f6SBram Moolenaarhi def link m4Delimiter Delimiter 41*f37506f6SBram Moolenaarhi def link m4Comment Comment 42*f37506f6SBram Moolenaarhi def link m4Function Function 43*f37506f6SBram Moolenaarhi def link m4Keyword Keyword 44*f37506f6SBram Moolenaarhi def link m4Special Special 45*f37506f6SBram Moolenaarhi def link m4String String 46*f37506f6SBram Moolenaarhi def link m4Statement Statement 47*f37506f6SBram Moolenaarhi def link m4Preproc PreProc 48*f37506f6SBram Moolenaarhi def link m4Type Type 49*f37506f6SBram Moolenaarhi def link m4Special Special 50*f37506f6SBram Moolenaarhi def link m4Variable Special 51*f37506f6SBram Moolenaarhi def link m4Constants Constant 52*f37506f6SBram Moolenaarhi def link m4Builtin Statement 53071d4279SBram Moolenaar 54071d4279SBram Moolenaarlet b:current_syntax = "m4" 55071d4279SBram Moolenaar 56071d4279SBram Moolenaarif main_syntax == 'm4' 57071d4279SBram Moolenaar unlet main_syntax 58071d4279SBram Moolenaarendif 59071d4279SBram Moolenaar 60071d4279SBram Moolenaar" vim: ts=4 61