This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regex: Make \R simple again.
authorKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 17:40:24 +0000 (11:40 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 18:20:22 +0000 (12:20 -0600)
commite64f369d58efdbd31eecf147ef006f0f69e17fc2
treebbaef1268a547c52cbc6609b90d766d8c67c826f
parent4063ade8503ac8877a02fc4eae8ebbe242b9110b
regex: Make \R simple again.

Commit 565fc1bb88638c2490cdab7a1055007f6b2d577c was based on my
misunderstanding of what regrepeat() operates on.  It is designed to
operate on nodes that are quantifiable without having to be
parenthesized.  So, in 'a?', the node generated for 'a' is quantifiable
as-is, but if you want to quantify 'ab', you have to parenthesize them,
like '(?:ab)?'

\R is such a node, since you can say things like '\R+'.  There was
indeed a bug, and that commit fixed it, but suboptimally.

This patch essentially reverts the commit mentioned above, and solves
the problem in a better way; it adds comments so that future
maintainters will be less likely to be led astray than I was.

It also adds a 'SIMPLE' flag for an expression that in my previous
misunderstanding didn't think was simple.  (It's enclosed in
parentheses, and hence can serve as an operand to a quantifier.)
regcomp.c
regexec.c