/*
* The pattern has only fixed string.
* The engine uses Boyer-Moore.
*/
if (this.fixedStringOnly) {
//System.err.println("DEBUG: fixed-only: "+this.fixedString);
int o = this.fixedStringTable.matches(target, con.start, con.limit);
if (o >= 0) {
if (con.match != null) {
con.match.setBeginning(0, o);
con.match.setEnd(0, o + this.fixedString.length());
}
con.inuse = false;
return true;
}
con.inuse = false;
return false;
}
/*
* The pattern contains a fixed string.
* The engine checks with Boyer-Moore whether the text contains the fixed string or not.
* If not, it return with false.
*/
if (this.fixedString != null) {
int o = this.fixedStringTable.matches(target, con.start, con.limit);
if (o < 0) {
//System.err.println("Non-match in fixed-string search.");
con.inuse = false;
return false;
}
}
int limit = con.limit - this.minlength;
int matchStart;
int matchEnd = -1;
/*
* Checks whether the expression starts with ".*".
*/
if (this.operations != null && this.operations.type == Op.CLOSURE && this.operations.getChild().type == Op.DOT) {
if (isSet(this.options, SINGLE_LINE)) {
matchStart = con.start;
matchEnd = this. [[#variable19084680]](con, this.operations, con.start, 1, this.options);
}
else {
boolean previousIsEOL = true;
for (matchStart = con.start; matchStart <= limit; matchStart++) {
int ch = [[#variable19091a20]];
if (isEOLChar(ch)) {
previousIsEOL = true;
}
else {
if (previousIsEOL) {
if (0 <= (matchEnd = this. [[#variable19084680]](con, this.operations, matchStart, 1, this.options)))
break;
}
previousIsEOL = false;
}
}
}
}
/*
* Optimization against the first character.
*/
else
if (this.firstChar != null) {
//System.err.println("DEBUG: with firstchar-matching: "+this.firstChar);
RangeToken range = this.firstChar;
if (RegularExpression.isSet(this.options, IGNORE_CASE)) {
range = this.firstChar.getCaseInsensitiveToken();
for (matchStart = con.start; matchStart <= limit; matchStart++) {
int ch = [[#variable19091a20]];
if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit) {
ch = REUtil.composeFromSurrogates(ch, [[#variable19091680]]);
if ( !range.match(ch))
continue ;
}
else {
if ( !range.match(ch)) {
char ch1 = Character.toUpperCase((char) ch);
if ( !range.match(ch1))
if ( !range.match(Character.toLowerCase(ch1)))
continue ;
}
}
if (0 <= (matchEnd = this. [[#variable19084680]](con, this.operations, matchStart, 1, this.options)))
break;
}
}
else {
for (matchStart = con.start; matchStart <= limit; matchStart++) {
int ch = [[#variable19091a20]];
if (REUtil.isHighSurrogate(ch) && matchStart + 1 < con.limit)
ch = REUtil.composeFromSurrogates(ch, [[#variable19091680]]);
if ( !range.match(ch))
continue ;
if (0 <= (matchEnd = this. [[#variable19084680]](con, this.operations, matchStart, 1, this.options)))
break;
}
}
}
/*
* Straightforward matching.
*/
else {
for (matchStart = con.start; matchStart <= limit; matchStart++) {
if (0 <= (matchEnd = this. [[#variable19084680]](con, this.operations, matchStart, 1, this.options)))
break;
}
}
if (matchEnd >= 0) {
if (con.match != null) {
con.match.setBeginning(0, matchStart);
con.match.setEnd(0, matchEnd);
}
con.inuse = false;
return true;
}
else {
con.inuse = false;
return false;
}
|