On Thu, Jan 03, 2008 at 06:10:36PM +0100, Bram Moolenaar wrote:
> 
> James Vega wrote:
> 
> > The current syntax highlighting of Perl heredocs[0] (and similar
> > constructs in other languages) has a known limitation of highlighting
> > anything after the heredoc start (e.g., "<<EOF") and on the same line as
> > a string instead of using normal highlighting.
> > 
> >  [0] - syn region perlHereDoc matchgroup=perlStringStartEnd 
> > start=+<<\z(\I\i*\)+ end=+^\z1$+ [EMAIL PROTECTED]
> > 
> > After some fiddling around with the syntax highlighting[1], I've been
> > able to get that text to be highlighted normally instead.
> > 
> >  [1] - syn region perlHereDoc matchgroup=perlStringStartEnd 
> > start=+\%(<<\z(\I\i*\).*\n\)\@<=+ end=+^\z1$+ [EMAIL PROTECTED]
> >        syn match perlStringStartEnd +<<\I\i*+ nextgroup=perlHereDoc
> > 
> > The only problem with this is that the perlHereDoc region is trying to
> > match +^$+ (a blank line) as its end pattern instead of a line
> > containing simply the heredoc token.  It seems that since the \z(\) is
> > inside the lookbehind, the external match isn't being saved.
> [snip]
> I don't think this can be changed without causing trouble.

I was a little wary at first too but external matches are only used for
syntax regions so it seems to be a pretty limited (and potentially
useful) change.

> Why don't you use the "\zs" item to change where the region actually
> starts?  That's a lot more efficient too.  Something like this:
> 
>   syn region perlHereDoc matchgroup=perlStringStartEnd 
> start=+<<\z(\I\i*\).*\zs+ end=+^\z1$+ [EMAIL PROTECTED]

I initially tried to use \zs but I couldn't get it to work.  I'm
definitely no syntax highlighting guru though.  I've added Nick to the
CC list in the hopes the discussion might inspire him to a better
solution.

I'll try to dig around in Vim's source this weekend to see if I can get
a working patch for remembering \z(\) and to test if/how it affects
things.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]>

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui