void concat(OptExactInfo other, Encoding enc) { if (ignoreCase < 0) { ignoreCase = other.ignoreCase; } else if (ignoreCase != other.ignoreCase) { return; } int p = 0; // add->s; int end = p + other.length; int i; for (i = length; p < end;) { int len = enc.length(other.bytes, p, end); if (i + len > OPT_EXACT_MAXLEN) break; for (int j = 0; j < len && p < end; j++) { bytes[i++] = other.bytes[p++]; // arraycopy or even don't copy anything ?? } } length = i; reachEnd = (p == end ? other.reachEnd : false); OptAnchorInfo tmp = new OptAnchorInfo(); tmp.concat(anchor, other.anchor, 1, 1); if (!reachEnd) tmp.rightAnchor = 0; anchor.copy(tmp); }
void clear() { mmd.clear(); anchor.clear(); reachEnd = false; ignoreCase = -1; length = 0; }
void add(int anchor) { if (isLeftAnchor(anchor)) { leftAnchor |= anchor; } else { rightAnchor |= anchor; } }
case AnchorType.LOOK_BEHIND: /* just for (?<=x).* */ case AnchorType.PREC_READ_NOT: /* just for (?!x).* */ opt.anchor.add(an.type); break; if (oenv.mmd.max == 0 && qn.target.getType() == NodeType.CANY && qn.greedy) { if (isMultiline(oenv.options)) { opt.anchor.add(AnchorType.ANYCHAR_STAR_ML); } else { opt.anchor.add(AnchorType.ANYCHAR_STAR); } else { // USE_SUBEXP_CALL optimizeNodeLeft(en.target, opt, oenv); if (opt.anchor.isSet(AnchorType.ANYCHAR_STAR_MASK)) { if (bsAt(oenv.scanEnv.backrefedMem, en.regNum)) { opt.anchor.remove(AnchorType.ANYCHAR_STAR_MASK);
void copy(OptMapInfo other) { mmd.copy(other.mmd); anchor.copy(other.anchor); value = other.value; System.arraycopy(other.map, 0, map, 0, other.map.length); }
void altMerge(OptMapInfo other, Encoding enc) { /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ if (value == 0) return; if (other.value == 0 || mmd.max < other.mmd.max) { clear(); return; } mmd.altMerge(other.mmd); int val = 0; for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { if (other.map[i] != 0) map[i] = 1; if (map[i] != 0) val += positionValue(enc, i); } value = val; anchor.altMerge(other.anchor); }
public String optimizeInfoToString() { String s = ""; s += "optimize: " + (forward != null ? forward.getName() : "NONE") + "\n"; s += " anchor: " + OptAnchorInfo.anchorToString(anchor); s += " sub anchor: " + OptAnchorInfo.anchorToString(subAnchor) + "\n";
case AnchorType.LOOK_BEHIND: /* just for (?<=x).* */ case AnchorType.PREC_READ_NOT: /* just for (?!x).* */ opt.anchor.add(an.type); break; if (oenv.mmd.max == 0 && qn.target.getType() == NodeType.CANY && qn.greedy) { if (isMultiline(oenv.options)) { opt.anchor.add(AnchorType.ANYCHAR_STAR_ML); } else { opt.anchor.add(AnchorType.ANYCHAR_STAR); } else { // USE_SUBEXP_CALL optimizeNodeLeft(en.target, opt, oenv); if (opt.anchor.isSet(AnchorType.ANYCHAR_STAR_MASK)) { if (bsAt(oenv.scanEnv.backrefedMem, en.regNum)) { opt.anchor.remove(AnchorType.ANYCHAR_STAR_MASK);
void copy(OptExactInfo other) { mmd.copy(other.mmd); anchor.copy(other.anchor); reachEnd = other.reachEnd; ignoreCase = other.ignoreCase; length = other.length; System.arraycopy(other.bytes, 0, bytes, 0, OPT_EXACT_MAXLEN); }
void altMerge(OptMapInfo other, Encoding enc) { /* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */ if (value == 0) return; if (other.value == 0 || mmd.max < other.mmd.max) { clear(); return; } mmd.altMerge(other.mmd); int val = 0; for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) { if (other.map[i] != 0) map[i] = 1; if (map[i] != 0) val += positionValue(enc, i); } value = val; anchor.altMerge(other.anchor); }
public String optimizeInfoToString() { String s = ""; s += "optimize: " + (forward != null ? forward.getName() : "NONE") + "\n"; s += " anchor: " + OptAnchorInfo.anchorToString(anchor); s += " sub anchor: " + OptAnchorInfo.anchorToString(subAnchor) + "\n";
void concat(OptExactInfo other, Encoding enc) { if (ignoreCase < 0) { ignoreCase = other.ignoreCase; } else if (ignoreCase != other.ignoreCase) { return; } int p = 0; // add->s; int end = p + other.length; int i; for (i = length; p < end;) { int len = enc.length(other.bytes, p, end); if (i + len > OPT_EXACT_MAXLEN) break; for (int j = 0; j < len && p < end; j++) { bytes[i++] = other.bytes[p++]; // arraycopy or even don't copy anything ?? } } length = i; reachEnd = (p == end ? other.reachEnd : false); OptAnchorInfo tmp = new OptAnchorInfo(); tmp.concat(anchor, other.anchor, 1, 1); if (!reachEnd) tmp.rightAnchor = 0; anchor.copy(tmp); }
void copy(OptMapInfo other) { mmd.copy(other.mmd); anchor.copy(other.anchor); value = other.value; System.arraycopy(other.map, 0, map, 0, other.map.length); }
void clear() { mmd.clear(); anchor.clear(); value = 0; for (int i=0; i<map.length; i++) map[i] = 0; }
public void altMerge(NodeOptInfo other, OptEnvironment env) { anchor.altMerge(other.anchor); exb.altMerge(other.exb, env); exm.altMerge(other.exm, env); expr.altMerge(other.expr, env); map.altMerge(other.map, env.enc); length.altMerge(other.length); }
void remove(int anchor) { if (isLeftAnchor(anchor)) { leftAnchor &= ~anchor; } else { rightAnchor &= ~anchor; } }
public void concatLeftNode(NodeOptInfo other, Encoding enc) { OptAnchorInfo tanchor = new OptAnchorInfo(); // remove it somehow ? tanchor.concat(anchor, other.anchor, length.max, other.length.max); anchor.copy(tanchor); tanchor.concat(anchor, other.exb.anchor, length.max, other.length.max); other.exb.anchor.copy(tanchor);
void copy(OptExactInfo other) { mmd.copy(other.mmd); anchor.copy(other.anchor); reachEnd = other.reachEnd; ignoreCase = other.ignoreCase; length = other.length; System.arraycopy(other.bytes, 0, bytes, 0, OPT_EXACT_MAXLEN); }
void clear() { mmd.clear(); anchor.clear(); reachEnd = false; ignoreCase = -1; length = 0; }
public void altMerge(NodeOptInfo other, OptEnvironment env) { anchor.altMerge(other.anchor); exb.altMerge(other.exb, env); exm.altMerge(other.exm, env); expr.altMerge(other.expr, env); map.altMerge(other.map, env.enc); length.altMerge(other.length); }