Top Inners Constructors Methods
org.jruby.util

public Class RegexpSupport

extends Object
Class Inheritance
Imports
org.jcodings.Encoding, org.jcodings.specific.ASCIIEncoding, .USASCIIEncoding, .UTF8Encoding, org.jruby.Ruby

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
appendMBC(Ruby runtime, ByteList to, byte[] bytes, int p, Encoding enc, Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode, int cl)

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

public static void
appendRegexpString19(Ruby runtime, ByteList to, byte[] bytes, int start, int len, Encoding enc, Encoding resEnc)
Deprecated

private static void
appendUtf8(Ruby
current runtime
runtime
,
ByteList
output buffer; if null, no appending will be done
to
,
int
utf8 character code
code
,
Encoding[]
output param for new encoding
enc
,
ByteList
original wrapper of source bytes
str
,
RegexpSupport.ErrorMode
error mode
mode
)

Append the given utf8 characters to the buffer, if given, checking for errors along the way.

private static void
checkUnicodeRange(Ruby runtime, int code, ByteList str, RegexpSupport.ErrorMode mode)

public static ByteList

Returns:

a new unescaped string
preprocess
(Ruby
current runtime
runtime
,
ByteList
string to preprocess
str
,
Encoding
string's encoding
enc
,
Encoding[]
new encoding after fixing
fixedEnc
,
RegexpSupport.ErrorMode
mode of errors
mode
)

Preprocess the given string for use in regexp, raising errors for encoding incompatibilities that arise.

public static int
public static void
raiseRegexpError(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err)

public static void
raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err)
Deprecated

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

public static ByteList
regexpDescription(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc)

private static ByteList
regexpDescription(Ruby runtime, byte[] s, int start, int len, RegexpOptions options, Encoding enc)

public static ByteList
regexpDescription19(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc)
Deprecated

private static int

Returns:

new position after performing unescaping
unescapeEscapedNonAscii
(Ruby
current runtime
runtime
,
ByteList
output bytelist; if null, no appending will be done
to
,
byte[]
incoming bytes
bytes
,
int
start position
p
,
int
end position
end
,
Encoding
bytes' encoding
enc
,
Encoding[]
out param for fixed encoding
encp
,
ByteList
original bytes wrapper
str
,
RegexpSupport.ErrorMode
error mode
mode
)

Unescape escaped non-ascii character at start position, appending all to the given bytelist if provided.

public static boolean

Returns:

whether any propery elements were encountered while walking
unescapeNonAscii
(Ruby
current runtime
runtime
,
ByteList
output bytelist; if null, no appending will be done
to
,
byte[]
the bytes to unescape
bytes
,
int
starting position
p
,
int
ending position
end
,
Encoding
bytes' encoding
enc
,
Encoding[]
out param for fixed encoding
encp
,
ByteList
original wrapper for the bytes
str
,
RegexpSupport.ErrorMode
error mode
mode
)

Unescape non-ascii elements in the given string, appending the results to the given bytelist if provided.

private static int

Returns:

new position after unescaping
unescapeUnicodeBmp
(Ruby
current runtime
runtime
,
ByteList
output buffer; if null, no appending will be done
to
,
byte[]
input bytes
bytes
,
int
start position
p
,
int
end position
end
,
Encoding[]
out param for fixed encoding
encp
,
ByteList
original bytes wrapper
str
,
RegexpSupport.ErrorMode
error mode
mode
)

Unescape unicode BMP char at given offset, appending to the specified buffer if non-null.

private static int

Returns:

new position after unescaping
unescapeUnicodeList
(Ruby
current runtime
runtime
,
ByteList
output buffer; if null, no appending will be done
to
,
byte[]
input bytes
bytes
,
int
start position
p
,
int
end position
end
,
Encoding[]
out param for fixed encoding
encp
,
ByteList
original bytes wrapper
str
,
RegexpSupport.ErrorMode
error mode
mode
)

Unescape unicode characters at given offset, appending to the given out buffer if provided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RegexpSupportback to summary
public RegexpSupport()

Method Detail

appendMBCback to summary
private static int appendMBC(Ruby runtime, ByteList to, byte[] bytes, int p, Encoding enc, Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode, int cl)
appendOptionsback to summary
public static void appendOptions(ByteList to, RegexpOptions options)
appendRegexpStringback to summary
public static void appendRegexpString(Ruby runtime, ByteList to, byte[] bytes, int start, int len, Encoding enc, Encoding resEnc)
appendRegexpString19back to summary
public static void appendRegexpString19(Ruby runtime, ByteList to, byte[] bytes, int start, int len, Encoding enc, Encoding resEnc)

Deprecated

Annotations
@Deprecated
appendUtf8back to summary
private static void appendUtf8(Ruby runtime, ByteList to, int code, Encoding[] enc, ByteList str, RegexpSupport.ErrorMode mode)

Append the given utf8 characters to the buffer, if given, checking for errors along the way.

Parameters
runtime:Ruby

current runtime

to:ByteList

output buffer; if null, no appending will be done

code:int

utf8 character code

enc:Encoding[]

output param for new encoding

str:ByteList

original wrapper of source bytes

mode:RegexpSupport.ErrorMode

error mode

checkUnicodeRangeback to summary
private static void checkUnicodeRange(Ruby runtime, int code, ByteList str, RegexpSupport.ErrorMode mode)
preprocessback to summary
public static ByteList preprocess(Ruby runtime, ByteList str, Encoding enc, 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:Ruby

current runtime

str:ByteList

string to preprocess

enc:Encoding

string's encoding

fixedEnc:Encoding[]

new encoding after fixing

mode:RegexpSupport.ErrorMode

mode of errors

Returns:ByteList

a new unescaped string

raisePreprocessErrorback to summary
public static int raisePreprocessError(Ruby runtime, ByteList str, String err, RegexpSupport.ErrorMode mode)
raiseRegexpErrorback to summary
public static void raiseRegexpError(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err)
raiseRegexpError19back to summary
public static void raiseRegexpError19(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options, String err)

Deprecated

Annotations
@Deprecated
readEscapedByteback to summary
public static int readEscapedByte(Ruby runtime, byte[] to, int toP, byte[] bytes, int p, int end, ByteList str, RegexpSupport.ErrorMode mode)
regexpDescriptionback to summary
public static ByteList regexpDescription(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc)
regexpDescriptionback to summary
private static ByteList regexpDescription(Ruby runtime, byte[] s, int start, int len, RegexpOptions options, Encoding enc)
regexpDescription19back to summary
public static ByteList regexpDescription19(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc)

Deprecated

Annotations
@Deprecated
unescapeEscapedNonAsciiback to summary
private static int unescapeEscapedNonAscii(Ruby runtime, ByteList to, byte[] bytes, int p, int end, Encoding enc, Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode)

Unescape escaped non-ascii character at start position, appending all to the given bytelist if provided.

Parameters
runtime:Ruby

current runtime

to:ByteList

output bytelist; if null, no appending will be done

bytes:byte[]

incoming bytes

p:int

start position

end:int

end position

enc:Encoding

bytes' encoding

encp:Encoding[]

out param for fixed encoding

str:ByteList

original bytes wrapper

mode:RegexpSupport.ErrorMode

error mode

Returns:int

new position after performing unescaping

unescapeNonAsciiback to summary
public static boolean unescapeNonAscii(Ruby runtime, ByteList to, byte[] bytes, int p, int end, Encoding enc, 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:Ruby

current runtime

to:ByteList

output bytelist; if null, no appending will be done

bytes:byte[]

the bytes to unescape

p:int

starting position

end:int

ending position

enc:Encoding

bytes' encoding

encp:Encoding[]

out param for fixed encoding

str:ByteList

original wrapper for the bytes

mode:RegexpSupport.ErrorMode

error mode

Returns:boolean

whether any propery elements were encountered while walking

unescapeUnicodeBmpback to summary
private static int unescapeUnicodeBmp(Ruby runtime, ByteList to, byte[] bytes, int p, int end, Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode)

Unescape unicode BMP char at given offset, appending to the specified buffer if non-null.

Parameters
runtime:Ruby

current runtime

to:ByteList

output buffer; if null, no appending will be done

bytes:byte[]

input bytes

p:int

start position

end:int

end position

encp:Encoding[]

out param for fixed encoding

str:ByteList

original bytes wrapper

mode:RegexpSupport.ErrorMode

error mode

Returns:int

new position after unescaping

unescapeUnicodeListback to summary
private static int unescapeUnicodeList(Ruby runtime, ByteList to, byte[] bytes, int p, int end, Encoding[] encp, ByteList str, RegexpSupport.ErrorMode mode)

Unescape unicode characters at given offset, appending to the given out buffer if provided.

Parameters
runtime:Ruby

current runtime

to:ByteList

output buffer; if null, no appending will be done

bytes:byte[]

input bytes

p:int

start position

end:int

end position

encp:Encoding[]

out param for fixed encoding

str:ByteList

original bytes wrapper

mode:RegexpSupport.ErrorMode

error mode

Returns:int

new position after unescaping

org.jruby.util back to summary

public final Enum RegexpSupport.ErrorMode

extends Enum<RegexpSupport.ErrorMode>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final RegexpSupport.ErrorMode
public static final RegexpSupport.ErrorMode
public static final RegexpSupport.ErrorMode

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static RegexpSupport.ErrorMode
public static RegexpSupport.ErrorMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DESCback to summary
public static final RegexpSupport.ErrorMode DESC
PREPROCESSback to summary
public static final RegexpSupport.ErrorMode PREPROCESS
RAISEback to summary
public static final RegexpSupport.ErrorMode RAISE

Constructor Detail

ErrorModeback to summary
private ErrorMode()

Method Detail

valueOfback to summary
public static RegexpSupport.ErrorMode valueOf(String name)
valuesback to summary
public static RegexpSupport.ErrorMode[] values()