Branch: refs/heads/yves/fix_19989
  Home:   https://github.com/Perl/perl5
  Commit: 1ce6429b0cc41d41c194bcbafe41bc15dfa9c34b
      
https://github.com/Perl/perl5/commit/1ce6429b0cc41d41c194bcbafe41bc15dfa9c34b
  Author: Yves Orton <demer...@gmail.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M t/comp/parser_run.t
    M toke.c

  Log Message:
  -----------
  toke.c - improve handling of $00 and ${00}

In 60267e1d0e12bb5bdc88c62a18294336ab03d4b8 I patched toke.c to refuse
$00 but did not properly handle ${00} and related cases when the code
was unicode. Part of the reason was the confusing macro
VALID_LEN_ONE_IDENT() which despite its name does not restrict what it
matches to things which are one character long.

Since the VALID_LEN_ONE_IDENT() macro is used in only one place and its
name and placement is confusing I have moved it back into the code
inline as part of this fix. I have also added more comments about what
is going on, and moved the related comment directly next to the code
that it affects. If it moved out of this code then we should think of a
better name and be more careful and clear about checking things like
length. I would argue the logic is used to parse what might be called a
variable "description", and thus it is not identical to code which might
validate an actual parsed variable name. Eg, ${^Var} is a description of
the variable whose "name" is "\026ar". The exception of course is $^
whose name actually is "^".

A byproduct of this change is that the logic to detect duplicated
leading zeros is now quite a bit simpler.

This includes more tests for leading zero checks.

See Issue #12948, Issue #19986, and Issue #19989.


Reply via email to