Am 26.04.2020 um 18:03 schrieb Charles Campbell:
John Little wrote:
This is a regression, the syntax/sh.vim from 2019-06-16 does not show
this problem.
The maintainer of this syntax script has his own version numbering,
and if you want to report problems he usually will first ask that you
try the latest script from his web site, which is version 190. It has
the problem. The version on github is 189, dated 2019-10-16.
Version 188, which I have from the Ubuntu 20.04 repository, does not
show the problem. (Neither do versions 125, 133, or 179, which I had
lying around.)
I see the problem. As you can easily check, putting a space right
before the backslash fixes the highlighting. From syntax
highlighting's perspective:
* something preceded by an even number of backslashes should not be
escaped (and thus be normally highlighted)
* something preceded by an odd number of backslashes should be escaped
(and thus highlighted with special highlighting)
However, in this case the backslash is preceded by the double-quote
which starts a string region. The attempt to check for an odd/even
number of backslashes fails,
maybe you just assumed this check is needed while it actually isn't?
You probably mean the following rule:
:syn match shSpecialDQ "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
and thus the backquote is recognized incorrectly as beginning an
in-string command rather than being escaped. Not checking for that
even/odd number of backslashes is obviously going to cause bad
highlighting.
At least for me it isn't obvious.
I need some way to check that a pattern is beginning with a backslash
in a region, and thus can do without the odd-even preceding context
checking. I've asked Bram for something like a "startgroup=..."
expression (similar to nextgroup=...) wherein I could do just that.
Try this rule instead:
:syn match shSpecialDQ "\\[\\"'`$()#]"
We'll see what happens...
Chip Campbell
Checking history ...
date: Thu May 10 17:35:54 2007 +0000
summary: updated for version 7.1b
-" Last Change: Sep 15, 2006
-" Version: 88
+" Last Change: Dec 12, 2006
+" Version: 89
-syn match shSpecial "\\[\\\"\'`$()#]"
+syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
+syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
+syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
Ok, old code already included what I'm about to suggest.
So there must have been a problem ... but I can't find
a problem report.
--
Andy
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/5EAB12F3.4030200%40yahoo.de.