This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate the duplicative regops BOL and EOL
authorYves Orton <demerphq@gmail.com>
Tue, 16 Sep 2014 22:23:01 +0000 (00:23 +0200)
committerYves Orton <demerphq@gmail.com>
Wed, 17 Sep 2014 02:47:34 +0000 (04:47 +0200)
commitd3d47aac53402ea3d4836c60e3659dc927a9887c
tree90ce6aa3a324b6c2cf4c6b17b2b69f91c4239a7c
parente1919fe5716d96be44afc32406d9504bc70403de
Eliminate the duplicative regops BOL and EOL

See also perl5porters thread titled: "Perl MBOLism in regex engine"

In the perl 5.000 release (a0d0e21ea6ea90a22318550944fe6cb09ae10cda)
the BOL regop was split into two behaviours MBOL and SBOL, with SBOL
and BOL behaving identically. Similarly the EOL regop was split into
two behaviors SEOL and MEOL, with EOL and SEOL behaving identically.

This then resulted in various duplicative code related to flags and
case statements in various parts of the regex engine.

It appears that perhaps BOL and EOL were kept because they are the
type ("regkind") for SBOL/MBOL and SEOL/MEOL/EOS. Reworking regcomp.pl
to handle aliases for the type data so that SBOL/MBOL are of type
BOL, even though BOL == SBOL seems to cover that case without adding
to the confusion.

This means two regops, a regstate, and an internal regex flag can
be removed (and used for other things), and various logic relating
to them can be removed.

For the uninitiated, SBOL is /^/ and /\A/ (with or without /m) and
MBOL is /^/m. (I consider it a fail we have no way to say MBOL without
the /m modifier). Similarly SEOL is /$/ and MEOL is /$/m (there is
also a /\z/ which is EOS "end of string" with or without the /m).
dump.c
ext/re/t/regop.t
pod/perldebguts.pod
regcomp.c
regcomp.h
regcomp.sym
regen/regcomp.pl
regexec.c
regnodes.h