RFR 8236034 : Use optimized Ques node for curly {0,1} quantifier

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Dec 17 00:03:50 UTC 2019


Hello!

In the regular expressions, the quantifier ? can be equally written as 
{0,1}.

While for the former variant an optimized algorithm is used (coded in 
the Pattern.Ques class), the later variant uses more general and less 
efficient implementation (coded in the Pattern.Curly class).

It would be beneficial, if we unify the implementation for these two 
variants of quantifier and make them both use Ques node.

Also, I couldn't resist to do some refactoring in the affected potion of 
the code to eliminate the repetition of logics.

The regression test was modified to exercise both forms of quantifiers 
equally well.

Would you please help review this enhancement?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8236034
WEBREV: http://cr.openjdk.java.net/~igerasim/8236034/00/webrev/

Thanks in advance!

-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list