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

Reply via email to