Sunday, April 18, 2010

Re: How to match this error line?

On 19/04/10 01:44, Marc Weber wrote:
> error: syntax error, unexpected $end, expecting STR or DOLLAR_CURLY or '"', at /home/marc/test.nix:2:1
>
> I've tried this code:
>
> set efm=%m\ \,\ at\ %f:%l:%c
> exec 'cfile '.expand('%')
> cope
>
> Something like this can be matched easily..
> /home/marc/test.nix:2:1 `error: syntax error, unexpected $end, expecting STR or DOLLAR_CURLY or '"', at
>
> What's the point I've missed?
>
> I've thought more than once that I should just use regular expressions
> and be done. So what I'm missing? Is it easy to match this error line?
> Or should I parse the result using Vim regex ?
>
> Marc Weber
>

In a :set statement, spaces, double-quotes and backslashes have to be
backslash-escaped.

In the 'efm' value, commas separate entries. To use a literal comma as
part of an entry it must be backslash-escaped. Thus to keep a backslash
as part of the value, /it/ must be backslash-escaped in your :set statement.

But doubling the backslash before the comma in your example would mean
that a space is required on both sides of the comma.

I suggest (untested)

:set efm=%m\\,\ at\ %f:%l:%c

with no space between the backslashes after %m

See :help efm-entries


Best regards,
Tony.
--
Experience is something you don't get until just after you need it.
-- Olivier

--
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

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

No comments: