Fix perlElseIfError when used in other syntax type #80

Merged
merged 1 commit into from May 10, 2013

Conversation

Projects
None yet
2 participants
Contributor

benizi commented May 28, 2012

When used in the Mason syntax type, the way the perlElseIfError group
was handled caused any line beginning with 'if' to be highlighted as an
error. This is due to the way Vim includes other syntax files.
perlElseIfError was marked as 'contained', but wasn't limited to a
specific group. When perl.vim gets included, perlElseIfError is then
allowed to exist at what was formerly the top level.

Instead, make the errant '\s*if' of 'elseif' and 'else if' a part of the
perlConditional group, so that perlElseIfError can be confined to
containedin=perlConditional.

In Perl files, everything that should be marked as a perlElseIfError is
handled properly. In Mason files, this prevents the erroneous
perlElseIfError highlighting for 'if', but only marks 'elseif' as an
error (the :syn-keyword perlElseIfError works; the :syn-match doesn't).

Benjamin R. Haskell Fix perlElseIfError when used in other syntax type
When used in the Mason syntax type, the way the perlElseIfError group
was handled caused any line beginning with 'if' to be highlighted as an
error.  This is due to the way Vim includes other syntax files.
perlElseIfError was marked as 'contained', but wasn't limited to a
specific group.  When perl.vim gets included, perlElseIfError is then
allowed to exist at what was formerly the top level.

Instead, make the errant '\s*if' of 'elseif' and 'else if' a part of the
perlConditional group, so that perlElseIfError can be confined to
containedin=perlConditional.

In Perl files, everything that should be marked as a perlElseIfError is
handled properly.  In Mason files, this prevents the erroneous
perlElseIfError highlighting for 'if', but only marks 'elseif' as an
error (the :syn-keyword perlElseIfError works; the :syn-match doesn't).
0ea3bdb
Owner

hoelzro commented Dec 18, 2012

@benizi Could you provide a sample Mason file that demonstrates this behavior, as well as perhaps a screenshot? I'm unable to reproduce this issue at the moment, but I've only written a very small Mason file.

Contributor

benizi commented Dec 18, 2012

I don't use Mason (or even Perl that much lately). Someone reported the issue against my mostly-abandoned fork. I have no idea whether it's valid Mason syntax, but here's what I was using to test the fix:

% my $noun = 'World';
Hello <% $noun %>!
How are ya?
<% if (1) { $noun } elsif (1) { $noun } else { $yay } %>
<% if (1) { $noun } elseif (1) { $noun } else { $yay } %>
<% if (1) { $noun } else if (1) { $noun } else { $yay } %>
<% if (1) { $noun } else
if (1) { $noun } else { $yay } %>
Owner

hoelzro commented Dec 18, 2012

@benizi Much appreciated; I see what you're saying now! I'll look into this tomorrow.

hoelzro merged commit 95a2af4 into vim-perl:master May 10, 2013

Owner

hoelzro commented May 10, 2013

Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment