Sunday, February 26, 2023

Re: Syntax keepend/oneline vs. extend

On Sat, 11 Feb 2023, Rob Foehl wrote:

> (Context: including portions of one syntax in another, where the former's use
> of extend doesn't anticipate the latter. I haven't found any obviously right
> way to do this in either the help or the runtime files that ship with Vim,
> only workarounds for specific cases.)

Toying with this a bit more, I managed to work around the issues with
extend by mechanically collecting :syn list output and replacing the
offending bits of the existing syntax, which is... ugly.

The seeming inability to do this otherwise had me wondering why this
problem wasn't more commonplace, and how often extend is actually used in
the syntax files shipped with Vim (as of 9.0.1307):

99 syntax/perl.vim
23 syntax/plsql.vim
22 syntax/php.vim
18 syntax/rpl.vim
14 syntax/fortran.vim
11 syntax/raku.vim
10 syntax/c.vim
8 syntax/rhelp.vim
7 syntax/baan.vim syntax/rib.vim syntax/tt2.vim
6 syntax/cs.vim
4 syntax/ada.vim syntax/pike.vim syntax/xml.vim
3 syntax/obse.vim syntax/typescriptreact.vim
2 [12 files]
1 [14 files]
0 [636 files]

Oh. Of course the one I'm trying to embed is the outlier... Jokes about
only Perl being able to parse Perl aside, am I wrong to presume that at
least a few of those 99 instances might be gratuitous?

Among the dozen or so that I've tripped over thus far, I can't tell what
any of them were actually intended to accomplish. For example:

syn match perlComment "#.*" contains=perlTodo,@Spell extend

Huh? EOL is also end-of-comment, so what's that supposed to do?

-Rob

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/bb8db435-c23a-4e55-4820-76a1d1547a25%40loonybin.net.

No comments: