Class RegexpSupport

java.lang.Object
org.jruby.util.RegexpSupport

public class RegexpSupport extends Object
  • Constructor Details

    • RegexpSupport

      public RegexpSupport()
  • Method Details

    • preprocess

      public static ByteList preprocess(Ruby runtime, ByteList str, org.jcodings.Encoding enc, org.jcodings.Encoding[] fixedEnc, RegexpSupport.ErrorMode mode)
      Preprocess the given string for use in regexp, raising errors for encoding incompatibilities that arise. This version produces a new unescaped version of the string based on fixes performed while walking.
      Parameters:
      runtime - current runtime
      str - string to preprocess
      enc - string's encoding
      fixedEnc - new encoding after fixing
      mode - mode of errors
      Returns:
      a new unescaped string
    • unescapeNonAscii

      public static boolean unescapeNonAscii(Ruby runtime, ByteList to, byte[] bytes, int p, int end, org.jcodings.Encoding enc, org.jcodings.Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode)
      Unescape non-ascii elements in the given string, appending the results to the given bytelist if provided. (mri: unescape_nonascii).
      Parameters:
      runtime - current runtime
      to - output bytelist; if null, no appending will be done
      bytes - the bytes to unescape
      p - starting position
      end - ending position
      enc - bytes' encoding
      encp - out param for fixed encoding
      str - original wrapper for the bytes
      mode - error mode
      Returns:
      whether any propery elements were encountered while walking
    • raisePreprocessError

      public static int raisePreprocessError(Ruby runtime, ByteList str, String err, RegexpSupport.ErrorMode mode)
    • raiseRegexpError19

      @Deprecated public static void raiseRegexpError19(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, String err)
      Deprecated.
    • raiseRegexpError

      public static void raiseRegexpError(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, String err)
    • regexpDescription19

      @Deprecated public static ByteList regexpDescription19(Ruby runtime, ByteList bytes, RegexpOptions options, org.jcodings.Encoding enc)
      Deprecated.
    • regexpDescription

      public static ByteList regexpDescription(Ruby runtime, ByteList bytes, RegexpOptions options, org.jcodings.Encoding enc)
    • appendRegexpString19

      @Deprecated public static void appendRegexpString19(Ruby runtime, ByteList to, byte[] bytes, int start, int len, org.jcodings.Encoding enc, org.jcodings.Encoding resEnc)
      Deprecated.
    • appendRegexpString

      public static void appendRegexpString(Ruby runtime, ByteList to, byte[] bytes, int start, int len, org.jcodings.Encoding enc, org.jcodings.Encoding resEnc)
    • appendOptions

      public static void appendOptions(ByteList to, RegexpOptions options)
    • readEscapedByte

      public static int readEscapedByte(Ruby runtime, byte[] to, int toP, byte[] bytes, int p, int end, ByteList str, RegexpSupport.ErrorMode mode)