develooper Front page | perl.perl5.porters | Postings from June 2013

floating /\G/

Thread Next
Dave Mitchell
June 19, 2013 21:35
floating /\G/
Message ID:
I have just discovered that there is nothing in the test suite that tests
a pattern with a floating (rather than anchored) \G, such as /a+\G/; or to
put it another way, adding the following assert doesn't trigger any
failures the test suite:

diff --git a/regcomp.c b/regcomp.c
index 3426112..21ec392 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4577,6 +4577,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RHS=%d\n", -counted 
                if (RExC_rx->gofs < (U32)min)
                    RExC_rx->gofs = min;
             } else {
+                assert(0);
                 RExC_rx->extflags |= RXf_GPOS_FLOAT;
                 RExC_rx->gofs = 0;

Can I assume that a floating \G is a legitimate usage, and that the lack of
tests is just an oversight?

(I'm currently in the middle of a major refactoring of pp_match(), and am
discovering lots of fun stuff).

You're only as old as you look.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About