summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2014-09-17 00:23:01 +0200
committerYves Orton <demerphq@gmail.com>2014-09-17 04:47:34 +0200
commitd3d47aac53402ea3d4836c60e3659dc927a9887c (patch)
tree90ce6aa3a324b6c2cf4c6b17b2b69f91c4239a7c /regcomp.h
parente1919fe5716d96be44afc32406d9504bc70403de (diff)
downloadperl-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 'regcomp.h')
-rw-r--r--regcomp.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/regcomp.h b/regcomp.h
index 2b73d8655b..b8c2735968 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -140,13 +140,12 @@
#define PREGf_GPOS_SEEN 0x00000100
#define PREGf_GPOS_FLOAT 0x00000200
-#define PREGf_ANCH_BOL 0x00000400
-#define PREGf_ANCH_MBOL 0x00000800
-#define PREGf_ANCH_SBOL 0x00001000
-#define PREGf_ANCH_GPOS 0x00002000
+#define PREGf_ANCH_MBOL 0x00000400
+#define PREGf_ANCH_SBOL 0x00000800
+#define PREGf_ANCH_GPOS 0x00001000
-#define PREGf_ANCH (PREGf_ANCH_SBOL | PREGf_ANCH_GPOS | \
- PREGf_ANCH_MBOL | PREGf_ANCH_BOL )
+#define PREGf_ANCH \
+ ( PREGf_ANCH_SBOL | PREGf_ANCH_GPOS | PREGf_ANCH_MBOL )
/* this is where the old regcomp.h started */