Package org.jruby
Class RubyMatchData
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyMatchData
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<IRubyObject>,InstanceVariables,InternalVariables,IRubyObject,CoreObjectType
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescription(package private) intprivate org.joni.Regionprivate boolean(package private) intprivate static final intprivate Object(package private) RubyRegexp(package private) org.joni.Region(package private) RubyStringFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUST_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionRubyMatchData(Ruby runtime) RubyMatchData(Ruby runtime, RubyClass metaClass) -
Method Summary
Modifier and TypeMethodDescriptionfinal IRubyObjectat(int nth) static intbackrefNumber(Ruby runtime, org.joni.Regex pattern, org.joni.Region regs, IRubyObject obj) final intbackrefNumber(Ruby runtime, IRubyObject obj) intbegin(int i) Get the begin offset of the given region, or -1 if the region does not exist.begin(ThreadContext context, IRubyObject index) MRI: match_begincaptures(ThreadContext context) match_captures(package private) final voidcheck()voidLots of MRI objects keep their state in non-lookupable ivars (e:g.static RubyClasscreateMatchDataClass(Ruby runtime) intend(int i) Get the end offset of the given region, or -1 if the region does not exist.end(ThreadContext context, IRubyObject index) match_endeql_p(IRubyObject obj) rb_obj_equal Just like "==" and "equal?", "eql?" will use identity equality for Object.booleanThis override does not do a "checked" dispatch.getNamedBackrefValues(Ruby runtime) intgetNameToBackrefNumber(String name) This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.(package private) final org.joni.Regexprivate RubyRegexpgroup(int n) group(long n) hash()rb_obj_id Will return the hash code of this object.inthashCode()This override does not do "checked" dispatch since Object usually has #hash defined.initialize_copy(IRubyObject original) rb_obj_init_copy Initializes this object as a copy of the original, that is the parameter to this object.(package private) final voidinitMatchData(RubyString str, int beg, RubyString pattern) (package private) final voidinitMatchData(RubyString str, org.joni.Matcher matcher, org.joni.Regex pattern) inspect()rb_obj_inspect call-seq: obj.inspect => string Returns a string containing a human-readable representation of obj.private static RubyStringmakeShared(Ruby runtime, RubyString str, int index, int length) private RubyArraymatch_array(Ruby runtime, int start) private IRubyObjectmatchAryAref(ThreadContext context, IRubyObject index, RubyArray result) private IRubyObjectmatchArySubseq(ThreadContext context, int beg, int len, RubyArray result) named_captures(ThreadContext context) names(ThreadContext context, Block block) private intnameToBackrefError(Ruby runtime, String name) private static intnameToBackrefNumber(Ruby runtime, org.joni.Regex pattern, org.joni.Region regs, ByteListHolder str) private intprivate intnamevToBacktraceNumber(ThreadContext context, IRubyObject name) intnumRegs()Fetch the number of regions in this match.offset(ThreadContext context, IRubyObject index) match_offsetoffset19(ThreadContext context, IRubyObject index) op_aref(IRubyObject idx) Deprecated.op_aref(IRubyObject idx, IRubyObject rest) Deprecated.op_aref(ThreadContext context, IRubyObject idx) match_arefop_aref(ThreadContext context, IRubyObject idx, IRubyObject rest) match_arefop_aref19(IRubyObject idx, IRubyObject rest) Deprecated.private IRubyObjectop_arefCommon(IRubyObject idx) post_match(ThreadContext context) match_post_matchpre_match(ThreadContext context) match_pre_matchregexp(ThreadContext context, Block block) size(ThreadContext context) match_sizestring()match_stringto_a()Deprecated.to_a(ThreadContext context) match_to_ato_s()match_to_sprivate voidprivate voidupdateCharOffsetManyRegs(ByteList value, org.jcodings.Encoding encoding) private voidupdateCharOffsetOnlyOneReg(ByteList value, org.jcodings.Encoding encoding) private static voidupdatePairs(ByteList value, org.jcodings.Encoding encoding, RubyMatchData.Pair[] pairs) final voiduse()final booleanused()values_at(IRubyObject[] args) values_at(ThreadContext context, IRubyObject[] args) Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, dig, dig1, dig2, eqlInternal, equalInternal, inspect, op_eqq, puts, specificEval, toRubyString, toStringMethods inherited from class org.jruby.RubyBasicObject
addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, defaultToJava, display, dup, ensureInstanceVariablesSettable, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, infectBy, infectBy, initialize, initialize19, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method, method_missing, method_missing19, method19, methods, methods, methods19, methodsImpl, nil_p, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_equal, op_equal_19, op_match, op_match19, op_not, op_not_equal, op_not_match, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, rbClone, rbInspect, recacheBuiltinMethods, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method_added, singleton_method_added19, singleton_method_removed, singleton_method_removed19, singleton_method_undefined, singleton_method_undefined19, singleton_methods, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted, tainted_p, testFrozen, testFrozen, toJava, trust, type, type_deprecated, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
-
Field Details
-
regs
org.joni.Region regs -
begin
int begin -
end
int end -
str
RubyString str -
pattern
-
regexp
-
charOffsetUpdated
private boolean charOffsetUpdated -
charOffsets
private org.joni.Region charOffsets -
MATCH_BUSY
private static final int MATCH_BUSY
-
-
Constructor Details
-
RubyMatchData
-
RubyMatchData
-
-
Method Details
-
createMatchDataClass
-
initMatchData
-
initMatchData
-
copySpecialInstanceVariables
Description copied from class:RubyBasicObjectLots of MRI objects keep their state in non-lookupable ivars (e:g. Range, Struct, etc). This method is responsible for dupping our java field equivalents- Specified by:
copySpecialInstanceVariablesin interfaceIRubyObject- Overrides:
copySpecialInstanceVariablesin classRubyBasicObject
-
getNativeClassIndex
Description copied from class:RubyObjectThis is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin classRubyObject- See Also:
-
updatePairs
private static void updatePairs(ByteList value, org.jcodings.Encoding encoding, RubyMatchData.Pair[] pairs) -
updateCharOffsetOnlyOneReg
-
updateCharOffsetManyRegs
-
updateCharOffset
private void updateCharOffset() -
use
public final void use() -
used
public final boolean used() -
check
final void check() -
getPattern
final org.joni.Regex getPattern() -
getRegexp
-
match_array
-
group
-
group
-
getNameToBackrefNumber
-
getNamedBackrefValues
-
inspect
Description copied from class:RubyBasicObjectrb_obj_inspect call-seq: obj.inspect => string Returns a string containing a human-readable representation of obj. If not overridden, uses theto_smethod to generate the string. [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" Time.new.inspect #=> "Wed Apr 09 08:54:39 CDT 2003"- Specified by:
inspectin interfaceIRubyObject- Overrides:
inspectin classRubyBasicObject- Returns:
- String
-
regexp
-
names
-
to_a
match_to_a- Overrides:
to_ain classRubyBasicObject
-
values_at
-
values_at
-
captures
match_captures -
nameToBackrefNumber
-
nameToBackrefNumber
private static int nameToBackrefNumber(Ruby runtime, org.joni.Regex pattern, org.joni.Region regs, ByteListHolder str) -
backrefNumber
-
backrefNumber
public static int backrefNumber(Ruby runtime, org.joni.Regex pattern, org.joni.Region regs, IRubyObject obj) -
namevToBacktraceNumber
-
nameToBackrefError
-
matchArySubseq
-
matchAryAref
-
op_aref19
Deprecated. -
op_aref
match_aref -
op_aref
match_aref -
op_arefCommon
-
at
-
size
match_size -
begin
MRI: match_begin -
end
match_end -
offset
match_offset -
offset19
-
pre_match
match_pre_match -
post_match
match_post_match -
to_s
match_to_s- Overrides:
to_sin classRubyBasicObject
-
string
match_string -
initialize_copy
Description copied from class:RubyBasicObjectrb_obj_init_copy Initializes this object as a copy of the original, that is the parameter to this object. Will make sure that the argument actually has the same real class as this object. It shouldn't be possible to initialize an object with something totally different.- Overrides:
initialize_copyin classRubyBasicObject
-
equals
Description copied from class:RubyObjectThis override does not do a "checked" dispatch.- Overrides:
equalsin classRubyObject- See Also:
-
eql_p
Description copied from class:RubyBasicObjectrb_obj_equal Just like "==" and "equal?", "eql?" will use identity equality for Object.- Overrides:
eql_pin classRubyBasicObject
-
hashCode
public int hashCode()Description copied from class:RubyObjectThis override does not do "checked" dispatch since Object usually has #hash defined.- Overrides:
hashCodein classRubyObject- See Also:
-
hash
Description copied from class:RubyBasicObjectrb_obj_id Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hashin classRubyBasicObject
-
named_captures
-
begin
public int begin(int i) Get the begin offset of the given region, or -1 if the region does not exist.- Parameters:
i- the region for which to fetch the begin offset- Returns:
- the begin offset for the region
-
end
public int end(int i) Get the end offset of the given region, or -1 if the region does not exist.- Parameters:
i- the region for which to fetch the end offset- Returns:
- the end offset for the region
-
numRegs
public int numRegs()Fetch the number of regions in this match.- Returns:
- the number of regions in this match
-
to_a
Deprecated.- Overrides:
to_ain classRubyBasicObject
-
op_aref
Deprecated. -
op_aref
Deprecated.
-