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.
> 
> Could Vim's regex handling be changed to save the external match even
> though it's being matched in a zero-width atom?
> 
> This snippet of Perl code can be used to check the syntax highlighting.
> 
>  print <<END and print "bar\n";
>  foo
>  END
>  $foo = "bar\n";
> 
> Currently, everything between "<<END" and "END" is highlighted as a string.
> With the above changes "<<END" and all the lines after the print
> statement are highlighted as a string.  Adding a blank line after the
> "END" line will cause the final line to be properly highlighted.

I don't think this can be changed without causing trouble.

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]
 
Disclaimer: Didn't try if this actually works...
You probably need to move the matchgroup to a separate item.

-- 
Computers are not intelligent.  They only think they are.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui