[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] syntax: perl: don't color the character after a

From: Brand Huntsman
Subject: Re: [Nano-devel] [PATCH] syntax: perl: don't color the character after a variable name
Date: Fri, 9 Aug 2019 12:27:47 -0600

On Fri, 9 Aug 2019 14:05:40 +0200
Benno Schulenberg <address@hidden> wrote:

> The current rules also color @$, @&, &$, and &&, for example.  And
> that last one certainly is not a variable name and should not be
> colored as one.  Maybe only $<punct> is a variable name, and not
> @<punct>, %<punct>, and &<punct>?

perl -e '@$ = 1; print @$'
perl -e '%$ = 1; print %$'
perl -e '&$ = 1;'
Undefined subroutine &main::$ called at -e line 1.

So the punctuation set needs [$@%] sigils. And you forgot to remove \ and / 
from the punctuation set.

You can also remove the \$? now that punctuation is in a separate regex.

Can't really do much about it, but the $) in /(foo|$)/ is also colored. $) is 
the gid and more likely to be used in expressions, so it can't be treated like 
$\ and $/.

> Also, for the leading-caret part (\^[]A-Z^_?\[]), why are ] and ^
> and ? and \ and [ allowed after a leading caret?

"Perl variable names may also be ... or the two-character sequence: ^ (caret or
CIRCUMFLEX ACCENT) followed by any one of the characters [][A-Z^_?\] ."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]