44" Last Change: 2022 Jun 12
55" 2025 Sep 2 by Vim project: fix a few syntax issues #18192
66" 2025 Sep 5 by Vim project: introduce m4Disabled region #18200
7-
8- " This file will highlight user function calls if they use only
9- " capital letters and have at least one argument (i.e. the '('
10- " must be there). Let me know if this is a problem.
7+ " 2025 Sep 6 by Vim project: remove m4Function heuristics #18211
118
129" quit when a syntax file was already loaded
1310if ! exists (" main_syntax" )
@@ -45,6 +42,13 @@ syn region m4Quoted
4542" – Comments themselves are disabled when quoted.
4643syn region m4Disabled start =+ #+ end =+ $+ containedin =ALLBUT,m4Quoted
4744
45+ " Macros in M4:
46+ " – Name tokens consist of the longest possible sequence of letters, digits,
47+ " and underscores, where the first character is not a digit.
48+ " – In GNU M4, this can be altered with changeword().
49+ " – Any name token may be defined as a macro and quoting prevents expansion.
50+ " Thus correct highlighting requires running M4.
51+
4852" define the m4 syntax
4953syn match m4Variable contained " \$\d\+ "
5054syn match m4Special contained " $[@*#]"
@@ -59,15 +63,13 @@ syn region m4Command matchgroup=m4Statement start="\<\(m4_\)\=\(syscmd\|esyscmd
5963syn region m4Command matchgroup =m4Builtin start =" \<\( m4_\)\=\( len\| index\| regexp\| substr\| translit\| patsubst\| format\| incr\| decr\| eval\| maketemp\) (" he =e - 1 end =" )" contains =@m4Top
6064syn keyword m4Statement divert undivert
6165syn region m4Command matchgroup =m4Type start =" \<\( m4_\)\=\( undefine\| popdef\) (" he =e - 1 end =" )" contains =@m4Top
62- syn region m4Function matchgroup =m4Type start =" \< [_A-Z][_A-Z0-9]*(" he =e - 1 end =" )" contains =@m4Top
63- syn cluster m4Top contains =m4Comment,m4Constants,m4Special,m4Variable,m4Paren,m4Command,m4Statement,m4Function,m4Quoted
66+ syn cluster m4Top contains =m4Comment,m4Constants,m4Special,m4Variable,m4Paren,m4Command,m4Statement,m4Quoted
6467
6568" Define the default highlighting.
6669" Only when an item doesn't have highlighting yet
6770hi def link m4QuoteDelim Delimiter
6871hi def link m4Delimiter Delimiter
6972hi def link m4Comment Comment
70- hi def link m4Function Function
7173hi def link m4Keyword Keyword
7274hi def link m4Special Special
7375hi def link m4Statement Statement
0 commit comments