Friday, May 24, 2013

Re: Implementing nested braces for syntax folding

On Thursday, May 23, 2013 9:08:16 PM UTC+2, Rob Hoelz wrote:
> Hi all,
>
>
>
> I'm working on bringing the Perl runtime files up to speed for the upcoming 7.4 release, but I've encountered an interesting bug and seek the community's help. Attached is an example Perl file. When using the HEAD of vim-perl (https://github.com/vim-perl/vim-perl), the three subroutines fold properly with the default settings. However, with perl_fold_anonymous_subs set to 1, the folding for the third subroutine (which has attributes, which seems to trigger this odd behavior), the fold is not properly ended and continues until the end of the file. The opening brace of the subroutine seems to be counted as an inner brace (see the perlBraces rule), even though it's present in the perlSubFold rule (according to synstack), and that's messing up the folding. I understand not everyone has time to look through a complicated several hundred line syntax file, so I've included a minimal syntax file that demonstrates this behavior as well (although min.vim messes up *all* the folds; the problem is the same, though). Could any syntax gurus or Vim developers help me figure out what I'm doing wrong?
>
>
>
> By the way, I'm using Vim 7.3, patch level 1004. If you're testing with a Vim where the patch level is < 970, you'll need to comment out the line setting the regexpengine.
>
>
>
> Thanks,
>
> Rob

I've fixed this; after diving into syntax.c for a little bit, I discovered that an empty match group following attributes would fix it. I would like to understand how syntax.c works better, though...

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