nano-devel
[Top][All Lists]
Advanced

[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: Sun, 11 Aug 2019 13:18:49 -0600

On Sun, 11 Aug 2019 19:37:49 +0200
Benno Schulenberg <address@hidden> wrote:

> Vim does does highlight any of "@$ @@ @% @&  %$ %@ %% %&  &$ &@ &%
> &&", so I think we can let also nano highlight only $<punct> and not
> @<punct> nor %<punct> nor &<punct>.  See the updated upcoming fifth
> version of the patch.  This "miscolors" $$var, because it colors both
> sigils, which is inconsistent.  But it's either that, or not color $$.

That ranged punctuation set in third regex obscures what characters it actually 
highlights, does it contain the $ character? Because $$var only highlights the 
$var for me.


> +color cyan "[$@%&]([A-Za-z_][0-9A-Za-z_]*|\^[][A-Z^_?\]|[0-9]+)\>"
> +color cyan "[$@%&]\{(\^?[A-Za-z_][0-9A-Za-z_]*|[0-9]+)\}"

The second regex is missing the \^[][^?\] characters from \^[][A-Z^_?\].

"[$@%&]\{(\^?[A-Za-z_][0-9A-Za-z_]*|\^[][^?\]|[0-9]+)\}"


> +color cyan "\$([][!-.:-@`|~]|\{[][!-/:-@\`|~]\})"

The bracketed punctuation should support all sigils.

And what about moving the $@%& punctuation to a separate regex? Non-sigil 
punctuation could then use all four sigils.

"[$@%&][][`~!#*=+;:'",.|?()<>-]"
"[$@%&]\{[][`~!#*=+;:'",.|?()<>/\$@%&-]\}"
"\$[$@%&]"

The [@%][$@%&] and &[$@%] variables won't be highlighted, but the more common 
\$[$@%&] variables would be. It causes all of $$var to be highlighted, but 
multiple highlighted $ sigils are easier to read than mixed highlighted sigils.


> +color cyan "(^|[[:space:]])[$@%][/\]"

If punctuation only supports the $ sigil, so should /\, for consistency.




reply via email to

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