Class Regexp.PCRE2.CalloutBlock

class Regexp.PCRE2.CalloutBlock
Description

Context object passed to callout functions.

See also

MatchContext.set_callout()


Variable callout_flags

int Regexp.PCRE2.CalloutBlock.callout_flags

Description

This field is always zero when JIT is being used. When JIT is not being used, the following bits may be set:

CALLOUT.STARTMATCH

This is set for the first callout after the start of matching for each new starting position in the subject.

CALLOUT.BACKTRACK

This is set if there has been a matching backtrack since the previous callout, or since the start of matching if this is the first callout.

Both bits are set when a backtrack has caused a "bumpalong" to a new starting position in the subject.


Variable callout_number

int Regexp.PCRE2.CalloutBlock.callout_number

Description

For a numerical callout, this contains the number of the callout in the range 0-255. It is 255 for automatically generated callouts.


Variable callout_string

string Regexp.PCRE2.CalloutBlock.callout_string

Description

For callouts with string arguments, callout_number is always zero, and this field contains the string that is contained within the pattern.


Variable callout_string_offset

int Regexp.PCRE2.CalloutBlock.callout_string_offset

Description

The code unit offset to the start of the callout argument string within the original pattern string.


Variable capture_last

int Regexp.PCRE2.CalloutBlock.capture_last

Description

Contains the number of the most recently captured substring. The values of the fields capture_top and capture_last do not always differ by one; for example, when the callout in the pattern ((a)(b))(?C2) is taken, capture_last is 1 but capture_top is 4.

See also

offset_vector, capture_top


Variable capture_top

int Regexp.PCRE2.CalloutBlock.capture_top

Description

Contains one more than the number of the highest captured substring so far.

See also

offset_vector, capture_last


Variable current_position

int Regexp.PCRE2.CalloutBlock.current_position

Description

The offset within the subject of the current match pointer.


Variable mark

string|zero Regexp.PCRE2.CalloutBlock.mark

Description

Contains the name of the most recently passed (*MARK), (*PRUNE), or (*THEN) item in the match, or 0 if no such items have been passed. Instances of (*PRUNE) or (*THEN) without a name do not obliterate a previous (*MARK).


Variable next_item_length

int Regexp.PCRE2.CalloutBlock.next_item_length

Description

The length of the next item to be processed in the pattern string. When the callout is at the end of the pattern, the length is zero. When the callout precedes an opening parenthesis, the length includes meta characters that follow the parenthesis. For example, in a callout before an assertion such as (?=ab) the length is 3. For an alternation bar or a closing parenthesis, the length is one, unless a closing parenthesis is followed by a quantifier, in which case its length is included. (This changed in release 10.23. In earlier releases, before an opening parenthesis the length was that of the entire group, and before an alternation bar or a closing parenthesis the length was zero.)


Variable offset_vector

array(int) Regexp.PCRE2.CalloutBlock.offset_vector

Description

The contents of offset_vector[2] to offset_vector[capture_top*2-1] can be inspected in order to extract substrings that have been matched so far, in the same way as extracting substrings after a match has completed. The values in offset_vector[0] and offset_vector[1] are always -1 because the match is by definition not complete. Substrings that have not been captured but whose numbers are less than capture_top also have both of their offset_vector slots set to -1.


Variable pattern_position

int Regexp.PCRE2.CalloutBlock.pattern_position

Description

The offset in the pattern string to the next item to be matched.


Variable start_match

int Regexp.PCRE2.CalloutBlock.start_match

Description

Normally the offset within the subject at which the current match attempt started. However, if the escape sequence \K has been encountered, this value is changed to reflect the modified starting point. If the pattern is not anchored, the callout function may be called several times from the same point in the pattern for different starting points in the subject.


Variable subject

string Regexp.PCRE2.CalloutBlock.subject

Description

The string that was passed to the matching function