Thursday, March 7, 2013

Re: errorformat setup

On Thursday, March 7, 2013 2:44:42 PM UTC-5, FlashBurn wrote:
> On Thursday, March 7, 2013 1:53:48 PM UTC-5, Ben Fritz wrote:
> > On Thursday, March 7, 2013 12:38:44 PM UTC-6, FlashBurn wrote:
> > > On Thursday, March 7, 2013 12:17:26 PM UTC-5, FlashBurn wrote:
> > > > I'm having trouble figuring out how to setup errorformat. I know the format of my compiler and lint tool is setup as follows:
> > > >
> > > > "<filename>",<linenumber> <error type> <error number>: <error message>
> > > >
> > > > but right from the start I'm having an issue. How do I specify quotation marks in the error format?
> > > >
> > > > Also I have a side question. errorformat help talks about %*{conv}, %O/P/Q. I was not able to find definitions for those? Can anyone point me in the right direction?
> > > >
> > > > Any help is appreciated.
> > >
> > > I'm able partially to setup my errorformat but for some reason it won't recognize the error number
> > >
> > > Here is partial output from my compiler
> > >
> > > "C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c",126 Info 754: local structure member 'myStructMember' (line 126, file C:\Documents and Settings\user\Projects\MyProject\trunk\src\myfile.c) not referenced
> > >
> > > I incrementally tried to setup my errorformat
> > > This one works but it is not exactly what I need
> > > set errorformat=\"%f\"\\,%l\ \ %t%s
> > >
> > > For some reason this one stops working
> > > set errorformat=\"%f\"\\,%l\ \ %t\ %s
> > >
> > > Does anybody know what is the issue?
> > >
> >
> > %t finds a single character, not a whole word. So in your first case %t matches the "I" in "Info". When you add a space, it no longer matches, because there is no space character after the "I".
> >
> > Additionally you may want %n (to match the 754 after "Info") and %m instead of %s to capture the rest of the string as an error string to output with the error number.
> >
> > I'm not sure whether there is a workaround for the fact that %t only takes a single character. I don't know if it will work, but I've thought about trying to start and end a multi-line message (:help errorformat-multi-line) on the same line to specify the error type explicitly.
>
> Ben,
>
> Thanks a lot for helping out. Once I read your answer and did a little bit of googling it became clear what needs to be done. It turns out you can do a pattern matching inside the errorformat. It is explained between
> :help efm-ignore and :help efm-entries. The user needs to use %* for pattern matching.
>
> I set my errorformat to the following:
>
> "match the filename and line number
> let &errorformat = \"%f\"\\,%l
> " match white space, first character of error type, the rest of the characters of the error type, and white space again.
> let &errorformat .= %*\\s%t%*\\w%*\\s
> "match error number, whitespace and error message.
> let &errorformat .= %n%*\\s%m
>
> It worked. Now I must match multiline output from the compiler.

Slight mistake in the erroformat, here is what it should be:

" Match the filename and line number
let &errorformat = '"%f"\,%l'
" Match white space, first character of error type, the rest of the characters
" of the error type, and white space again.
let &errorformat .= '%*\s%t%*\w%*\s'
"Match error number, whitespace and error message.
let &errorformat .= '%n:%*\s%m'

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: