void setOptimizeMapInfo(OptMapInfo m) { map = m.map; if (enc.isSingleByte()) { forward = Search.MAP_SB_FORWARD; backward = Search.MAP_SB_BACKWARD; } else { forward = Search.MAP_FORWARD; backward = Search.MAP_BACKWARD; } dMin = m.mmd.min; dMax = m.mmd.max; if (dMin != MinMaxLen.INFINITE_DISTANCE) { thresholdLength = dMin + 1; } }
void setOptimizeMapInfo(OptMapInfo m) { map = m.map; if (enc.isSingleByte()) { forward = Search.MAP_SB_FORWARD; backward = Search.MAP_SB_BACKWARD; } else { forward = Search.MAP_FORWARD; backward = Search.MAP_BACKWARD; } dMin = m.mmd.min; dMax = m.mmd.max; if (dMin != MinMaxLen.INFINITE_DISTANCE) { thresholdLength = dMin + 1; } }
public static CodeRangeBuffer addAllMultiByteRange(ScanEnvironment env, CodeRangeBuffer pbuf) { if (!env.enc.isSingleByte()) return setAllMultiByteRange(env, pbuf); return pbuf; }
public static CodeRangeBuffer addAllMultiByteRange(ScanEnvironment env, CodeRangeBuffer pbuf) { if (!env.enc.isSingleByte()) return setAllMultiByteRange(env, pbuf); return pbuf; }
public static int nth(Encoding enc, byte[]bytes, int p, int end, int n) { return nth(enc, bytes, p, end, n, enc.isSingleByte()); }
final boolean singleByteOptimizable(Encoding enc) { return getCodeRange() == CR_7BIT || enc.isSingleByte(); }
public static int nth(Encoding enc, byte[]bytes, int p, int end, int n) { return nth(enc, bytes, p, end, n, enc.isSingleByte()); }
final boolean singleByteOptimizable(Encoding enc) { return getCodeRange() == CR_7BIT || enc.isSingleByte(); }
final boolean singleByteOptimizable() { return getCodeRange() == CR_7BIT || value.getEncoding().isSingleByte(); }
final boolean singleByteOptimizable() { return getCodeRange() == CR_7BIT || value.getEncoding().isSingleByte(); }
protected final int matchAt(int _range, int _sstart, int _sprev, boolean interrupt) throws InterruptedException { range = _range; sstart = _sstart; sprev = _sprev; stk = 0; ip = 0; if (Config.DEBUG_MATCH) debugMatchBegin(); stackInit(); bestLen = -1; s = _sstart; pkeep = _sstart; return enc.isSingleByte() || (msaOptions & Option.CR_7_BIT) != 0 ? executeSb(interrupt) : execute(interrupt); }
protected final int matchAt(int _range, int _sstart, int _sprev, boolean interrupt) throws InterruptedException { range = _range; sstart = _sstart; sprev = _sprev; stk = 0; ip = 0; if (Config.DEBUG_MATCH) debugMatchBegin(); stackInit(); bestLen = -1; s = _sstart; pkeep = _sstart; return enc.isSingleByte() || (msaOptions & Option.CR_7_BIT) != 0 ? executeSb(interrupt) : execute(interrupt); }
public void clearNotFlag(ScanEnvironment env) { if (isNot()) { bs.invert(); if (!env.enc.isSingleByte()) { mbuf = CodeRangeBuffer.notCodeRangeBuff(env, mbuf); } clearNot(); } }
public void clearNotFlag(ScanEnvironment env) { if (isNot()) { bs.invert(); if (!env.enc.isSingleByte()) { mbuf = CodeRangeBuffer.notCodeRangeBuff(env, mbuf); } clearNot(); } }
public static int nth(Encoding enc, byte[]bytes, int p, int end, int n) { if (enc.isSingleByte()) { p += n; } else if (enc.isFixedWidth()) { p += n * enc.maxLength(); } else if (enc.isAsciiCompatible()) { p = nthAsciiCompatible(enc, bytes, p, end, n); } else { p = nthNonAsciiCompatible(enc, bytes, p, end, n); } return p > end ? end : p; }
public static int nth(Encoding enc, byte[]bytes, int p, int end, int n) { if (enc.isSingleByte()) { p += n; } else if (enc.isFixedWidth()) { p += n * enc.maxLength(); } else if (enc.isAsciiCompatible()) { p = nthAsciiCompatible(enc, bytes, p, end, n); } else { p = nthNonAsciiCompatible(enc, bytes, p, end, n); } return p > end ? end : p; }
public IRubyObject getchCommon(ThreadContext context, boolean is1_9) { check(); clearMatched(); Ruby runtime = context.runtime; ByteList value = str.getByteList(); if (pos >= value.getRealSize()) return context.nil; int len; if (is1_9) { Encoding enc = str.getEncoding(); len = enc.isSingleByte() ? 1 : StringSupport.length(enc, value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } else { Encoding enc = runtime.getKCode().getEncoding(); len = enc.isSingleByte() ? 1 : enc.length(value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } if (pos + len > value.getRealSize()) len = value.getRealSize() - pos; lastPos = pos; pos += len; setMatched(); adjustRegisters(); return extractRange(runtime, lastPos + beg, lastPos + end); }
public IRubyObject getchCommon(ThreadContext context, boolean is1_9) { check(); clearMatched(); Ruby runtime = context.runtime; ByteList value = str.getByteList(); if (pos >= value.getRealSize()) return context.nil; int len; if (is1_9) { Encoding enc = str.getEncoding(); len = enc.isSingleByte() ? 1 : StringSupport.length(enc, value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } else { Encoding enc = runtime.getKCode().getEncoding(); len = enc.isSingleByte() ? 1 : enc.length(value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } if (pos + len > value.getRealSize()) len = value.getRealSize() - pos; lastPos = pos; pos += len; setMatched(); adjustRegisters(); return extractRange(runtime, lastPos + beg, lastPos + end); }
public IRubyObject getchCommon(ThreadContext context, boolean is1_9) { check(); clearMatched(); Ruby runtime = context.runtime; ByteList value = str.getByteList(); if (pos >= value.getRealSize()) return runtime.getNil(); int len; if (is1_9) { Encoding enc = str.getEncoding(); len = enc.isSingleByte() ? 1 : StringSupport.length(enc, value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } else { Encoding enc = runtime.getKCode().getEncoding(); len = enc.isSingleByte() ? 1 : enc.length(value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } if (pos + len > value.getRealSize()) len = value.getRealSize() - pos; lastPos = pos; pos += len; setMatched(); adjustRegisters(); return extractRange(runtime, lastPos + beg, lastPos + end); }
public IRubyObject getchCommon(ThreadContext context, boolean is1_9) { check(); clearMatched(); Ruby runtime = context.runtime; ByteList value = str.getByteList(); if (pos >= value.getRealSize()) return runtime.getNil(); int len; if (is1_9) { Encoding enc = str.getEncoding(); len = enc.isSingleByte() ? 1 : StringSupport.length(enc, value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } else { Encoding enc = runtime.getKCode().getEncoding(); len = enc.isSingleByte() ? 1 : enc.length(value.getUnsafeBytes(), value.getBegin() + pos, value.getBegin() + value.getRealSize()); } if (pos + len > value.getRealSize()) len = value.getRealSize() - pos; lastPos = pos; pos += len; setMatched(); adjustRegisters(); return extractRange(runtime, lastPos + beg, lastPos + end); }