diff options
author | Yves Orton <demerphq@gmail.com> | 2014-09-17 00:23:01 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2014-09-17 04:47:34 +0200 |
commit | d3d47aac53402ea3d4836c60e3659dc927a9887c (patch) | |
tree | 90ce6aa3a324b6c2cf4c6b17b2b69f91c4239a7c /ext/re | |
parent | e1919fe5716d96be44afc32406d9504bc70403de (diff) | |
download | perl-d3d47aac53402ea3d4836c60e3659dc927a9887c.tar.gz |
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).
Diffstat (limited to 'ext/re')
-rw-r--r-- | ext/re/t/regop.t | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/re/t/regop.t b/ext/re/t/regop.t index 869b5a803b..8ed2029c0a 100644 --- a/ext/re/t/regop.t +++ b/ext/re/t/regop.t @@ -263,7 +263,7 @@ Freeing REx: "[q]" #Compiling REx "^(\S{1,9}):\s*(\d+)$" #synthetic stclass "ANYOF[\x{00}-\x{06}\a\b\x{0E}-\x{1F}\x{21}-\x{FF}][{utf8}0100-167F 1681-1FFF 200B-2027 202A-202E 2030-205E 2060-2FFF 3001-INFINITY]". #Final program: -# 1: BOL (2) +# 1: SBOL (2) # 2: OPEN1 (4) # 4: CURLY {1,9} (7) # 6: NPOSIXD[\s] (0) @@ -277,8 +277,8 @@ Freeing REx: "[q]" # 17: CLOSE2 (19) # 19: EOL (20) # 20: END (0) -#floating ":" at 1..9 (checking floating) stclass ANYOF[\x{00}-\x{06}\a\b\x{0E}-\x{1F}\x{21}-\x{FF}][{utf8}0100-167F 1681-1FFF 200B-2027 202A-202E 2030-205E 2060-2FFF 3001-INFINITY] anchored(BOL) minlen 3 +#floating ":" at 1..9 (checking floating) stclass ANYOF[\x{00}-\x{06}\a\b\x{0E}-\x{1F}\x{21}-\x{FF}][{utf8}0100-167F 1681-1FFF 200B-2027 202A-202E 2030-205E 2060-2FFF 3001-INFINITY] anchored(SBOL) minlen 3 #Freeing REx: "^(\S{1,9}):\s*(\d+)$" -floating ":" at 1..9 (checking floating) stclass ANYOF[\x{00}-\x{06}\a\b\x{0E}-\x{1F}\x{21}-\x{FF}][{utf8}0100-167F 1681-1FFF 200B-2027 202A-202E 2030-205E 2060-2FFF 3001-INFINITY] anchored(BOL) minlen 3 +floating ":" at 1..9 (checking floating) stclass ANYOF[\x{00}-\x{06}\a\b\x{0E}-\x{1F}\x{21}-\x{FF}][{utf8}0100-167F 1681-1FFF 200B-2027 202A-202E 2030-205E 2060-2FFF 3001-INFINITY] anchored(SBOL) minlen 3 %MATCHED% synthetic stclass |