33" Maintainer: Claudio Fleiner (claudio@fleiner.com)
44" Last Change: 2022 Jun 12
55" 2025 Sep 2 by Vim project: fix a few syntax issues #18192
6+ " 2025 Sep 5 by Vim project: introduce m4Disabled region #18200
67
78" This file will highlight user function calls if they use only
89" capital letters and have at least one argument (i.e. the '('
2425" – Quotes are nestable;
2526" – The delimiters can be redefined with changequote(); here we only handle
2627" the default pair: ` ... ';
27- " – Quoted text in M4 is rescanned, not treated as a literal string;
28+ " – Quoted text in M4 is rescanned, not treated as a literal string.
2829" Therefore the region is marked transparent so contained items retain
2930" their normal highlighting.
3031syn region m4Quoted
@@ -34,11 +35,20 @@ syn region m4Quoted
3435 \ contains= @m 4Top
3536 \ transparent
3637
38+ " Comments in M4:
39+ " – According to the Open Group Base Specification, comments start with
40+ " a <number-sign> (#) and end at <newline>, unless redefined with changecom().
41+ " We only handle the default here.
42+ " – Comments in M4 are not like in most languages: they do not remove the text,
43+ " they simply prevent any macros from being expanded, while the text remains
44+ " in the output. This region therefore disables any other matches.
45+ " – Comments themselves are disabled when quoted.
46+ syn region m4Disabled start =+ #+ end =+ $+ containedin =ALLBUT,m4Quoted
47+
3748" define the m4 syntax
3849syn match m4Variable contained " \$\d\+ "
3950syn match m4Special contained " $[@*#]"
4051syn match m4Comment " \<\( m4_\)\= dnl\> .*" contains =SpellErrors
41- syn match m4Comment " #.*" contains =SpellErrors
4252syn match m4Constants " \<\( m4_\)\= __file__"
4353syn match m4Constants " \<\( m4_\)\= __line__"
4454syn keyword m4Constants divnum sysval m4_divnum m4_sysval
0 commit comments