develooper Front page | perl.perl5.changes | Postings from January 2021

[Perl/perl5] d744bf: perlrebackslash: A few tweaks

From:
Karl Williamson via perl5-changes
Date:
January 14, 2021 15:33
Subject:
[Perl/perl5] d744bf: perlrebackslash: A few tweaks
Message ID:
Perl/perl5/push/refs/heads/smoke-me/khw-pr7/000000-b34409@github.com
  Branch: refs/heads/smoke-me/khw-pr7
  Home:   https://github.com/Perl/perl5
  Commit: d744bf9231bec3c43ff41cb7ecd2d5762245a0d9
      https://github.com/Perl/perl5/commit/d744bf9231bec3c43ff41cb7ecd2d5762245a0d9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M pod/perlrebackslash.pod

  Log Message:
  -----------
  perlrebackslash: A few tweaks

Some white-space changes for vertical alignment, a new example, and
a couple of clarifications.


  Commit: e4de8ca611cbb2bd85e68f0bd8cfc84ded904814
      https://github.com/Perl/perl5/commit/e4de8ca611cbb2bd85e68f0bd8cfc84ded904814
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: Change names of 2 macros for mnemonics

The new names are more understandable to me.  This also adds a second
parameter to one macro, that is unused until the next commit in the
series.


  Commit: 69cf18daaf7501365cf01220a1b25397456c0797
      https://github.com/Perl/perl5/commit/69cf18daaf7501365cf01220a1b25397456c0797
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M proto.h
    M regcomp.c
    M toke.c

  Log Message:
  -----------
  Revamp regcurly(), regpiece() use of it

This commit copies portions of new_regcurly(), which has been around
since 5.28, into plain regcurly(), as a baby step in preparation for
converting entirely to the new one.  These functions are used for
parsing {m,n} quantifiers.  Future commits will add capabilities not
available using the old version.

The commit adds an optional parameter, to return to the caller
information it gleans during parsing.

regpiece() is changed by this commit to use this information, instead of
itself reparsing the input.  Part of the reason for this commit is that
changes are planned soon to what is legal syntax.  With this commit in
place, those changes only have to be done once.

This commit also extracts into a function the calculation of the
quantifier bounds.  This allows the logic for that to be done in one
place instead of two.


  Commit: 1304be63f65c8805120b1b2616d2a133e541d26c
      https://github.com/Perl/perl5/commit/1304be63f65c8805120b1b2616d2a133e541d26c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c
    M t/re/reg_mesg.t

  Log Message:
  -----------
  Point to error in malformed /x{y,z}/

Prior to this comment a curly quantifier that had an error in the bounds
pointed to the left brace.  Now the error message points to the first
bound that has a problem.


  Commit: efe2dd999939af84d8ad4cc6c475da82e9e1a453
      https://github.com/Perl/perl5/commit/efe2dd999939af84d8ad4cc6c475da82e9e1a453
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M embed.fnc
    M embed.h
    M pod/perldelta.pod
    M pod/perlre.pod
    M pod/perlrequick.pod
    M pod/perlreref.pod
    M pod/perlretut.pod
    M proto.h
    M regcomp.c
    M t/re/re_tests
    M t/re/reg_mesg.t

  Log Message:
  -----------
  Allow empty lower bound in /{,n}/

This change has been planned for a long time, bringing Perl into parity
with similar languages, but it took many deprecation cycles to be able
to reach the point where it could safely go in.

This fixes GH #18264


  Commit: 487618064b70077b235a2e6488dffad8fe9fa67a
      https://github.com/Perl/perl5/commit/487618064b70077b235a2e6488dffad8fe9fa67a
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M toke.c

  Log Message:
  -----------
  toke.c: Slight simplification

Rather than know how far we have advanced in parsing when we have to
back up, save the checkpoint position and simply backtrack to it.  This
results in slightly more maintainable code that a future commit will
take advantage of.


  Commit: 32d4184aeb52924e5e323b04cb358df8f06f6ef3
      https://github.com/Perl/perl5/commit/32d4184aeb52924e5e323b04cb358df8f06f6ef3
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M toke.c

  Log Message:
  -----------
  toke.c: Change variable name

A future commit will need it to represent just the meaning of the new
name


  Commit: d4bb2c14bc359932e6a0d09fd1118dc5e1917a2c
      https://github.com/Perl/perl5/commit/d4bb2c14bc359932e6a0d09fd1118dc5e1917a2c
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M toke.c

  Log Message:
  -----------
  toke.c: White-space, comment only


  Commit: 0fdb88c626943058e5ba1069d6d814dd667c9f80
      https://github.com/Perl/perl5/commit/0fdb88c626943058e5ba1069d6d814dd667c9f80
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M dquote.c

  Log Message:
  -----------
  dquote.c: Change variable name

A future commit will need it to represent just the meaning of the new
name


  Commit: b7972aeb7bca1ab0074c73c3387c2cf2f6e522cf
      https://github.com/Perl/perl5/commit/b7972aeb7bca1ab0074c73c3387c2cf2f6e522cf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M t/re/reg_mesg.t

  Log Message:
  -----------
  t/re/reg_mesg.t: Add two missing test cases

I noticed in code reading that these error cases weren't tested for.


  Commit: 79787ed61e0fe22bea5e63a3b0374aaf2d888eaf
      https://github.com/Perl/perl5/commit/79787ed61e0fe22bea5e63a3b0374aaf2d888eaf
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: Slight simplification

Rather than know how far we have advanced in parsing when we have to
back up, use the already-existing checkpoint position.  This results in
slightly more maintainable code that a future commit will take advantage
of.


  Commit: c7b2bd9f1675c8ab1ed0973f3f485774c2e3d441
      https://github.com/Perl/perl5/commit/c7b2bd9f1675c8ab1ed0973f3f485774c2e3d441
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: Move initialization into declaration

This is considered better practice.


  Commit: 88436d8ed550c7633af833671cfe48bcb2055063
      https://github.com/Perl/perl5/commit/88436d8ed550c7633af833671cfe48bcb2055063
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: Refactor portions of \g parsing

This moves the finding of the matching '}' for \g{ to earlier, and
creates a temporary to point to the current position in the parse.  This
makes it easier to deal with backtracking; we haven't advanced the main
parse pointer, so don't have to remember how far we advanced.  This will
prove advantageous in a future commit.


  Commit: 5630177b4f85bcfb86246551e3c653e13c4e26f9
      https://github.com/Perl/perl5/commit/5630177b4f85bcfb86246551e3c653e13c4e26f9
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: Further refactor \g

By changing a bool into a pointer, we can avoid some work and prepare
for a future commit.


  Commit: b6688c7185c3f9b9ccbe0925d6593c9823060447
      https://github.com/Perl/perl5/commit/b6688c7185c3f9b9ccbe0925d6593c9823060447
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M pod/perlre.pod
    M regcomp.c

  Log Message:
  -----------
  perlre: Note the other forms of \k<name>

Not all three synonyms were documented.

This also fixes up related comments in regcomp.c to correspond


  Commit: c9f7d1dd474667589db1fde4854043b3a0f73108
      https://github.com/Perl/perl5/commit/c9f7d1dd474667589db1fde4854043b3a0f73108
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M dquote.c
    M embed.fnc
    M pod/perldelta.pod
    M pod/perldiag.pod
    M pod/perlop.pod
    M pod/perlre.pod
    M pod/perlrebackslash.pod
    M pod/perlrequick.pod
    M pod/perlretut.pod
    M proto.h
    M regcomp.c
    M t/opbasic/qq.t
    M t/re/pat_advanced.t
    M t/re/re_tests
    M t/re/reg_mesg.t
    M toke.c

  Log Message:
  -----------
  Allow blanks within and adjacent to {...} constructs

This was the consensus in
http://nntp.perl.org/group/perl.perl5.porters/258489


  Commit: b344091fe63ebfd2156d62494d5b244c72e0aa07
      https://github.com/Perl/perl5/commit/b344091fe63ebfd2156d62494d5b244c72e0aa07
  Author: Karl Williamson <khw@cpan.org>
  Date:   2021-01-14 (Thu, 14 Jan 2021)

  Changed paths:
    M regcomp.c

  Log Message:
  -----------
  regcomp.c: White-space and comments


Compare: https://github.com/Perl/perl5/compare/d744bf9231be%5E...b344091fe63e



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About