Ruby: regexec.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
regexec.c File Reference
`#include "regint.h"`

Go to the source code of this file.

## Macros
#define | USE_TOKEN_THREADED_VM 1
#define | ENC_DUMMY_FLAG (1<<24)
#define | ONIGENC_IS_MBC_ASCII_WORD(enc, s, end)
#define | ONIGENC_IS_MBC_CRNL(enc, p, end)
#define | ONIGENC_IS_MBC_NEWLINE_EX(enc, p, start, end, option, check_prev) is_mbc_newline_ex((enc),(p),(start),(end),(option),(check_prev))
#define | RREGC_SIZE (sizeof(int) * from->num_regs)
#define | INVALID_STACK_INDEX -1
| stack More...
#define | STK_ALT 0x0001
#define | STK_LOOK_BEHIND_NOT 0x0002
#define | STK_POS_NOT 0x0003
#define | STK_MEM_START 0x0100
#define | STK_MEM_END 0x8200
#define | STK_REPEAT_INC 0x0300
#define | STK_STATE_CHECK_MARK 0x1000
#define | STK_NULL_CHECK_START 0x3000
#define | STK_NULL_CHECK_END 0x5000 /* for recursive call */
#define | STK_MEM_END_MARK 0x8400
#define | STK_POS 0x0500 /* used when POP-POS */
#define | STK_STOP_BT 0x0600 /* mark for "(?>...)" */
#define | STK_REPEAT 0x0700
#define | STK_CALL_FRAME 0x0800
#define | STK_RETURN 0x0900
#define | STK_VOID 0x0a00 /* for fill a blank */
#define | STK_ABSENT_POS 0x0b00 /* for absent */
#define | STK_ABSENT 0x0c00 /* absent inner loop marker */
#define | STK_MASK_POP_USED 0x00ff
#define | STK_MASK_TO_VOID_TARGET 0x10ff
#define | STK_MASK_MEM_END_OR_MARK 0x8000 /* MEM_END or MEM_END_MARK */
#define | MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start, arg_gpos)
#define | MATCH_ARG_FREE(msa) if ((msa).stack_p) xfree((msa).stack_p)
#define | MAX_PTR_NUM 100
#define | STACK_INIT(alloc_addr, heap_addr, ptr_num, stack_num)
#define | STACK_SAVE
#define | STACK_ENSURE(n)
#define | STACK_AT(index) (stk_base + (index))
#define | GET_STACK_INDEX(stk) ((stk) - stk_base)
#define | STACK_PUSH_TYPE(stack_type)
#define | IS_TO_VOID_TARGET(stk) (((stk)->type & STK_MASK_TO_VOID_TARGET) != 0)
#define | ELSE_IF_STATE_CHECK_MARK(stk)
#define | STACK_PUSH(stack_type, pat, s, sprev, keep)
#define | STACK_PUSH_ENSURED(stack_type, pat)
#define | STACK_PUSH_ALT(pat, s, sprev, keep) STACK_PUSH(STK_ALT,pat,s,sprev,keep)
#define | STACK_PUSH_POS(s, sprev, keep) STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev,keep)
#define | STACK_PUSH_POS_NOT(pat, s, sprev, keep) STACK_PUSH(STK_POS_NOT,pat,s,sprev,keep)
#define | STACK_PUSH_ABSENT STACK_PUSH_TYPE(STK_ABSENT)
#define | STACK_PUSH_STOP_BT STACK_PUSH_TYPE(STK_STOP_BT)
#define | STACK_PUSH_LOOK_BEHIND_NOT(pat, s, sprev, keep) STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev,keep)
#define | STACK_PUSH_REPEAT(id, pat)
#define | STACK_PUSH_REPEAT_INC(sindex)
#define | STACK_PUSH_MEM_START(mnum, s)
#define | STACK_PUSH_MEM_END(mnum, s)
#define | STACK_PUSH_MEM_END_MARK(mnum)
#define | STACK_GET_MEM_START(mnum, k)
#define | STACK_GET_MEM_RANGE(k, mnum, start, end)
#define | STACK_PUSH_NULL_CHECK_START(cnum, s)
#define | STACK_PUSH_NULL_CHECK_END(cnum)
#define | STACK_PUSH_CALL_FRAME(pat)
#define | STACK_PUSH_RETURN
#define | STACK_PUSH_ABSENT_POS(start, end)
#define | STACK_BASE_CHECK(p, at)
#define | STACK_POP_ONE
#define | STACK_POP
#define | STACK_POP_TIL_POS_NOT
#define | STACK_POP_TIL_LOOK_BEHIND_NOT
#define | STACK_POP_TIL_ABSENT
#define | STACK_POP_ABSENT_POS(start, end)
#define | STACK_POS_END(k)
#define | STACK_STOP_BT_END
#define | STACK_NULL_CHECK(isnull, id, s)
#define | STACK_NULL_CHECK_REC(isnull, id, s)
#define | STACK_NULL_CHECK_MEMST(isnull, id, s, reg)
#define | STACK_NULL_CHECK_MEMST_REC(isnull, id, s, reg)
#define | STACK_GET_REPEAT(id, k)
#define | STACK_RETURN(addr)
#define | STRING_CMP(s1, s2, len)
#define | STRING_CMP_IC(case_fold_flag, s1, ps2, len, text_end)
#define | STRING_CMP_VALUE(s1, s2, len, is_fail)
#define | STRING_CMP_VALUE_IC(case_fold_flag, s1, ps2, len, text_end, is_fail)
#define | IS_EMPTY_STR (str == end)
#define | ON_STR_BEGIN(s) ((s) == str)
#define | ON_STR_END(s) ((s) == end)
#define | DATA_ENSURE_CHECK1 (s < end)
#define | DATA_ENSURE_CHECK(n) (s + (n) <= end)
#define | DATA_ENSURE(n) if (s + (n) > end) goto fail
#define | ABSENT_END_POS end
#define | STACK_INC stk++
#define | MOP_IN(opcode)
#define | MOP_OUT
#define | OP_OFFSET 0
#define | VM_LOOP
#define | VM_LOOP_END } sprev = sbegin; }
#define | CASE(x) case x:
#define | DEFAULT default:
#define | NEXT break
#define | JUMP continue; break
#define | ADD_NUMMEM 1
#define | OPCODE_EXEC_HOOK ((void) 0)
#define | BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100
#define | MATCH_AND_RETURN_CHECK(none)

## Functions
void | onig_region_clear (OnigRegion *region)
int | onig_region_resize (OnigRegion *region, int n)
int | onig_region_set (OnigRegion *region, int at, int beg, int end)
void | onig_region_init (OnigRegion *region)
OnigRegion * | onig_region_new (void)
void | onig_region_free (OnigRegion *r, int free_self)
void | onig_region_copy (OnigRegion *to, const OnigRegion *from)
unsigned int | onig_get_match_stack_limit_size (void)
int | onig_set_match_stack_limit_size (unsigned int size)
OnigPosition | onig_match (regex_t *reg, const UChar *str, const UChar *end, const UChar *at, OnigRegion *region, OnigOptionType option)
OnigPosition | onig_search (regex_t *reg, const UChar *str, const UChar *end, const UChar *start, const UChar *range, OnigRegion *region, OnigOptionType option)
OnigPosition | onig_search_gpos (regex_t *reg, const UChar *str, const UChar *end, const UChar *global_pos, const UChar *start, const UChar *range, OnigRegion *region, OnigOptionType option)
OnigPosition | onig_scan (regex_t *reg, const UChar *str, const UChar *end, OnigRegion *region, OnigOptionType option, int(*scan_callback)(OnigPosition, OnigPosition, OnigRegion *, void *), void *callback_arg)
OnigEncoding | onig_get_encoding (const regex_t *reg)
OnigOptionType | onig_get_options (const regex_t *reg)
OnigCaseFoldType | onig_get_case_fold_flag (const regex_t *reg)
const OnigSyntaxType * | onig_get_syntax (const regex_t *reg)
int | onig_number_of_captures (const regex_t *reg)
int | onig_number_of_capture_histories (const regex_t *reg)
void | onig_copy_encoding (OnigEncodingType *to, OnigEncoding from)

## Macro Definition Documentation

## ◆ ABSENT_END_POS

#define ABSENT_END_POS end

Definition at line 1184 of file regexec.c.

## ◆ ADD_NUMMEM

#define ADD_NUMMEM 1

## ◆ BM_BACKWARD_SEARCH_LENGTH_THRESHOLD

#define BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100

Definition at line 4039 of file regexec.c.

## ◆ CASE

#define CASE | ( |  | x | ) | case x:

## ◆ DATA_ENSURE

#define DATA_ENSURE | ( |  | n | ) | if (s + (n) > end) goto fail

Definition at line 1183 of file regexec.c.

## ◆ DATA_ENSURE_CHECK

#define DATA_ENSURE_CHECK | ( |  | n | ) | (s + (n) <= end)

Definition at line 1182 of file regexec.c.

## ◆ DATA_ENSURE_CHECK1

#define DATA_ENSURE_CHECK1 (s < end)

Definition at line 1181 of file regexec.c.

## ◆ DEFAULT

#define DEFAULT default:

## ◆ ELSE_IF_STATE_CHECK_MARK

#define ELSE_IF_STATE_CHECK_MARK | ( |  | stk | ) |

Definition at line 658 of file regexec.c.

## ◆ ENC_DUMMY_FLAG

#define ENC_DUMMY_FLAG (1<<24)

Definition at line 48 of file regexec.c.

## ◆ GET_STACK_INDEX

#define GET_STACK_INDEX | ( |  | stk | ) | ((stk) - stk_base)

Definition at line 589 of file regexec.c.

## ◆ INVALID_STACK_INDEX

#define INVALID_STACK_INDEX -1

stack

Definition at line 386 of file regexec.c.

## ◆ IS_EMPTY_STR

#define IS_EMPTY_STR (str == end)

Definition at line 1172 of file regexec.c.

## ◆ IS_TO_VOID_TARGET

#define IS_TO_VOID_TARGET | ( |  | stk | ) | (((stk)->type & STK_MASK_TO_VOID_TARGET) != 0)

Definition at line 597 of file regexec.c.

## ◆ JUMP

#define JUMP continue; break

## ◆ MATCH_AND_RETURN_CHECK

#define MATCH_AND_RETURN_CHECK | ( |  | none | ) |

Value:
r = match_at(reg, str, end, s, prev, &msa);\
if (r != ONIG_MISMATCH) {\
if (r >= 0) {\
if (! IS_FIND_LONGEST(reg->options)) {\
goto match;\
}\
}\
else goto finish; /* error */ \
}
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
match
unsigned char match[65280+2]
Definition: gun.c:165
ONIG_MISMATCH
#define ONIG_MISMATCH
Definition: onigmo.h:625
IS_FIND_LONGEST
#define IS_FIND_LONGEST(option)
Definition: regint.h:385

## ◆ MATCH_ARG_FREE

#define MATCH_ARG_FREE | ( |  | msa | ) | if ((msa).stack_p) xfree((msa).stack_p)

Definition at line 472 of file regexec.c.

## ◆ MATCH_ARG_INIT

#define MATCH_ARG_INIT | ( |  | msa,
|  |  | arg_option,
|  |  | arg_region,
|  |  | arg_start,
|  |  | arg_gpos
| ) |  |

Value:
do {\
(msa).stack_p = (void* )0;\
(msa).options = (arg_option);\
(msa).region = (arg_region);\
(msa).start = (arg_start);\
(msa).gpos = (arg_gpos);\
(msa).best_len = ONIG_MISMATCH;\
} while(0)

Definition at line 417 of file regexec.c.

## ◆ MAX_PTR_NUM

#define MAX_PTR_NUM 100

Definition at line 477 of file regexec.c.

## ◆ MOP_IN

#define MOP_IN | ( |  | opcode | ) |

Definition at line 1391 of file regexec.c.

## ◆ MOP_OUT

#define MOP_OUT

Definition at line 1392 of file regexec.c.

## ◆ NEXT

#define NEXT break

## ◆ ON_STR_BEGIN

#define ON_STR_BEGIN | ( |  | s | ) | ((s) == str)

Definition at line 1173 of file regexec.c.

## ◆ ON_STR_END

#define ON_STR_END | ( |  | s | ) | ((s) == end)

Definition at line 1174 of file regexec.c.

## ◆ ONIGENC_IS_MBC_ASCII_WORD

#define ONIGENC_IS_MBC_ASCII_WORD | ( |  | enc,
|  |  | s,
|  |  | end
| ) |  |

Value:
(rb_enc_asciicompat(enc) ? (ISALNUM(*s) || *s=='_') : \
onigenc_ascii_is_code_ctype( \
ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc))
ISALNUM
#define ISALNUM
Definition: ctype.h:41
rb_enc_asciicompat
#define rb_enc_asciicompat(enc)
Definition: encoding.h:236
ONIGENC_MBC_TO_CODE
#define ONIGENC_MBC_TO_CODE(enc, p, end)
Definition: onigmo.h:366
ONIGENC_CTYPE_WORD
#define ONIGENC_CTYPE_WORD
Definition: onigmo.h:306
onigenc_ascii_is_code_ctype
int onigenc_ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc ARG_UNUSED)
Definition: regenc.c:670

Definition at line 55 of file regexec.c.

## ◆ ONIGENC_IS_MBC_CRNL

#define ONIGENC_IS_MBC_CRNL | ( |  | enc,
|  |  | p,
|  |  | end
| ) |  |

Value:
(ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \
ONIGENC_MBC_TO_CODE(enc,(p+enclen(enc,p,end)),end) == 10)
enclen
#define enclen(enc, p, e)
Definition: regenc.h:93

Definition at line 62 of file regexec.c.

## ◆ ONIGENC_IS_MBC_NEWLINE_EX

#define ONIGENC_IS_MBC_NEWLINE_EX | ( |  | enc,
|  |  | p,
|  |  | start,
|  |  | end,
|  |  | option,
|  |  | check_prev
| ) |  | is_mbc_newline_ex((enc),(p),(start),(end),(option),(check_prev))

Definition at line 65 of file regexec.c.

## ◆ OP_OFFSET

#define OP_OFFSET 0

## ◆ OPCODE_EXEC_HOOK

#define OPCODE_EXEC_HOOK ((void) 0)

## ◆ RREGC_SIZE

#define RREGC_SIZE (sizeof(int) * from->num_regs)

## ◆ STACK_AT

#define STACK_AT | ( |  | index | ) | (stk_base + (index))

Definition at line 588 of file regexec.c.

## ◆ STACK_BASE_CHECK

#define STACK_BASE_CHECK | ( |  | p,
|  |  | at
| ) |  |

Definition at line 809 of file regexec.c.

## ◆ STACK_ENSURE

#define STACK_ENSURE | ( |  | n | ) |

Value:
do {\
if (stk_end - stk < (n)) {\
int r = stack_double(&stk_base, &stk_end, &stk, stk_alloc, msa);\
if (r != 0) {\
STACK_SAVE;\
if (xmalloc_base) xfree(xmalloc_base);\
return r;\
}\
}\
} while(0)
STACK_SAVE
#define STACK_SAVE
Definition: regexec.c:513
xfree
#define xfree
Definition: xmalloc.h:49

Definition at line 577 of file regexec.c.

## ◆ STACK_GET_MEM_RANGE

#define STACK_GET_MEM_RANGE | ( |  | k,
|  |  | mnum,
|  |  | start,
|  |  | end
| ) |  |

Value:
do {\
int level = 0;\
while (k < stk) {\
if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\
if (level == 0) (start) = k->u.mem.pstr;\
level++;\
}\
else if (k->type == STK_MEM_END && k->u.mem.num == (mnum)) {\
level--;\
if (level == 0) {\
(end) = k->u.mem.pstr;\
break;\
}\
}\
k++;\
}\
} while(0)
STK_MEM_END
#define STK_MEM_END
Definition: regexec.c:395
STK_MEM_START
#define STK_MEM_START
Definition: regexec.c:394

Definition at line 747 of file regexec.c.

## ◆ STACK_GET_MEM_START

#define STACK_GET_MEM_START | ( |  | mnum,
|  |  | k
| ) |  |

Value:
do {\
int level = 0;\
k = stk;\
while (k > stk_base) {\
k--;\
if ((k->type & STK_MASK_MEM_END_OR_MARK) != 0 \
&& k->u.mem.num == (mnum)) {\
level++;\
}\
else if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\
if (level == 0) break;\
level--;\
}\
}\
} while(0)
STK_MASK_MEM_END_OR_MARK
#define STK_MASK_MEM_END_OR_MARK
Definition: regexec.c:414

Definition at line 731 of file regexec.c.

## ◆ STACK_GET_REPEAT

#define STACK_GET_REPEAT | ( |  | id,
|  |  | k
| ) |  |

Value:
do {\
int level = 0;\
k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_GET_REPEAT"); \
if (k->type == STK_REPEAT) {\
if (level == 0) {\
if (k->u.repeat.num == (id)) {\
break;\
}\
}\
}\
else if (k->type == STK_CALL_FRAME) level--;\
else if (k->type == STK_RETURN) level++;\
}\
} while(0)
STK_CALL_FRAME
#define STK_CALL_FRAME
Definition: regexec.c:405
STK_REPEAT
#define STK_REPEAT
Definition: regexec.c:404
STK_RETURN
#define STK_RETURN
Definition: regexec.c:406

Definition at line 1080 of file regexec.c.

## ◆ STACK_INC

#define STACK_INC stk++

Definition at line 1389 of file regexec.c.

## ◆ STACK_INIT

#define STACK_INIT | ( |  | alloc_addr,
|  |  | heap_addr,
|  |  | ptr_num,
|  |  | stack_num
| ) |  |

Definition at line 479 of file regexec.c.

## ◆ STACK_NULL_CHECK

#define STACK_NULL_CHECK | ( |  | isnull,
|  |  | id,
|  |  | s
| ) |  |

Value:
do {\
OnigStackType* k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_NULL_CHECK"); \
if (k->type == STK_NULL_CHECK_START) {\
if (k->u.null_check.num == (id)) {\
(isnull) = (k->u.null_check.pstr == (s));\
break;\
}\
}\
}\
} while(0)
STK_NULL_CHECK_START
#define STK_NULL_CHECK_START
Definition: regexec.c:399
_OnigStackType
Definition: regint.h:813
_OnigStackType::num
int num
Definition: regint.h:828
_OnigStackType::u
union _OnigStackType::@144 u
_OnigStackType::null_check
struct _OnigStackType::@144::@149 null_check
_OnigStackType::pstr
UChar * pstr
Definition: regint.h:818
_OnigStackType::type
unsigned int type
Definition: regint.h:814

Definition at line 958 of file regexec.c.

## ◆ STACK_NULL_CHECK_MEMST

#define STACK_NULL_CHECK_MEMST | ( |  | isnull,
|  |  | id,
|  |  | s,
|  |  | reg
| ) |  |

Definition at line 993 of file regexec.c.

## ◆ STACK_NULL_CHECK_MEMST_REC

#define STACK_NULL_CHECK_MEMST_REC | ( |  | isnull,
|  |  | id,
|  |  | s,
|  |  | reg
| ) |  |

Definition at line 1032 of file regexec.c.

## ◆ STACK_NULL_CHECK_REC

#define STACK_NULL_CHECK_REC | ( |  | isnull,
|  |  | id,
|  |  | s
| ) |  |

Value:
do {\
int level = 0;\
OnigStackType* k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_NULL_CHECK_REC"); \
if (k->type == STK_NULL_CHECK_START) {\
if (k->u.null_check.num == (id)) {\
if (level == 0) {\
(isnull) = (k->u.null_check.pstr == (s));\
break;\
}\
else level--;\
}\
}\
else if (k->type == STK_NULL_CHECK_END) {\
level++;\
}\
}\
} while(0)
STK_NULL_CHECK_END
#define STK_NULL_CHECK_END
Definition: regexec.c:400

Definition at line 972 of file regexec.c.

## ◆ STACK_POP

#define STACK_POP

Definition at line 817 of file regexec.c.

## ◆ STACK_POP_ABSENT_POS

#define STACK_POP_ABSENT_POS | ( |  | start,
|  |  | end
| ) |  |

Value:
do {\
stk--;\
STACK_BASE_CHECK(stk, "STACK_POP_ABSENT_POS"); \
(start) = stk->u.absent_pos.abs_pstr;\
(end) = stk->u.absent_pos.end_pstr;\
} while(0)

Definition at line 921 of file regexec.c.

## ◆ STACK_POP_ONE

#define STACK_POP_ONE

Value:
do {\
stk--;\
STACK_BASE_CHECK(stk, "STACK_POP_ONE"); \
} while(0)

Definition at line 812 of file regexec.c.

## ◆ STACK_POP_TIL_ABSENT

#define STACK_POP_TIL_ABSENT

Value:
do {\
while (1) {\
stk--;\
STACK_BASE_CHECK(stk, "STACK_POP_TIL_ABSENT"); \
if (stk->type == STK_ABSENT) break;\
else if (stk->type == STK_MEM_START) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
else if (stk->type == STK_REPEAT_INC) {\
STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\
}\
else if (stk->type == STK_MEM_END) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
ELSE_IF_STATE_CHECK_MARK(stk);\
}\
} while(0)
STK_REPEAT_INC
#define STK_REPEAT_INC
Definition: regexec.c:396
STK_ABSENT
#define STK_ABSENT
Definition: regexec.c:409

Definition at line 901 of file regexec.c.

## ◆ STACK_POP_TIL_LOOK_BEHIND_NOT

#define STACK_POP_TIL_LOOK_BEHIND_NOT

Value:
do {\
while (1) {\
stk--;\
STACK_BASE_CHECK(stk, "STACK_POP_TIL_LOOK_BEHIND_NOT"); \
if (stk->type == STK_LOOK_BEHIND_NOT) break;\
else if (stk->type == STK_MEM_START) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
else if (stk->type == STK_REPEAT_INC) {\
STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\
}\
else if (stk->type == STK_MEM_END) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
ELSE_IF_STATE_CHECK_MARK(stk);\
}\
} while(0)
STK_LOOK_BEHIND_NOT
#define STK_LOOK_BEHIND_NOT
Definition: regexec.c:391

Definition at line 881 of file regexec.c.

## ◆ STACK_POP_TIL_POS_NOT

#define STACK_POP_TIL_POS_NOT

Value:
do {\
while (1) {\
stk--;\
STACK_BASE_CHECK(stk, "STACK_POP_TIL_POS_NOT"); \
if (stk->type == STK_POS_NOT) break;\
else if (stk->type == STK_MEM_START) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
else if (stk->type == STK_REPEAT_INC) {\
STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\
}\
else if (stk->type == STK_MEM_END) {\
mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\
}\
ELSE_IF_STATE_CHECK_MARK(stk);\
}\
} while(0)
STK_POS_NOT
#define STK_POS_NOT
Definition: regexec.c:392

Definition at line 861 of file regexec.c.

## ◆ STACK_POS_END

#define STACK_POS_END | ( |  | k | ) |

Value:
do {\
k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_POS_END"); \
if (IS_TO_VOID_TARGET(k)) {\
k->type = STK_VOID;\
}\
else if (k->type == STK_POS) {\
k->type = STK_VOID;\
break;\
}\
}\
} while(0)
STK_VOID
#define STK_VOID
Definition: regexec.c:407
STK_POS
#define STK_POS
Definition: regexec.c:402
IS_TO_VOID_TARGET
#define IS_TO_VOID_TARGET(stk)
Definition: regexec.c:597

Definition at line 928 of file regexec.c.

## ◆ STACK_PUSH

#define STACK_PUSH | ( |  | stack_type,
|  |  | pat,
|  |  | s,
|  |  | sprev,
|  |  | keep
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = (stack_type);\
stk->u.state.pcode = (pat);\
stk->u.state.pstr = (s);\
stk->u.state.pstr_prev = (sprev);\
stk->u.state.pkeep = (keep);\
STACK_INC;\
} while(0)
STACK_INC
#define STACK_INC
Definition: regexec.c:1389
stack_type
VALUE stack_type
Definition: ripper.c:230

Definition at line 660 of file regexec.c.

## ◆ STACK_PUSH_ABSENT

#define STACK_PUSH_ABSENT STACK_PUSH_TYPE(STK_ABSENT)

Definition at line 680 of file regexec.c.

## ◆ STACK_PUSH_ABSENT_POS

#define STACK_PUSH_ABSENT_POS | ( |  | start,
|  |  | end
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_ABSENT_POS;\
stk->u.absent_pos.abs_pstr = (start);\
stk->u.absent_pos.end_pstr = (end);\
STACK_INC;\
} while(0)
STK_ABSENT_POS
#define STK_ABSENT_POS
Definition: regexec.c:408

Definition at line 793 of file regexec.c.

## ◆ STACK_PUSH_ALT

#define STACK_PUSH_ALT | ( |  | pat,
|  |  | s,
|  |  | sprev,
|  |  | keep
| ) |  | STACK_PUSH(STK_ALT,pat,s,sprev,keep)

Definition at line 677 of file regexec.c.

## ◆ STACK_PUSH_CALL_FRAME

#define STACK_PUSH_CALL_FRAME | ( |  | pat | ) |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_CALL_FRAME;\
stk->u.call_frame.ret_addr = (pat);\
STACK_INC;\
} while(0)

Definition at line 780 of file regexec.c.

## ◆ STACK_PUSH_ENSURED

#define STACK_PUSH_ENSURED | ( |  | stack_type,
|  |  | pat
| ) |  |

Value:
do {\
stk->type = (stack_type);\
stk->u.state.pcode = (pat);\
STACK_INC;\
} while(0)

Definition at line 670 of file regexec.c.

## ◆ STACK_PUSH_LOOK_BEHIND_NOT

#define STACK_PUSH_LOOK_BEHIND_NOT | ( |  | pat,
|  |  | s,
|  |  | sprev,
|  |  | keep
| ) |  | STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev,keep)

Definition at line 682 of file regexec.c.

## ◆ STACK_PUSH_MEM_END

#define STACK_PUSH_MEM_END | ( |  | mnum,
|  |  | s
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_MEM_END;\
stk->u.mem.num = (mnum);\
stk->u.mem.pstr = (s);\
stk->u.mem.start = mem_start_stk[mnum];\
stk->u.mem.end = mem_end_stk[mnum];\
mem_end_stk[mnum] = GET_STACK_INDEX(stk);\
STACK_INC;\
} while(0)
GET_STACK_INDEX
#define GET_STACK_INDEX(stk)
Definition: regexec.c:589

Definition at line 713 of file regexec.c.

## ◆ STACK_PUSH_MEM_END_MARK

#define STACK_PUSH_MEM_END_MARK | ( |  | mnum | ) |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_MEM_END_MARK;\
stk->u.mem.num = (mnum);\
STACK_INC;\
} while(0)
STK_MEM_END_MARK
#define STK_MEM_END_MARK
Definition: regexec.c:401

Definition at line 724 of file regexec.c.

## ◆ STACK_PUSH_MEM_START

#define STACK_PUSH_MEM_START | ( |  | mnum,
|  |  | s
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_MEM_START;\
stk->u.mem.num = (mnum);\
stk->u.mem.pstr = (s);\
stk->u.mem.start = mem_start_stk[mnum];\
stk->u.mem.end = mem_end_stk[mnum];\
mem_start_stk[mnum] = GET_STACK_INDEX(stk);\
mem_end_stk[mnum] = INVALID_STACK_INDEX;\
STACK_INC;\
} while(0)
INVALID_STACK_INDEX
#define INVALID_STACK_INDEX
stack
Definition: regexec.c:386

Definition at line 701 of file regexec.c.

## ◆ STACK_PUSH_NULL_CHECK_END

#define STACK_PUSH_NULL_CHECK_END | ( |  | cnum | ) |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_NULL_CHECK_END;\
stk->u.null_check.num = (cnum);\
STACK_INC;\
} while(0)

Definition at line 773 of file regexec.c.

## ◆ STACK_PUSH_NULL_CHECK_START

#define STACK_PUSH_NULL_CHECK_START | ( |  | cnum,
|  |  | s
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_NULL_CHECK_START;\
stk->u.null_check.num = (cnum);\
stk->u.null_check.pstr = (s);\
STACK_INC;\
} while(0)

Definition at line 765 of file regexec.c.

## ◆ STACK_PUSH_POS

#define STACK_PUSH_POS | ( |  | s,
|  |  | sprev,
|  |  | keep
| ) |  | STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev,keep)

Definition at line 678 of file regexec.c.

## ◆ STACK_PUSH_POS_NOT

#define STACK_PUSH_POS_NOT | ( |  | pat,
|  |  | s,
|  |  | sprev,
|  |  | keep
| ) |  | STACK_PUSH(STK_POS_NOT,pat,s,sprev,keep)

Definition at line 679 of file regexec.c.

## ◆ STACK_PUSH_REPEAT

#define STACK_PUSH_REPEAT | ( |  | id,
|  |  | pat
| ) |  |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_REPEAT;\
stk->u.repeat.num = (id);\
stk->u.repeat.pcode = (pat);\
stk->u.repeat.count = 0;\
STACK_INC;\
} while(0)
id
const int id
Definition: nkf.c:209

Definition at line 685 of file regexec.c.

## ◆ STACK_PUSH_REPEAT_INC

#define STACK_PUSH_REPEAT_INC | ( |  | sindex | ) |

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_REPEAT_INC;\
stk->u.repeat_inc.si = (sindex);\
STACK_INC;\
} while(0)

Definition at line 694 of file regexec.c.

## ◆ STACK_PUSH_RETURN

#define STACK_PUSH_RETURN

Value:
do {\
STACK_ENSURE(1);\
stk->type = STK_RETURN;\
STACK_INC;\
} while(0)

Definition at line 787 of file regexec.c.

## ◆ STACK_PUSH_STOP_BT

#define STACK_PUSH_STOP_BT STACK_PUSH_TYPE(STK_STOP_BT)

Definition at line 681 of file regexec.c.

## ◆ STACK_PUSH_TYPE

#define STACK_PUSH_TYPE | ( |  | stack_type | ) |

Value:
do {\
STACK_ENSURE(1);\
stk->type = (stack_type);\
STACK_INC;\
} while(0)

Definition at line 591 of file regexec.c.

## ◆ STACK_RETURN

#define STACK_RETURN | ( |  | addr | ) |

Value:
do {\
int level = 0;\
OnigStackType* k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_RETURN"); \
if (k->type == STK_CALL_FRAME) {\
if (level == 0) {\
(addr) = k->u.call_frame.ret_addr;\
break;\
}\
else level--;\
}\
else if (k->type == STK_RETURN)\
level++;\
}\
} while(0)
_OnigStackType::call_frame
struct _OnigStackType::@144::@150 call_frame
_OnigStackType::ret_addr
UChar * ret_addr
Definition: regint.h:846

Definition at line 1098 of file regexec.c.

## ◆ STACK_SAVE

#define STACK_SAVE

Value:
do{\
if (stk_base != stk_alloc) {\
msa->stack_p = stk_base;\
msa->stack_n = stk_end - stk_base; /* TODO: check overflow */\
};\
} while(0)

Definition at line 513 of file regexec.c.

## ◆ STACK_STOP_BT_END

#define STACK_STOP_BT_END

Value:
do {\
OnigStackType *k = stk;\
while (1) {\
k--;\
STACK_BASE_CHECK(k, "STACK_STOP_BT_END"); \
if (IS_TO_VOID_TARGET(k)) {\
k->type = STK_VOID;\
}\
else if (k->type == STK_STOP_BT) {\
k->type = STK_VOID;\
break;\
}\
}\
} while(0)
STK_STOP_BT
#define STK_STOP_BT
Definition: regexec.c:403

Definition at line 943 of file regexec.c.

## ◆ STK_ABSENT

#define STK_ABSENT 0x0c00 /* absent inner loop marker */

Definition at line 409 of file regexec.c.

## ◆ STK_ABSENT_POS

#define STK_ABSENT_POS 0x0b00 /* for absent */

Definition at line 408 of file regexec.c.

## ◆ STK_ALT

#define STK_ALT 0x0001

Definition at line 390 of file regexec.c.

## ◆ STK_CALL_FRAME

#define STK_CALL_FRAME 0x0800

Definition at line 405 of file regexec.c.

## ◆ STK_LOOK_BEHIND_NOT

#define STK_LOOK_BEHIND_NOT 0x0002

Definition at line 391 of file regexec.c.

## ◆ STK_MASK_MEM_END_OR_MARK

#define STK_MASK_MEM_END_OR_MARK 0x8000 /* MEM_END or MEM_END_MARK */

Definition at line 414 of file regexec.c.

## ◆ STK_MASK_POP_USED

#define STK_MASK_POP_USED 0x00ff

Definition at line 412 of file regexec.c.

## ◆ STK_MASK_TO_VOID_TARGET

#define STK_MASK_TO_VOID_TARGET 0x10ff

Definition at line 413 of file regexec.c.

## ◆ STK_MEM_END

#define STK_MEM_END 0x8200

Definition at line 395 of file regexec.c.

## ◆ STK_MEM_END_MARK

#define STK_MEM_END_MARK 0x8400

Definition at line 401 of file regexec.c.

## ◆ STK_MEM_START

#define STK_MEM_START 0x0100

Definition at line 394 of file regexec.c.

## ◆ STK_NULL_CHECK_END

#define STK_NULL_CHECK_END 0x5000 /* for recursive call */

Definition at line 400 of file regexec.c.

## ◆ STK_NULL_CHECK_START

#define STK_NULL_CHECK_START 0x3000

Definition at line 399 of file regexec.c.

## ◆ STK_POS

#define STK_POS 0x0500 /* used when POP-POS */

Definition at line 402 of file regexec.c.

## ◆ STK_POS_NOT

#define STK_POS_NOT 0x0003

Definition at line 392 of file regexec.c.

## ◆ STK_REPEAT

#define STK_REPEAT 0x0700

Definition at line 404 of file regexec.c.

## ◆ STK_REPEAT_INC

#define STK_REPEAT_INC 0x0300

Definition at line 396 of file regexec.c.

## ◆ STK_RETURN

#define STK_RETURN 0x0900

Definition at line 406 of file regexec.c.

## ◆ STK_STATE_CHECK_MARK

#define STK_STATE_CHECK_MARK 0x1000

Definition at line 397 of file regexec.c.

## ◆ STK_STOP_BT

#define STK_STOP_BT 0x0600 /* mark for "(?>...)" */

Definition at line 403 of file regexec.c.

## ◆ STK_VOID

#define STK_VOID 0x0a00 /* for fill a blank */

Definition at line 407 of file regexec.c.

## ◆ STRING_CMP

#define STRING_CMP | ( |  | s1,
|  |  | s2,
|  |  | len
| ) |  |

Value:
do {\
while (len-- > 0) {\
if (*s1++ != *s2++) goto fail;\
}\
} while(0)
fail
#define fail()
Definition: date_strptime.c:123
len
uint8_t len
Definition: escape.c:17

Definition at line 1117 of file regexec.c.

## ◆ STRING_CMP_IC

#define STRING_CMP_IC | ( |  | case_fold_flag,
|  |  | s1,
|  |  | ps2,
|  |  | len,
|  |  | text_end
| ) |  |

Value:
do {\
if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len, text_end) == 0) \
goto fail; \
} while(0)

Definition at line 1123 of file regexec.c.

## ◆ STRING_CMP_VALUE

#define STRING_CMP_VALUE | ( |  | s1,
|  |  | s2,
|  |  | len,
|  |  | is_fail
| ) |  |

Value:
do {\
is_fail = 0;\
while (len-- > 0) {\
if (*s1++ != *s2++) {\
is_fail = 1; break;\
}\
}\
} while(0)

Definition at line 1155 of file regexec.c.

## ◆ STRING_CMP_VALUE_IC

#define STRING_CMP_VALUE_IC | ( |  | case_fold_flag,
|  |  | s1,
|  |  | ps2,
|  |  | len,
|  |  | text_end,
|  |  | is_fail
| ) |  |

Value:
do {\
if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len, text_end) == 0) \
is_fail = 1; \
else \
is_fail = 0; \
} while(0)

Definition at line 1164 of file regexec.c.

## ◆ USE_TOKEN_THREADED_VM

#define USE_TOKEN_THREADED_VM 1

Definition at line 41 of file regexec.c.

## ◆ VM_LOOP

#define VM_LOOP

Value:
while (1) { \
OPCODE_EXEC_HOOK; \
sbegin = s; \
switch (*p++) {
OPCODE_EXEC_HOOK
#define OPCODE_EXEC_HOOK

## ◆ VM_LOOP_END

#define VM_LOOP_END } sprev = sbegin; }

## Function Documentation

## ◆ onig_copy_encoding()

void onig_copy_encoding | ( | OnigEncodingType * | to,
|  | OnigEncoding | from
| ) |  |

Definition at line 4618 of file regexec.c.

## ◆ onig_get_case_fold_flag()

OnigCaseFoldType onig_get_case_fold_flag | ( | const regex_t * | reg | ) |

Definition at line 4583 of file regexec.c.

References re_pattern_buffer::case_fold_flag.

## ◆ onig_get_encoding()

OnigEncoding onig_get_encoding | ( | const regex_t * | reg | ) |

Definition at line 4571 of file regexec.c.

References re_pattern_buffer::enc.

## ◆ onig_get_match_stack_limit_size()

unsigned int onig_get_match_stack_limit_size | ( | void |  | ) |

Definition at line 523 of file regexec.c.

## ◆ onig_get_options()

OnigOptionType onig_get_options | ( | const regex_t * | reg | ) |

Definition at line 4577 of file regexec.c.

References re_pattern_buffer::options.

## ◆ onig_get_syntax()

const OnigSyntaxType * onig_get_syntax | ( | const regex_t * | reg | ) |

Definition at line 4589 of file regexec.c.

References re_pattern_buffer::syntax.

## ◆ onig_match()

OnigPosition onig_match | ( | regex_t * | reg,
|  | const UChar * | str,
|  | const UChar * | end,
|  | const UChar * | at,
|  | OnigRegion * | region,
|  | OnigOptionType | option
| ) |  |

Definition at line 3866 of file regexec.c.

References re_pattern_buffer::enc, MATCH_ARG_FREE, MATCH_ARG_INIT, re_pattern_buffer::num_comb_exp_check, re_pattern_buffer::num_mem, onigenc_get_prev_char_head(), str, and UChar.

## ◆ onig_number_of_capture_histories()

int onig_number_of_capture_histories | ( | const regex_t * | reg | ) |

Definition at line 4601 of file regexec.c.

References BIT_STATUS_AT, re_pattern_buffer::capture_history, and ONIG_MAX_CAPTURE_HISTORY_GROUP.

## ◆ onig_number_of_captures()

int onig_number_of_captures | ( | const regex_t * | reg | ) |

Definition at line 4595 of file regexec.c.

References re_pattern_buffer::num_mem.

## ◆ onig_region_clear()

void onig_region_clear | ( | OnigRegion * | region | ) |

Definition at line 235 of file regexec.c.

References re_registers::beg, re_registers::end, re_registers::num_regs, and ONIG_REGION_NOTPOS.

Referenced by onig_search_gpos().

## ◆ onig_region_copy()

void onig_region_copy | ( | OnigRegion * | to,
|  | const OnigRegion * | from
| ) |  |

Definition at line 359 of file regexec.c.

References re_registers::beg, re_registers::end, IS_NOT_NULL, re_registers::num_regs, and onig_region_resize().

Referenced by rb_reg_region_copy().

## ◆ onig_region_free()

void onig_region_free | ( | OnigRegion * | r,
|  | int | free_self
| ) |  |

Definition at line 343 of file regexec.c.

References re_registers::allocated, re_registers::beg, re_registers::end, and xfree.

Referenced by rb_reg_start_with_p().

## ◆ onig_region_init()

void onig_region_init | ( | OnigRegion * | region | ) |

Definition at line 320 of file regexec.c.

References re_registers::allocated, re_registers::beg, re_registers::end, and re_registers::num_regs.

Referenced by onig_region_new().

## ◆ onig_region_new()

OnigRegion * onig_region_new | ( | void |  | ) |

Definition at line 332 of file regexec.c.

References onig_region_init(), and xmalloc.

## ◆ onig_region_resize()

int onig_region_resize | ( | OnigRegion * | region,
|  | int | n
| ) |  |

Definition at line 248 of file regexec.c.

References re_registers::allocated, re_registers::beg, re_registers::end, re_registers::num_regs, ONIG_NREGION, ONIGERR_MEMORY, xfree, xmalloc, and xrealloc.

Referenced by onig_region_copy(), and onig_region_set().

## ◆ onig_region_set()

int onig_region_set | ( | OnigRegion * | region,
|  | int | at,
|  | int | beg,
|  | int | end
| ) |  |

Definition at line 305 of file regexec.c.

References re_registers::allocated, re_registers::beg, re_registers::end, onig_region_resize(), and ONIGERR_INVALID_ARGUMENT.

## ◆ onig_scan()

OnigPosition onig_scan | ( | regex_t * | reg,
|  | const UChar * | str,
|  | const UChar * | end,
|  | OnigRegion * | region,
|  | OnigOptionType | option,
|  | int(*)(OnigPosition, OnigPosition, OnigRegion *, void *) | scan_callback,
|  | void * | callback_arg
| ) |  |

Definition at line 4529 of file regexec.c.

References re_pattern_buffer::enc, enclen, re_registers::end, ONIG_MISMATCH, onig_search(), str, and UChar.

## ◆ onig_search()

OnigPosition onig_search | ( | regex_t * | reg,
|  | const UChar * | str,
|  | const UChar * | end,
|  | const UChar * | start,
|  | const UChar * | range,
|  | OnigRegion * | region,
|  | OnigOptionType | option
| ) |  |

Definition at line 4149 of file regexec.c.

References onig_search_gpos(), range, and str.

Referenced by onig_scan().

## ◆ onig_search_gpos()

OnigPosition onig_search_gpos | ( | regex_t * | reg,
|  | const UChar * | str,
|  | const UChar * | end,
|  | const UChar * | global_pos,
|  | const UChar * | start,
|  | const UChar * | range,
|  | OnigRegion * | region,
|  | OnigOptionType | option
| ) |  |

Definition at line 4156 of file regexec.c.

References re_pattern_buffer::anchor, ANCHOR_ANYCHAR_STAR, ANCHOR_ANYCHAR_STAR_ML, ANCHOR_BEGIN_BUF, ANCHOR_BEGIN_POSITION, re_pattern_buffer::anchor_dmax, re_pattern_buffer::anchor_dmin, ANCHOR_END_BUF, ANCHOR_LOOK_BEHIND, ANCHOR_PREC_READ_NOT, ANCHOR_SEMI_END_BUF, OnigMatchArg::best_len, OnigMatchArg::best_s, re_pattern_buffer::dmax, re_pattern_buffer::enc, enclen, IS_FIND_LONGEST, IS_FIND_NOT_EMPTY, IS_NEWLINE_CRLF, IS_NOT_NULL, match, MATCH_AND_RETURN_CHECK, MATCH_ARG_FREE, MATCH_ARG_INIT, MIN, NULL, re_pattern_buffer::num_comb_exp_check, re_pattern_buffer::num_mem, ONIG_INFINITE_DISTANCE, ONIG_MISMATCH, ONIG_OPTIMIZE_NONE, onig_region_clear(), onigenc_get_prev_char_head(), onigenc_get_right_adjust_char_head(), ONIGENC_IS_MBC_CRNL, ONIGENC_IS_MBC_NEWLINE, ONIGENC_IS_MBC_NEWLINE_EX, ONIGENC_LEFT_ADJUST_CHAR_HEAD, ONIGENC_STEP_BACK, re_pattern_buffer::optimize, re_pattern_buffer::options, PRIdPTRDIFF, PRIuPTR, range, str, re_pattern_buffer::threshold_len, and UChar.

Referenced by onig_search().

## ◆ onig_set_match_stack_limit_size()

int onig_set_match_stack_limit_size | ( | unsigned int | size | ) |

Definition at line 529 of file regexec.c.