Ruby  2.5.0dev(2017-10-22revision60238)
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_NOT_WORD_BOUND
Definition: regint.h:535
#define ANCHOR_WORD_END
Definition: regint.h:537
#define ANCHOR_LOOK_BEHIND_NOT
Definition: regint.h:541
#define ANCHOR_BEGIN_BUF
Definition: regint.h:527
#define ANCHOR_LOOK_BEHIND
Definition: regint.h:540
#define ANCHOR_KEEP
Definition: regint.h:546

◆ ALLOWED_ANCHOR_IN_LB_NOT

#define ALLOWED_ANCHOR_IN_LB_NOT
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_NOT_WORD_BOUND
Definition: regint.h:535
#define ANCHOR_WORD_END
Definition: regint.h:537
#define ANCHOR_LOOK_BEHIND_NOT
Definition: regint.h:541
#define ANCHOR_BEGIN_BUF
Definition: regint.h:527
#define ANCHOR_LOOK_BEHIND
Definition: regint.h:540
#define ANCHOR_KEEP
Definition: regint.h:546

◆ 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_STR
Definition: regparse.h:53
#define BIT_NT_ENCLOSE
Definition: regparse.h:59
#define BIT_NT_CCLASS
Definition: regparse.h:54
#define BIT_NT_LIST
Definition: regparse.h:61
#define BIT_NT_CTYPE
Definition: regparse.h:55
#define BIT_NT_ALT
Definition: regparse.h:62
#define BIT_NT_CALL
Definition: regparse.h:63
#define BIT_NT_QTFR
Definition: regparse.h:58
#define BIT_NT_ANCHOR
Definition: regparse.h:60

◆ 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

Referenced by onig_compile_ruby().

◆ 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 2411 of file regcomp.c.

◆ GET_CHAR_LEN_VARLEN

#define GET_CHAR_LEN_VARLEN   -1

Definition at line 2410 of file regcomp.c.

◆ IN_ALT

#define IN_ALT   (1<<0)

Definition at line 3854 of file regcomp.c.

◆ IN_CALL

#define IN_CALL   (1<<4)

Definition at line 3858 of file regcomp.c.

◆ IN_NOT

#define IN_NOT   (1<<1)

Definition at line 3855 of file regcomp.c.

◆ IN_RECCALL

#define IN_RECCALL   (1<<5)

Definition at line 3859 of file regcomp.c.

◆ IN_REPEAT

#define IN_REPEAT   (1<<2)

Definition at line 3856 of file regcomp.c.

◆ IN_VAR_REPEAT

#define IN_VAR_REPEAT   (1<<3)

Definition at line 3857 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)

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 4949 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 2885 of file regcomp.c.

◆ RECURSION_INFINITE

#define RECURSION_INFINITE   2

Definition at line 2886 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 5675 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 6022 of file regcomp.c.

References OnigEndCallListItem::next, return, and xmalloc.

◆ onig_bbuf_init()

int onig_bbuf_init ( BBuf buf,
OnigDistance  size 
)

Definition at line 142 of file regcomp.c.

References _BBuf::alloc, IS_NULL, NULL, ONIGERR_MEMORY, _BBuf::p, UChar, _BBuf::used, and xmalloc.

◆ onig_compile()

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

Definition at line 5698 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 6052 of file regcomp.c.

◆ onig_free()

void onig_free ( regex_t reg)

Definition at line 5641 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 5998 of file regcomp.c.

References onigenc_init().

Referenced by onig_initialize(), and onig_reg_init().

◆ onig_initialize()

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

Definition at line 5992 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 6114 of file regcomp.c.

References ALIGNMENT_RIGHT, ANCHOR_BEGIN_BUF, ANCHOR_BEGIN_LINE, ANCHOR_BEGIN_POSITION, ANCHOR_END_BUF, ANCHOR_END_LINE, ANCHOR_KEEP, ANCHOR_LOOK_BEHIND, ANCHOR_LOOK_BEHIND_NOT, ANCHOR_NOT_WORD_BOUND, ANCHOR_PREC_READ, ANCHOR_PREC_READ_NOT, ANCHOR_SEMI_END_BUF, ANCHOR_WORD_BEGIN, ANCHOR_WORD_BOUND, ANCHOR_WORD_END, BRefNode::back_num, BACKREFS_P, bp, re_pattern_buffer::enc, enclen, ENCLOSE_ABSENT, ENCLOSE_CONDITION, ENCLOSE_MEMORY, ENCLOSE_OPTION, ENCLOSE_STOP_BACKTRACK, re_registers::end, GET_ABSADDR_INC, GET_CODE_POINT, GET_LENGTH_INC, GET_MEMNUM_INC, GET_OPTION_INC, GET_RELADDR_INC, IS_NCCLASS_NOT, IS_NOT_NULL, IS_NULL, len, level, CallNode::name, CallNode::name_end, NANCHOR, NBREF, NCALL, NCAR, NCCLASS, NCDR, NCTYPE, NENCLOSE, NQTFR, NSTR, NSTRING_IS_RAW, NT_ALT, NT_ANCHOR, NT_BREF, NT_CALL, NT_CANY, NT_CCLASS, NT_CTYPE, NT_ENCLOSE, NT_LIST, NT_QTFR, NT_STR, NTYPE, onig_is_code_in_cc_len(), ONIGENC_CODE_TO_MBCLEN, ONIGENC_CTYPE_WORD, ONIGENC_MBC_MINLEN, OP_ABSENT, OP_ABSENT_END, OP_ANYCHAR, OP_ANYCHAR_ML, OP_ANYCHAR_ML_STAR, OP_ANYCHAR_ML_STAR_PEEK_NEXT, OP_ANYCHAR_STAR, OP_ANYCHAR_STAR_PEEK_NEXT, OP_ASCII_WORD, OP_ASCII_WORD_BEGIN, OP_ASCII_WORD_BOUND, OP_ASCII_WORD_END, OP_BACKREF1, OP_BACKREF2, OP_BACKREF_MULTI, OP_BACKREF_MULTI_IC, OP_BACKREF_WITH_LEVEL, OP_BACKREFN, OP_BACKREFN_IC, OP_BEGIN_BUF, OP_BEGIN_LINE, OP_BEGIN_POSITION, OP_CALL, OP_CCLASS, OP_CCLASS_MB, OP_CCLASS_MB_NOT, OP_CCLASS_MIX, OP_CCLASS_MIX_NOT, OP_CCLASS_NOT, OP_CONDITION, OP_END, OP_END_BUF, OP_END_LINE, OP_EXACT1, OP_EXACT1_IC, OP_EXACT2, OP_EXACT3, OP_EXACT4, OP_EXACT5, OP_EXACTMB2N, OP_EXACTMB2N1, OP_EXACTMB2N2, OP_EXACTMB2N3, OP_EXACTMB3N, OP_EXACTMBN, OP_EXACTN, OP_EXACTN_IC, OP_FAIL, OP_FAIL_LOOK_BEHIND_NOT, OP_FAIL_POS, OP_FINISH, OP_JUMP, OP_KEEP, OP_LOOK_BEHIND, OP_MEMORY_END, OP_MEMORY_END_PUSH, OP_MEMORY_END_PUSH_REC, OP_MEMORY_END_REC, OP_MEMORY_START, OP_MEMORY_START_PUSH, OP_NOT_ASCII_WORD, OP_NOT_ASCII_WORD_BOUND, OP_NOT_WORD, OP_NOT_WORD_BOUND, OP_NULL_CHECK_END, OP_NULL_CHECK_END_MEMST, OP_NULL_CHECK_END_MEMST_PUSH, OP_NULL_CHECK_START, OP_POP, OP_POP_POS, OP_POP_STOP_BT, OP_PUSH, OP_PUSH_ABSENT_POS, OP_PUSH_IF_PEEK_NEXT, OP_PUSH_LOOK_BEHIND_NOT, OP_PUSH_OR_JUMP_EXACT1, OP_PUSH_POS, OP_PUSH_POS_NOT, OP_PUSH_STOP_BT, OP_REPEAT, OP_REPEAT_INC, OP_REPEAT_INC_NG, OP_REPEAT_INC_NG_SG, OP_REPEAT_INC_SG, OP_REPEAT_NG, OP_RETURN, OP_SEMI_END_BUF, OP_SET_OPTION, OP_SET_OPTION_PUSH, OP_STATE_CHECK, OP_STATE_CHECK_ANYCHAR_ML_STAR, OP_STATE_CHECK_ANYCHAR_STAR, OP_STATE_CHECK_PUSH, OP_STATE_CHECK_PUSH_OR_JUMP, OP_WORD, OP_WORD_BEGIN, OP_WORD_BOUND, OP_WORD_END, _BBuf::p, re_pattern_buffer::p, PRIxPTR, SIZE_BITSET, SIZE_MEMNUM, SIZE_OPTION, SIZE_RELADDR, SIZE_STATE_CHECK_NUM, TRUE, UChar, _BBuf::used, and re_pattern_buffer::used.

◆ onig_is_code_in_cc_len()

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

◆ onig_is_in_code_range()

int onig_is_in_code_range ( const UChar p,
OnigCodePoint  code 
)

Definition at line 6070 of file regcomp.c.

References GET_CODE_POINT.

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 5956 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 
)

◆ onig_region_memsize()

size_t onig_region_memsize ( const OnigRegion regs)

Definition at line 5666 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().