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: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] syntax: perl: don't color the character after a variable name
Date: Wed, 7 Aug 2019 19:26:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

>>> "[$@%&*]\$?(\^[][A-Z^_?\]|[0-9]+|[A-Za-z_][0-9A-Za-z_]*|[][`~!@#$%&*-=+;:'",.\\|/?()<>])|\{(\^_?[0-9A-Za-z]+|[0-9]+|[A-Za-z_][0-9A-Za-z_]*)\})"

In the braces fragment, why is an underscore only allowed directly after
a leading caret?  Because with this rule, variables like

    %{^CAPTURE_ALL}
    ${^RE_DEBUG_FLAGS}

are not colored.  So I think the braces fragment can be simplified to:

    \{(\^?[A-Za-z_][0-9A-Za-z_]*|[0-9]+)\}

Do you agree?

Where does it say, by the way, that Perl variable names cannot start with
a digit (unless they are all digits)?  It seems reasonable, but the first
paragraph of the linked document [1] seems to say that something like
$12foo is fine.  (Emacs seems to think it is okay, but vim colors only
the $12 part.)

  [1] https://perldoc.perl.org/perlvar.html

Benno

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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