org.joni.Matcher.match()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.joni.Matcher.match()方法的一些代码示例,展示了Matcher.match()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher.match()方法的具体详情如下:
包路径:org.joni.Matcher
类名称:Matcher
方法名:match

Matcher.match介绍

暂无

代码示例

代码示例来源:origin: apache/phoenix

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: jruby/joni

if (matchCheck(end, s, prev, interrupt)) return match(s);
  return mismatch();
        if (matchCheck(origRange, s, prev, interrupt)) return match(s); // ???
        prev = s;
        s += enc.length(bytes, s, end);
        if (matchCheck(origRange, s, prev, interrupt)) return match(s);
        prev = s;
        s += enc.length(bytes, s, end);
  if (matchCheck(origRange, s, prev, interrupt)) return match(s);
  prev = s;
  s += enc.length(bytes, s, end);
  if (matchCheck(origRange, s, prev, interrupt)) return match(s);
      while (s != -1 && s >= low) {
        prev = enc.prevCharHead(bytes, str, s, end);
        if (matchCheck(origStart, s, prev, interrupt)) return match(s);
        s = prev;
  if (matchCheck(origStart, s, prev, interrupt)) return match(s);
  s = prev;
} while (s >= range);

代码示例来源:origin: jruby/joni

private final int mismatch() {
  if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
    if (msaBestLen >= 0) {
      int s = msaBestS;
      return match(s);
    }
  }
  // falls through finish:
  return FAILED;
}

代码示例来源:origin: org.jruby.joni/joni

if (matchCheck(end, s, prev, interrupt)) return match(s);
  return mismatch();
        if (matchCheck(origRange, s, prev, interrupt)) return match(s); // ???
        prev = s;
        s += enc.length(bytes, s, end);
        if (matchCheck(origRange, s, prev, interrupt)) return match(s);
        prev = s;
        s += enc.length(bytes, s, end);
  if (matchCheck(origRange, s, prev, interrupt)) return match(s);
  prev = s;
  s += enc.length(bytes, s, end);
  if (matchCheck(origRange, s, prev, interrupt)) return match(s);
      while (s != -1 && s >= low) {
        prev = enc.prevCharHead(bytes, str, s, end);
        if (matchCheck(origStart, s, prev, interrupt)) return match(s);
        s = prev;
  if (matchCheck(origStart, s, prev, interrupt)) return match(s);
  s = prev;
} while (s >= range);

代码示例来源:origin: org.jruby.joni/joni

private final int mismatch() {
  if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
    if (msaBestLen >= 0) {
      int s = msaBestS;
      return match(s);
    }
  }
  // falls through finish:
  return FAILED;
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private boolean matches(byte[] bytes, int offset, int len) {
  int range = offset + len;
  Matcher matcher = pattern.matcher(bytes, offset, range);
  int ret = matcher.match(offset, range, Option.DEFAULT);
  return len == ret;
}

代码示例来源:origin: anba/es6draft

@Override
  public boolean matches(int start) {
    return update(matcher.match(byteIndex(start), byteLength, Option.NONE));
  }
}

代码示例来源:origin: org.jruby/jruby-core

public static int matcherMatch(ThreadContext context, Matcher matcher, int start, int range, int option) {
  if (!context.runtime.getInstanceConfig().isInterruptibleRegexps()) return matcher.match(start, range, option);
  try {
    RubyThread thread = context.getThread();
    SearchMatchTask task = new SearchMatchTask(thread, start, range, option, true);
    return thread.executeTask(context, matcher, task);
  } catch (InterruptedException e) {
    throw context.runtime.newInterruptedRegexpError("Regexp Interrupted");
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public static int matcherMatch(ThreadContext context, Matcher matcher, int start, int range, int option) {
  if (!context.runtime.getInstanceConfig().isInterruptibleRegexps()) return matcher.match(start, range, option);
  try {
    RubyThread thread = context.getThread();
    SearchMatchTask task = new SearchMatchTask(thread, start, range, option, true);
    return thread.executeTask(context, matcher, task);
  } catch (InterruptedException e) {
    throw context.runtime.newInterruptedRegexpError("Regexp Interrupted");
  }
}

代码示例来源:origin: org.jruby/jruby-complete

@Override
  public IRubyObject size(IRubyObject[] args) {
    Ruby runtime = getRuntime();
    ByteList value = getByteList();
    Encoding enc = value.getEncoding();
    if (!enc.isUnicode() || isSingleByteOptimizable(RubyString.this, enc)) return rubyLength(runtime);
    Regex reg = RubyRegexp.getRegexpFromCache(runtime, GRAPHEME_CLUSTER_PATTERN, enc, RegexpOptions.NULL_OPTIONS);
    int beg = value.getBegin();
    int end = beg + value.getRealSize();
    Matcher matcher = reg.matcher(value.getUnsafeBytes(), beg, end);
    int count = 0;
    while (beg < end) {
      int len = matcher.match(beg, end, Option.DEFAULT);
      if (len <= 0) break;
      count++;
      beg += len;
    }
    return RubyFixnum.newFixnum(runtime, count);
  }
};

代码示例来源:origin: org.jruby/jruby-core

@Override
  public IRubyObject size(IRubyObject[] args) {
    Ruby runtime = getRuntime();
    ByteList value = getByteList();
    Encoding enc = value.getEncoding();
    if (!enc.isUnicode() || isSingleByteOptimizable(RubyString.this, enc)) return rubyLength(runtime);
    Regex reg = RubyRegexp.getRegexpFromCache(runtime, GRAPHEME_CLUSTER_PATTERN, enc, RegexpOptions.NULL_OPTIONS);
    int beg = value.getBegin();
    int end = beg + value.getRealSize();
    Matcher matcher = reg.matcher(value.getUnsafeBytes(), beg, end);
    int count = 0;
    while (beg < end) {
      int len = matcher.match(beg, end, Option.DEFAULT);
      if (len <= 0) break;
      count++;
      beg += len;
    }
    return RubyFixnum.newFixnum(runtime, count);
  }
};

代码示例来源:origin: org.jruby/jruby-complete

int len = matcher.match(ptr, end, Option.DEFAULT);
if (len <= 0) break;
RubyString result = newStringShared(runtime, ptrBytes, ptr, len, enc);

代码示例来源:origin: org.jruby/jruby-core

int len = matcher.match(ptr, end, Option.DEFAULT);
if (len <= 0) break;
RubyString result = newStringShared(runtime, ptrBytes, ptr, len, enc);

代码示例来源:origin: org.jruby/jruby-core

ret = matcher.match(beg, range, Option.NONE);

代码示例来源:origin: org.jruby/jruby-complete

ret = matcher.match(beg, range, Option.NONE);

代码示例来源:origin: org.netbeans.api/org-jruby

ret = matcher.match(value.begin + pos, value.begin + value.realSize, Option.NONE);            
} else {
  ret = matcher.search(value.begin + pos, value.begin + value.realSize, Option.NONE);

相关文章