Ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a25176072e02db9254f0e0c84c805cd)
Data Structures | Macros | Functions | Variables
regcomp.c File Reference
#include "regparse.h"

Go to the source code of this file.

Data Structures

struct  MinMaxLen
 
struct  OptEnv
 
struct  OptAncInfo
 
struct  OptExactInfo
 
struct  OptMapInfo
 
struct  NodeOptInfo
 

Macros

#define IS_NEED_STR_LEN_OP_EXACT(op)
 
#define REPEAT_RANGE_ALLOC   4
 
#define QUANTIFIER_EXPAND_LIMIT_SIZE   50
 
#define CKN_ON   (ckn > 0)
 
#define GET_CHAR_LEN_VARLEN   -1
 
#define GET_CHAR_LEN_TOP_ALT_VARLEN   -2
 
#define RECURSION_EXIST   1
 
#define RECURSION_INFINITE   2
 
#define FOUND_CALLED_NODE   1
 
#define THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION   8
 
#define IN_ALT   (1<<0)
 
#define IN_NOT   (1<<1)
 
#define IN_REPEAT   (1<<2)
 
#define IN_VAR_REPEAT   (1<<3)
 
#define IN_CALL   (1<<4)
 
#define IN_RECCALL   (1<<5)
 
#define EXPAND_STRING_MAX_LENGTH   100
 
#define ALLOWED_TYPE_IN_LB
 
#define ALLOWED_ENCLOSE_IN_LB   ( ENCLOSE_MEMORY | ENCLOSE_OPTION )
 
#define ALLOWED_ENCLOSE_IN_LB_NOT   ENCLOSE_OPTION
 
#define ALLOWED_ANCHOR_IN_LB
 
#define ALLOWED_ANCHOR_IN_LB_NOT
 
#define COMP_EM_BASE   20
 
#define MAX_NODE_OPT_INFO_REF_COUNT   5
 
#define REGEX_TRANSFER(to, from)
 
#define COMPILE_INIT_SIZE   20
 

Functions

OnigCaseFoldType onig_get_default_case_fold_flag (void)
 
int onig_set_default_case_fold_flag (OnigCaseFoldType case_fold_flag)
 
int onig_bbuf_init (BBuf *buf, OnigDistance size)
 
void onig_free_body (regex_t *reg)
 
void onig_free (regex_t *reg)
 
size_t onig_memsize (const regex_t *reg)
 
size_t onig_region_memsize (const OnigRegion *regs)
 
int onig_compile (regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo)
 
int onig_compile_ruby (regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo, const char *sourcefile, int sourceline)
 
int onig_reg_init (regex_t *reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType *syntax)
 
int onig_new_without_alloc (regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType *syntax, OnigErrorInfo *einfo)
 
int onig_new (regex_t **reg, const UChar *pattern, const UChar *pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType *syntax, OnigErrorInfo *einfo)
 
int onig_initialize (OnigEncoding encodings[] ARG_UNUSED, int n ARG_UNUSED)
 
int onig_init (void)
 
void onig_add_end_call (void(*func)(void))
 
int onig_end (void)
 
int onig_is_in_code_range (const UChar *p, OnigCodePoint code)
 
int onig_is_code_in_cc_len (int elen, OnigCodePoint code, CClassNode *cc)
 
int onig_is_code_in_cc (OnigEncoding enc, OnigCodePoint code, CClassNode *cc)
 

Variables

OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN
 

Macro Definition Documentation

◆ ALLOWED_ANCHOR_IN_LB

#define ALLOWED_ANCHOR_IN_LB
Value:
ANCHOR_WORD_BOUND | ANCHOR_NOT_WORD_BOUND | \
ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
#define ANCHOR_BEGIN_LINE
Definition: regint.h:528
#define ANCHOR_BEGIN_POSITION
Definition: regint.h:529
#define ANCHOR_LOOK_BEHIND
Definition: regint.h:540
#define ANCHOR_BEGIN_BUF
Definition: regint.h:527
#define ANCHOR_LOOK_BEHIND_NOT
Definition: regint.h:541
#define ANCHOR_KEEP
Definition: regint.h:546
#define ANCHOR_NOT_WORD_BOUND
Definition: regint.h:535
#define ANCHOR_WORD_END
Definition: regint.h:537

◆ ALLOWED_ANCHOR_IN_LB_NOT

#define ALLOWED_ANCHOR_IN_LB_NOT
Value:

◆ ALLOWED_ENCLOSE_IN_LB

#define ALLOWED_ENCLOSE_IN_LB   ( ENCLOSE_MEMORY | ENCLOSE_OPTION )

◆ ALLOWED_ENCLOSE_IN_LB_NOT

#define ALLOWED_ENCLOSE_IN_LB_NOT   ENCLOSE_OPTION

◆ ALLOWED_TYPE_IN_LB

#define ALLOWED_TYPE_IN_LB
Value:
#define BIT_NT_CCLASS
Definition: regparse.h:54
#define BIT_NT_STR
Definition: regparse.h:53
#define BIT_NT_ANCHOR
Definition: regparse.h:60
#define BIT_NT_CALL
Definition: regparse.h:63
#define BIT_NT_CTYPE
Definition: regparse.h:55
#define BIT_NT_LIST
Definition: regparse.h:61
#define BIT_NT_ALT
Definition: regparse.h:62
#define BIT_NT_ENCLOSE
Definition: regparse.h:59
#define BIT_NT_QTFR
Definition: regparse.h:58

◆ CKN_ON

#define CKN_ON   (ckn > 0)

Definition at line 722 of file regcomp.c.

◆ COMP_EM_BASE

#define COMP_EM_BASE   20

◆ COMPILE_INIT_SIZE

#define COMPILE_INIT_SIZE   20

◆ EXPAND_STRING_MAX_LENGTH

#define EXPAND_STRING_MAX_LENGTH   100

◆ FOUND_CALLED_NODE

#define FOUND_CALLED_NODE   1

◆ GET_CHAR_LEN_TOP_ALT_VARLEN

#define GET_CHAR_LEN_TOP_ALT_VARLEN   -2

Definition at line 2414 of file regcomp.c.

◆ GET_CHAR_LEN_VARLEN

#define GET_CHAR_LEN_VARLEN   -1

Definition at line 2413 of file regcomp.c.

◆ IN_ALT

#define IN_ALT   (1<<0)

Definition at line 3860 of file regcomp.c.

◆ IN_CALL

#define IN_CALL   (1<<4)

Definition at line 3864 of file regcomp.c.

◆ IN_NOT

#define IN_NOT   (1<<1)

Definition at line 3861 of file regcomp.c.

◆ IN_RECCALL

#define IN_RECCALL   (1<<5)

Definition at line 3865 of file regcomp.c.

◆ IN_REPEAT

#define IN_REPEAT   (1<<2)

Definition at line 3862 of file regcomp.c.

◆ IN_VAR_REPEAT

#define IN_VAR_REPEAT   (1<<3)

Definition at line 3863 of file regcomp.c.

◆ IS_NEED_STR_LEN_OP_EXACT

#define IS_NEED_STR_LEN_OP_EXACT (   op)
Value:
((op) == OP_EXACTN || (op) == OP_EXACTMB2N ||\
(op) == OP_EXACTMB3N || (op) == OP_EXACTMBN || (op) == OP_EXACTN_IC)
@ OP_EXACTMB3N
Definition: regint.h:563
@ OP_EXACTMBN
Definition: regint.h:564
@ OP_EXACTMB2N
Definition: regint.h:562
@ OP_EXACTN
Definition: regint.h:558
@ OP_EXACTN_IC
Definition: regint.h:567

Definition at line 315 of file regcomp.c.

◆ MAX_NODE_OPT_INFO_REF_COUNT

#define MAX_NODE_OPT_INFO_REF_COUNT   5

Definition at line 4955 of file regcomp.c.

◆ QUANTIFIER_EXPAND_LIMIT_SIZE

#define QUANTIFIER_EXPAND_LIMIT_SIZE   50

Definition at line 721 of file regcomp.c.

◆ RECURSION_EXIST

#define RECURSION_EXIST   1

Definition at line 2888 of file regcomp.c.

◆ RECURSION_INFINITE

#define RECURSION_INFINITE   2

Definition at line 2889 of file regcomp.c.

◆ REGEX_TRANSFER

#define REGEX_TRANSFER (   to,
  from 
)
Value:
do {\
onig_free_body(to);\
xmemcpy(to, from, sizeof(regex_t));\
xfree(from);\
} while (0)

Definition at line 5681 of file regcomp.c.

◆ REPEAT_RANGE_ALLOC

#define REPEAT_RANGE_ALLOC   4

◆ THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION

#define THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION   8

Function Documentation

◆ onig_add_end_call()

void onig_add_end_call ( void(*)(void func)

Definition at line 6028 of file regcomp.c.

References OnigEndCallListItem::next, and xmalloc.

◆ onig_bbuf_init()

int onig_bbuf_init ( BBuf buf,
OnigDistance  size 
)

Definition at line 142 of file regcomp.c.

References buf, int, IS_NULL, NULL, ONIGERR_MEMORY, size, UChar, and xmalloc.

◆ onig_compile()

int onig_compile ( regex_t reg,
const UChar pattern,
const UChar pattern_end,
OnigErrorInfo einfo 
)

Definition at line 5704 of file regcomp.c.

References NULL, and onig_compile_ruby().

Referenced by onig_new(), and onig_new_without_alloc().

◆ onig_compile_ruby()

int onig_compile_ruby ( regex_t reg,
const UChar pattern,
const UChar pattern_end,
OnigErrorInfo einfo,
const char sourcefile,
int  sourceline 
)

◆ onig_end()

int onig_end ( void  )

Definition at line 6058 of file regcomp.c.

◆ onig_free()

void onig_free ( regex_t reg)

Definition at line 5647 of file regcomp.c.

References IS_NOT_NULL, onig_free_body(), and xfree.

Referenced by onig_free_body(), and onig_new().

◆ onig_free_body()

void onig_free_body ( regex_t reg)

◆ onig_get_default_case_fold_flag()

OnigCaseFoldType onig_get_default_case_fold_flag ( void  )

Definition at line 36 of file regcomp.c.

References OnigDefaultCaseFoldFlag.

◆ onig_init()

int onig_init ( void  )

Definition at line 6004 of file regcomp.c.

Referenced by onig_initialize().

◆ onig_initialize()

int onig_initialize ( OnigEncoding encodings[]  ARG_UNUSED,
int n  ARG_UNUSED 
)

Definition at line 5998 of file regcomp.c.

References onig_init().

◆ onig_is_code_in_cc()

int onig_is_code_in_cc ( OnigEncoding  enc,
OnigCodePoint  code,
CClassNode cc 
)

Definition at line 6120 of file regcomp.c.

References cc, len, onig_is_code_in_cc_len(), ONIGENC_CODE_TO_MBCLEN, and ONIGENC_MBC_MINLEN.

◆ onig_is_code_in_cc_len()

int onig_is_code_in_cc_len ( int  elen,
OnigCodePoint  code,
CClassNode cc 
)

Definition at line 6097 of file regcomp.c.

References BITSET_AT, cc, IS_NCCLASS_NOT, IS_NULL, onig_is_in_code_range(), and SINGLE_BYTE_SIZE.

Referenced by onig_is_code_in_cc().

◆ onig_is_in_code_range()

int onig_is_in_code_range ( const UChar p,
OnigCodePoint  code 
)

Definition at line 6076 of file regcomp.c.

References GET_CODE_POINT, and n.

Referenced by onig_is_code_in_cc_len().

◆ onig_memsize()

size_t onig_memsize ( const regex_t reg)

◆ onig_new()

int onig_new ( regex_t **  reg,
const UChar pattern,
const UChar pattern_end,
OnigOptionType  option,
OnigEncoding  enc,
const OnigSyntaxType syntax,
OnigErrorInfo einfo 
)

◆ onig_new_without_alloc()

int onig_new_without_alloc ( regex_t reg,
const UChar pattern,
const UChar pattern_end,
OnigOptionType  option,
OnigEncoding  enc,
const OnigSyntaxType syntax,
OnigErrorInfo einfo 
)

Definition at line 5962 of file regcomp.c.

References onig_compile(), onig_reg_init(), and ONIGENC_CASE_FOLD_DEFAULT.

◆ onig_reg_init()

int onig_reg_init ( regex_t reg,
OnigOptionType  option,
OnigCaseFoldType  case_fold_flag,
OnigEncoding  enc,
const OnigSyntaxType syntax 
)

Definition at line 5918 of file regcomp.c.

Referenced by onig_new(), and onig_new_without_alloc().

◆ onig_region_memsize()

size_t onig_region_memsize ( const OnigRegion regs)

Definition at line 5672 of file regcomp.c.

References re_registers::allocated, re_registers::beg, re_registers::end, IS_NULL, and size.

◆ onig_set_default_case_fold_flag()

int onig_set_default_case_fold_flag ( OnigCaseFoldType  case_fold_flag)

Definition at line 42 of file regcomp.c.

References OnigDefaultCaseFoldFlag.

Variable Documentation

◆ OnigDefaultCaseFoldFlag

OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN

Definition at line 33 of file regcomp.c.

Referenced by onig_get_default_case_fold_flag(), and onig_set_default_case_fold_flag().