org.jruby.Ruby.newRegexpError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(147)

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

Ruby.newRegexpError介绍

暂无

代码示例

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) {
  // TODO: we loose encoding information here, fix it
  throw runtime.newRegexpError(err + ": " + regexpDescription19(runtime, bytes, options, enc));
}

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

public static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) {
  // TODO: we loose encoding information here, fix it
  throw runtime.newRegexpError(err + ": " + regexpDescription19(runtime, bytes, options, enc));
}

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

public static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) {
  // TODO: we loose encoding information here, fix it
  throw runtime.newRegexpError(err + ": " + regexpDescription19(runtime, bytes, options, enc));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) {
  // TODO: we loose encoding information here, fix it
  throw runtime.newRegexpError(err + ": " + regexpDescription19(runtime, bytes, options, enc));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void raiseRegexpError(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err) {
  throw runtime.newRegexpError(err + ": " + regexpDescription(runtime, bytes, enc, options));
}

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

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) {
  try {
    return new RubyRegexp(runtime, pattern.getByteList(), options.clone());
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, int joniOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromJoniOptions(joniOptions);
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) {
  try {
    return new RubyRegexp(runtime, pattern.getByteList(), (RegexpOptions)options.clone());
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

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

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, int joniOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromJoniOptions(joniOptions);
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

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

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, int joniOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromJoniOptions(joniOptions);
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

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

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) {
  try {
    return new RubyRegexp(runtime, pattern.getByteList(), options.clone());
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) {
  try {
    return new RubyRegexp(runtime, pattern.getByteList(), (RegexpOptions)options.clone());
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexp(Ruby runtime, RubyString pattern, int joniOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromJoniOptions(joniOptions);
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexpEmbedded19(Ruby runtime, IRubyObject[] strings, int embeddedOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromEmbeddedOptions(embeddedOptions);
    RubyString pattern = preprocessDRegexp(runtime, strings, options);
    
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
  
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexpEmbedded19(Ruby runtime, IRubyObject[] strings, int embeddedOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromEmbeddedOptions(embeddedOptions);
    RubyString pattern = preprocessDRegexp(runtime, strings, options);
    
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
  
}

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

private static IRubyObject getPatternQuoted(ThreadContext context, IRubyObject pat, boolean check) {
  IRubyObject val;
  if (pat instanceof RubyRegexp) return pat;
  if (!(pat instanceof RubyString)) {
    val = pat.checkStringType();
    if (val == context.nil) {
      TypeConverter.checkType(context, pat, context.runtime.getRegexp());
    }
    pat = val;
  }
  if (check && ((RubyString) pat).isBrokenString()) {
    // MRI code does a raise of TypeError with a special regexp string constructor that raises RegexpError
    throw context.runtime.newRegexpError("invalid byte sequence in " + ((RubyString) pat).getEncoding());
  }
  return pat;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexpEmbedded(Ruby runtime, RubyString pattern, int embeddedOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromEmbeddedOptions(embeddedOptions);
    // FIXME: Massive hack (fix in DRegexpNode too for interpreter)
    if (pattern.getEncoding() == USASCIIEncoding.INSTANCE) {
      pattern.setEncoding(ASCIIEncoding.INSTANCE);
    }
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public static RubyRegexp newDRegexpEmbedded(Ruby runtime, RubyString pattern, int embeddedOptions) {
  try {
    RegexpOptions options = RegexpOptions.fromEmbeddedOptions(embeddedOptions);
    // FIXME: Massive hack (fix in DRegexpNode too for interpreter)
    if (pattern.getEncoding() == USASCIIEncoding.INSTANCE) {
      pattern.setEncoding(ASCIIEncoding.INSTANCE);
    }
    return new RubyRegexp(runtime, pattern.getByteList(), options);
  } catch (RaiseException re) {
    throw runtime.newRegexpError(re.getMessage());
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private Regex getStringPattern19(Ruby runtime, IRubyObject obj) {
  RubyString str = getStringForPattern(obj);
  if (str.scanForCodeRange() == CR_BROKEN) {
    throw runtime.newRegexpError("invalid multybyte character: " +
        RubyRegexp.regexpDescription19(runtime, str.value, new RegexpOptions(), str.value.getEncoding()).toString());
  }
  if (str.value.getEncoding().isDummy()) {
    throw runtime.newArgumentError("can't make regexp with dummy encoding");
  }
  
  return RubyRegexp.getQuotedRegexpFromCache19(runtime, str.value, new RegexpOptions(), str.isAsciiOnly());
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private Regex getStringPattern19(Ruby runtime, IRubyObject obj) {
  RubyString str = getStringForPattern(obj);
  if (str.scanForCodeRange() == CR_BROKEN) {
    throw runtime.newRegexpError("invalid multybyte character: " +
        RubyRegexp.regexpDescription19(runtime, str.value, new RegexpOptions(), str.value.getEncoding()).toString());
  }
  if (str.value.getEncoding().isDummy()) {
    throw runtime.newArgumentError("can't make regexp with dummy encoding");
  }
  
  return RubyRegexp.getQuotedRegexpFromCache19(runtime, str.value, new RegexpOptions(), str.isAsciiOnly());
}

相关文章

Ruby类方法