regular expression in format strings.
Since meta characters of the regular expression language can be part of
ordinary matching strings or file names (and therefore internally have to
be escaped), meta symbols have to be written with leading '%':
%\ The single '\' character. Note that this has to be
escaped ("%\\") in ":set errorformat=" definitions.
%. The single '.' character.
%# The single "*"(!) character.
%^ The single '^' character. Note that this is not
useful, the pattern already matches start of line.
%$ The single '$' character. Note that this is not
useful, the pattern already matches end of line.
%[ The single '[' character for a [] character range.
%~ The single '~' character.
When using character classes in expressions (see |/\i| for an overview),
terms containing the "\+" quantifier can be written in the scanf() "%*"
notation. Example: "%\\d%\\+" ("\d\+", "any number") is equivalent to "%*\\d".
Important note: The \(...\) grouping of sub-matches can not be used in format
specifications because it is reserved for internal conversions.
Multiple entries in 'errorformat' *efm-entries*
To be able to detect output from several compilers, several format patterns
may be put in 'errorformat', separated by commas (note: blanks after the comma
are ignored). The first pattern that has a complete match is used. If no
match is found, matching parts from the last one will be used, although the
file name is removed and the error message is set to the whole message. If
there is a pattern that may match output from several compilers (but not in a
right way), put it after one that is more restrictive.
To include a comma in a pattern precede it with a backslash (you have to type
two in a ":set" command). To include a backslash itself give two backslashes
(you have to type four in a ":set" command). You also need to put a backslash
before a space for ":set".
Valid matches *quickfix-valid*
If a line does not completely match one of the entries in 'errorformat', the
whole line is put in the error message and the entry is marked "not valid"
These lines are skipped with the ":cn" and ":cp" commands (unless there is
no valid line at all). You can use ":cl!" to display all the error messages.
If the error format does not contain a file name Vim cannot switch to the
correct file. You will have to do this by hand.
For example, the format of the output from the Amiga Aztec compiler is:
filename>linenumber:columnnumber:errortype:errornumber:errormessage
filename name of the file in which the error was detected
linenumber line number where the error was detected
columnnumber column number where the error was detected
errortype type of the error, normally a single 'E' or 'W'
errornumber number of the error (for lookup in the manual)
errormessage description of the error
This can be matched with this 'errorformat' entry:
%f>%l:%c:%t:%n:%m
Some examples for C compilers that produce single-line error outputs:
%f:%l:\ %t%*[^0123456789]%n:\ %m for Manx/Aztec C error messages
(scanf() doesn't understand [0-9])
%f\ %l\ %t%*[^0-9]%n:\ %m for SAS C
\"%f\"\\,%*[^0-9]%l:\ %m for generic C compilers
%f:%l:\ %m for GCC
%f:%l:\ %m,%Dgmake[%*\\d]:\ Entering\ directory\ `%f',
%Dgmake[%*\\d]:\ Leaving\ directory\ `%f'
for GCC with gmake (concat the lines!)
%f(%l)\ :\ %*[^:]:\ %m old SCO C compiler (pre-OS5)
%f(%l)\ :\ %t%*[^0-9]%n:\ %m idem, with error type and number
%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m
for GCC, with some extras
Extended examples for the handling of multi-line messages are given below,
see |errorformat-Jikes| and |errorformat-LaTeX|.
Note the backslash in front of a space and double quote. It is required for
the :set command. There are two backslashes in front of a comma, one for the
:set command and one to avoid recognizing the comma as a separator of error
formats.
Filtering messages
If you have a compiler that produces error