Package org.jruby.util
Class RegexpSupport
java.lang.Object
org.jruby.util.RegexpSupport
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
appendOptions
(ByteList to, RegexpOptions options) static void
appendRegexpString
(Ruby runtime, ByteList to, byte[] bytes, int start, int len, org.jcodings.Encoding enc, org.jcodings.Encoding resEnc) static void
appendRegexpString19
(Ruby runtime, ByteList to, byte[] bytes, int start, int len, org.jcodings.Encoding enc, org.jcodings.Encoding resEnc) Deprecated.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.static int
raisePreprocessError
(Ruby runtime, ByteList str, String err, RegexpSupport.ErrorMode mode) static void
raiseRegexpError
(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, String err) static void
raiseRegexpError19
(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, String err) Deprecated.static int
readEscapedByte
(Ruby runtime, byte[] to, int toP, byte[] bytes, int p, int end, ByteList str, RegexpSupport.ErrorMode mode) static ByteList
regexpDescription
(Ruby runtime, ByteList bytes, RegexpOptions options, org.jcodings.Encoding enc) static ByteList
regexpDescription19
(Ruby runtime, ByteList bytes, RegexpOptions options, org.jcodings.Encoding enc) Deprecated.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.
-
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 runtimestr
- string to preprocessenc
- string's encodingfixedEnc
- new encoding after fixingmode
- 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 runtimeto
- output bytelist; if null, no appending will be donebytes
- the bytes to unescapep
- starting positionend
- ending positionenc
- bytes' encodingencp
- out param for fixed encodingstr
- original wrapper for the bytesmode
- 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
-
appendOptions
-
readEscapedByte
public static int readEscapedByte(Ruby runtime, byte[] to, int toP, byte[] bytes, int p, int end, ByteList str, RegexpSupport.ErrorMode mode)
-