提交 8cfbc003 编写于 作者: I igerasim

8222684: Better support for patterns

8223163: Better pattern recognition
Reviewed-by: ahgross, bchristi, jeff, rhalade, rriggs, smarks
上级 34aae682
......@@ -1348,7 +1348,11 @@ public final class Pattern
localCount = 0;
if (pattern.length() > 0) {
compile();
try {
compile();
} catch (StackOverflowError soe) {
throw error("Stack overflow during pattern compilation");
}
} else {
root = new Start(lastAccept);
matchRoot = lastAccept;
......@@ -1905,6 +1909,10 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
int ch = temp[cursor++];
while (ch != 0 && !isLineSeparator(ch))
ch = temp[cursor++];
if (ch == 0 && cursor > patternLength) {
cursor = patternLength;
ch = temp[cursor++];
}
return ch;
}
......@@ -1915,6 +1923,10 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
int ch = temp[++cursor];
while (ch != 0 && !isLineSeparator(ch))
ch = temp[++cursor];
if (ch == 0 && cursor > patternLength) {
cursor = patternLength;
ch = temp[cursor];
}
return ch;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册