Ruby  1.9.3p484(2013-11-22revision43786)
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 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 EXPAND_STRING_MAX_LENGTH   100
 
#define ALLOWED_TYPE_IN_LB
 
#define ALLOWED_ENCLOSE_IN_LB   ( ENCLOSE_MEMORY )
 
#define ALLOWED_ENCLOSE_IN_LB_NOT   0
 
#define ALLOWED_ANCHOR_IN_LB   ( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )
 
#define ALLOWED_ANCHOR_IN_LB_NOT   ( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION )
 
#define OPT_EXACT_MAXLEN   24
 
#define COMP_EM_BASE   20
 
#define MAX_NODE_OPT_INFO_REF_COUNT   5
 
#define REGEX_TRANSFER(to, from)
 
#define REGEX_CHAIN_HEAD(reg)
 
#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)
 
static UCharstr_dup (UChar *s, UChar *end)
 
static void swap_node (Node *a, Node *b)
 
static OnigDistance distance_add (OnigDistance d1, OnigDistance d2)
 
static OnigDistance distance_multiply (OnigDistance d, int m)
 
static int bitset_is_empty (BitSetRef bs)
 
int onig_bbuf_init (BBuf *buf, OnigDistance size)
 
static int add_opcode (regex_t *reg, int opcode)
 
static int add_rel_addr (regex_t *reg, int addr)
 
static int add_abs_addr (regex_t *reg, int addr)
 
static int add_length (regex_t *reg, OnigDistance len)
 
static int add_mem_num (regex_t *reg, int num)
 
static int add_pointer (regex_t *reg, void *addr)
 
static int add_option (regex_t *reg, OnigOptionType option)
 
static int add_opcode_rel_addr (regex_t *reg, int opcode, int addr)
 
static int add_bytes (regex_t *reg, UChar *bytes, OnigDistance len)
 
static int add_bitset (regex_t *reg, BitSetRef bs)
 
static int add_opcode_option (regex_t *reg, int opcode, OnigOptionType option)
 
static int compile_length_tree (Node *node, regex_t *reg)
 
static int compile_tree (Node *node, regex_t *reg)
 
static int select_str_opcode (int mb_len, OnigDistance str_len, int ignore_case)
 
static int compile_tree_empty_check (Node *node, regex_t *reg, int empty_info)
 
static int compile_tree_n_times (Node *node, int n, regex_t *reg)
 
static int add_compile_string_length (UChar *s ARG_UNUSED, int mb_len, OnigDistance str_len, regex_t *reg ARG_UNUSED, int ignore_case)
 
static int add_compile_string (UChar *s, int mb_len, OnigDistance str_len, regex_t *reg, int ignore_case)
 
static int compile_length_string_node (Node *node, regex_t *reg)
 
static int compile_length_string_raw_node (StrNode *sn, regex_t *reg)
 
static int compile_string_node (Node *node, regex_t *reg)
 
static int compile_string_raw_node (StrNode *sn, regex_t *reg)
 
static int add_multi_byte_cclass (BBuf *mbuf, regex_t *reg)
 
static int compile_length_cclass_node (CClassNode *cc, regex_t *reg)
 
static int compile_cclass_node (CClassNode *cc, regex_t *reg)
 
static int entry_repeat_range (regex_t *reg, int id, int lower, int upper)
 
static int compile_range_repeat_node (QtfrNode *qn, int target_len, int empty_info, regex_t *reg)
 
static int is_anychar_star_quantifier (QtfrNode *qn)
 
static int compile_length_quantifier_node (QtfrNode *qn, regex_t *reg)
 
static int compile_quantifier_node (QtfrNode *qn, regex_t *reg)
 
static int compile_length_option_node (EncloseNode *node, regex_t *reg)
 
static int compile_option_node (EncloseNode *node, regex_t *reg)
 
static int compile_length_enclose_node (EncloseNode *node, regex_t *reg)
 
static int get_char_length_tree (Node *node, regex_t *reg, int *len)
 
static int compile_enclose_node (EncloseNode *node, regex_t *reg)
 
static int compile_length_anchor_node (AnchorNode *node, regex_t *reg)
 
static int compile_anchor_node (AnchorNode *node, regex_t *reg)
 
static int get_min_match_length (Node *node, OnigDistance *min, ScanEnv *env)
 
static int get_max_match_length (Node *node, OnigDistance *max, ScanEnv *env)
 
static int get_char_length_tree1 (Node *node, regex_t *reg, int *len, int level)
 
static int is_not_included (Node *x, Node *y, regex_t *reg)
 
static Nodeget_head_value_node (Node *node, int exact, regex_t *reg)
 
static int check_type_tree (Node *node, int type_mask, int enclose_mask, int anchor_mask)
 
static int divide_look_behind_alternatives (Node *node)
 
static int setup_look_behind (Node *node, regex_t *reg, ScanEnv *env)
 
static int next_setup (Node *node, Node *next_node, regex_t *reg)
 
static int update_string_node_case_fold (regex_t *reg, Node *node)
 
static int expand_case_fold_make_rem_string (Node **rnode, UChar *s, UChar *end, regex_t *reg)
 
static int expand_case_fold_string_alt (int item_num, OnigCaseFoldCodeItem items[], UChar *p, int slen, UChar *end, regex_t *reg, Node **rnode)
 
static int expand_case_fold_string (Node *node, regex_t *reg)
 
static int setup_tree (Node *node, regex_t *reg, int state, ScanEnv *env)
 
static int set_bm_skip (UChar *s, UChar *end, OnigEncoding enc ARG_UNUSED, UChar skip[], int **int_skip)
 
static int map_position_value (OnigEncoding enc, int i)
 
static int distance_value (MinMaxLen *mm)
 
static int comp_distance_value (MinMaxLen *d1, MinMaxLen *d2, int v1, int v2)
 
static int is_equal_mml (MinMaxLen *a, MinMaxLen *b)
 
static void set_mml (MinMaxLen *mml, OnigDistance min, OnigDistance max)
 
static void clear_mml (MinMaxLen *mml)
 
static void copy_mml (MinMaxLen *to, MinMaxLen *from)
 
static void add_mml (MinMaxLen *to, MinMaxLen *from)
 
static void alt_merge_mml (MinMaxLen *to, MinMaxLen *from)
 
static void copy_opt_env (OptEnv *to, OptEnv *from)
 
static void clear_opt_anc_info (OptAncInfo *anc)
 
static void copy_opt_anc_info (OptAncInfo *to, OptAncInfo *from)
 
static void concat_opt_anc_info (OptAncInfo *to, OptAncInfo *left, OptAncInfo *right, OnigDistance left_len, OnigDistance right_len)
 
static int is_left_anchor (int anc)
 
static int is_set_opt_anc_info (OptAncInfo *to, int anc)
 
static void add_opt_anc_info (OptAncInfo *to, int anc)
 
static void remove_opt_anc_info (OptAncInfo *to, int anc)
 
static void alt_merge_opt_anc_info (OptAncInfo *to, OptAncInfo *add)
 
static int is_full_opt_exact_info (OptExactInfo *ex)
 
static void clear_opt_exact_info (OptExactInfo *ex)
 
static void copy_opt_exact_info (OptExactInfo *to, OptExactInfo *from)
 
static void concat_opt_exact_info (OptExactInfo *to, OptExactInfo *add, OnigEncoding enc)
 
static void concat_opt_exact_info_str (OptExactInfo *to, UChar *s, UChar *end, int raw ARG_UNUSED, OnigEncoding enc)
 
static void alt_merge_opt_exact_info (OptExactInfo *to, OptExactInfo *add, OptEnv *env)
 
static void select_opt_exact_info (OnigEncoding enc, OptExactInfo *now, OptExactInfo *alt)
 
static void clear_opt_map_info (OptMapInfo *map)
 
static void copy_opt_map_info (OptMapInfo *to, OptMapInfo *from)
 
static void add_char_opt_map_info (OptMapInfo *map, UChar c, OnigEncoding enc)
 
static int add_char_amb_opt_map_info (OptMapInfo *map, UChar *p, UChar *end, OnigEncoding enc, OnigCaseFoldType case_fold_flag)
 
static void select_opt_map_info (OptMapInfo *now, OptMapInfo *alt)
 
static int comp_opt_exact_or_map_info (OptExactInfo *e, OptMapInfo *m)
 
static void alt_merge_opt_map_info (OnigEncoding enc, OptMapInfo *to, OptMapInfo *add)
 
static void set_bound_node_opt_info (NodeOptInfo *opt, MinMaxLen *mmd)
 
static void clear_node_opt_info (NodeOptInfo *opt)
 
static void copy_node_opt_info (NodeOptInfo *to, NodeOptInfo *from)
 
static void concat_left_node_opt_info (OnigEncoding enc, NodeOptInfo *to, NodeOptInfo *add)
 
static void alt_merge_node_opt_info (NodeOptInfo *to, NodeOptInfo *add, OptEnv *env)
 
static int optimize_node_left (Node *node, NodeOptInfo *opt, OptEnv *env)
 
static int set_optimize_exact_info (regex_t *reg, OptExactInfo *e)
 
static void set_optimize_map_info (regex_t *reg, OptMapInfo *m)
 
static void set_sub_anchor (regex_t *reg, OptAncInfo *anc)
 
static int set_optimize_info_from_tree (Node *node, regex_t *reg, ScanEnv *scan_env)
 
static void clear_optimize_info (regex_t *reg)
 
void onig_free_body (regex_t *reg)
 
void onig_free (regex_t *reg)
 
size_t onig_memsize (const regex_t *reg)
 
void onig_transfer (regex_t *to, regex_t *from)
 
void onig_chain_link_add (regex_t *to, regex_t *add)
 
void onig_chain_reduce (regex_t *reg)
 
int onig_compile (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, 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_init (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
 
static unsigned char PadBuf [WORD_ALIGNMENT_SIZE]
 
static int onig_inited = 0
 

Macro Definition Documentation

Referenced by setup_tree().

Referenced by setup_tree().

#define ALLOWED_ENCLOSE_IN_LB   ( ENCLOSE_MEMORY )

Referenced by setup_tree().

#define ALLOWED_ENCLOSE_IN_LB_NOT   0

Referenced by setup_tree().

#define ALLOWED_TYPE_IN_LB
#define CKN_ON   (ckn > 0)

Definition at line 732 of file regcomp.c.

#define COMP_EM_BASE   20
#define COMPILE_INIT_SIZE   20

Referenced by onig_compile().

#define EXPAND_STRING_MAX_LENGTH   100

Referenced by setup_tree().

#define GET_CHAR_LEN_TOP_ALT_VARLEN   -2

Definition at line 2297 of file regcomp.c.

Referenced by get_char_length_tree1(), and setup_look_behind().

#define GET_CHAR_LEN_VARLEN   -1

Definition at line 2296 of file regcomp.c.

Referenced by get_char_length_tree1(), and setup_look_behind().

#define IN_ALT   (1<<0)

Definition at line 3677 of file regcomp.c.

Referenced by setup_tree().

#define IN_NOT   (1<<1)

Definition at line 3678 of file regcomp.c.

Referenced by setup_tree().

#define IN_REPEAT   (1<<2)

Definition at line 3679 of file regcomp.c.

Referenced by setup_tree().

#define IN_VAR_REPEAT   (1<<3)

Definition at line 3680 of file regcomp.c.

Referenced by setup_tree().

#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.

Referenced by add_compile_string(), and add_compile_string_length().

#define MAX_NODE_OPT_INFO_REF_COUNT   5

Definition at line 4574 of file regcomp.c.

Referenced by optimize_node_left().

#define OPT_EXACT_MAXLEN   24
#define QUANTIFIER_EXPAND_LIMIT_SIZE   50

Definition at line 731 of file regcomp.c.

Referenced by compile_length_quantifier_node(), and compile_quantifier_node().

#define REGEX_CHAIN_HEAD (   reg)
Value:
do {\
while (IS_NOT_NULL((reg)->chain)) {\
(reg) = (reg)->chain;\
}\
} while (0)

Definition at line 5275 of file regcomp.c.

Referenced by onig_chain_link_add().

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

Definition at line 5260 of file regcomp.c.

Referenced by onig_chain_reduce(), and onig_transfer().

#define REPEAT_RANGE_ALLOC   4

Referenced by entry_repeat_range().

#define THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION   8

Referenced by expand_case_fold_string().

Function Documentation

static int add_abs_addr ( regex_t reg,
int  addr 
)
static

Definition at line 233 of file regcomp.c.

References BBUF_ADD, and SIZE_ABSADDR.

Referenced by compile_enclose_node().

static int add_bitset ( regex_t reg,
BitSetRef  bs 
)
static

Definition at line 294 of file regcomp.c.

References BBUF_ADD, and SIZE_BITSET.

Referenced by compile_cclass_node().

static int add_bytes ( regex_t reg,
UChar bytes,
OnigDistance  len 
)
static

Definition at line 287 of file regcomp.c.

References BBUF_ADD.

Referenced by add_compile_string(), add_multi_byte_cclass(), and compile_quantifier_node().

static int add_char_amb_opt_map_info ( OptMapInfo map,
UChar p,
UChar end,
OnigEncoding  enc,
OnigCaseFoldType  case_fold_flag 
)
static
static void add_char_opt_map_info ( OptMapInfo map,
UChar  c,
OnigEncoding  enc 
)
static
static int add_compile_string ( UChar s,
int  mb_len,
OnigDistance  str_len,
regex_t reg,
int  ignore_case 
)
static
static int add_compile_string_length ( UChar *s  ARG_UNUSED,
int  mb_len,
OnigDistance  str_len,
regex_t *reg  ARG_UNUSED,
int  ignore_case 
)
static
static int add_length ( regex_t reg,
OnigDistance  len 
)
static

Definition at line 242 of file regcomp.c.

References BBUF_ADD, and SIZE_LENGTH.

Referenced by add_compile_string(), add_multi_byte_cclass(), compile_anchor_node(), and compile_tree().

static int add_mem_num ( regex_t reg,
int  num 
)
static
static void add_mml ( MinMaxLen to,
MinMaxLen from 
)
static

Definition at line 4114 of file regcomp.c.

References distance_add(), MinMaxLen::max, and MinMaxLen::min.

Referenced by concat_left_node_opt_info(), and optimize_node_left().

static int add_multi_byte_cclass ( BBuf mbuf,
regex_t reg 
)
static
static int add_opcode ( regex_t reg,
int  opcode 
)
static
static int add_opcode_option ( regex_t reg,
int  opcode,
OnigOptionType  option 
)
static

Definition at line 301 of file regcomp.c.

References add_opcode(), and add_option().

Referenced by compile_option_node().

static int add_opcode_rel_addr ( regex_t reg,
int  opcode,
int  addr 
)
static
static void add_opt_anc_info ( OptAncInfo to,
int  anc 
)
static

Definition at line 4192 of file regcomp.c.

References is_left_anchor(), OptAncInfo::left_anchor, and OptAncInfo::right_anchor.

Referenced by optimize_node_left().

static int add_option ( regex_t reg,
OnigOptionType  option 
)
static

Definition at line 269 of file regcomp.c.

References BBUF_ADD, and SIZE_OPTION.

Referenced by add_opcode_option(), and compile_tree().

static int add_pointer ( regex_t reg,
void *  addr 
)
static

Definition at line 260 of file regcomp.c.

References BBUF_ADD, and SIZE_POINTER.

Referenced by compile_cclass_node().

static int add_rel_addr ( regex_t reg,
int  addr 
)
static

Definition at line 224 of file regcomp.c.

References BBUF_ADD, and SIZE_RELADDR.

Referenced by add_opcode_rel_addr(), and compile_range_repeat_node().

static void alt_merge_mml ( MinMaxLen to,
MinMaxLen from 
)
static

Definition at line 4130 of file regcomp.c.

References MinMaxLen::max, and MinMaxLen::min.

Referenced by alt_merge_node_opt_info(), and alt_merge_opt_map_info().

static void alt_merge_node_opt_info ( NodeOptInfo to,
NodeOptInfo add,
OptEnv env 
)
static
static void alt_merge_opt_anc_info ( OptAncInfo to,
OptAncInfo add 
)
static
static void alt_merge_opt_exact_info ( OptExactInfo to,
OptExactInfo add,
OptEnv env 
)
static
static void alt_merge_opt_map_info ( OnigEncoding  enc,
OptMapInfo to,
OptMapInfo add 
)
static
static int bitset_is_empty ( BitSetRef  bs)
static

Definition at line 114 of file regcomp.c.

References BITSET_SIZE, and i.

Referenced by compile_cclass_node(), and compile_length_cclass_node().

static int check_type_tree ( Node node,
int  type_mask,
int  enclose_mask,
int  anchor_mask 
)
static
static void clear_mml ( MinMaxLen mml)
static
static void clear_node_opt_info ( NodeOptInfo opt)
static
static void clear_opt_anc_info ( OptAncInfo anc)
static
static void clear_opt_exact_info ( OptExactInfo ex)
static
static void clear_opt_map_info ( OptMapInfo map)
static

Definition at line 4354 of file regcomp.c.

References xmemcpy.

Referenced by alt_merge_opt_map_info(), and clear_node_opt_info().

static void clear_optimize_info ( regex_t reg)
static
static int comp_distance_value ( MinMaxLen d1,
MinMaxLen d2,
int  v1,
int  v2 
)
static
static int comp_opt_exact_or_map_info ( OptExactInfo e,
OptMapInfo m 
)
static
static int compile_anchor_node ( AnchorNode node,
regex_t reg 
)
static
static int compile_cclass_node ( CClassNode cc,
regex_t reg 
)
static
static int compile_enclose_node ( EncloseNode node,
regex_t reg 
)
static
static int compile_length_anchor_node ( AnchorNode node,
regex_t reg 
)
static
static int compile_length_cclass_node ( CClassNode cc,
regex_t reg 
)
static
static int compile_length_enclose_node ( EncloseNode node,
regex_t reg 
)
static
static int compile_length_option_node ( EncloseNode node,
regex_t reg 
)
static
static int compile_length_quantifier_node ( QtfrNode qn,
regex_t reg 
)
static
static int compile_length_string_node ( Node node,
regex_t reg 
)
static
static int compile_length_string_raw_node ( StrNode sn,
regex_t reg 
)
static

Definition at line 502 of file regcomp.c.

References add_compile_string_length(), StrNode::end, and StrNode::s.

Referenced by compile_length_tree().

static int compile_length_tree ( Node node,
regex_t reg 
)
static
static int compile_option_node ( EncloseNode node,
regex_t reg 
)
static
static int compile_quantifier_node ( QtfrNode qn,
regex_t reg 
)
static
static int compile_range_repeat_node ( QtfrNode qn,
int  target_len,
int  empty_info,
regex_t reg 
)
static
static int compile_string_node ( Node node,
regex_t reg 
)
static
static int compile_string_raw_node ( StrNode sn,
regex_t reg 
)
static

Definition at line 550 of file regcomp.c.

References add_compile_string(), StrNode::end, and StrNode::s.

Referenced by compile_tree().

static int compile_tree ( Node node,
regex_t reg 
)
static
static int compile_tree_empty_check ( Node node,
regex_t reg,
int  empty_info 
)
static
static int compile_tree_n_times ( Node node,
int  n,
regex_t reg 
)
static

Definition at line 412 of file regcomp.c.

References compile_tree(), and i.

Referenced by compile_enclose_node(), and compile_quantifier_node().

static void concat_left_node_opt_info ( OnigEncoding  enc,
NodeOptInfo to,
NodeOptInfo add 
)
static
static void concat_opt_anc_info ( OptAncInfo to,
OptAncInfo left,
OptAncInfo right,
OnigDistance  left_len,
OnigDistance  right_len 
)
static
static void concat_opt_exact_info ( OptExactInfo to,
OptExactInfo add,
OnigEncoding  enc 
)
static
static void concat_opt_exact_info_str ( OptExactInfo to,
UChar s,
UChar end,
int raw  ARG_UNUSED,
OnigEncoding  enc 
)
static

Definition at line 4270 of file regcomp.c.

References enclen, i, OptExactInfo::len, len, OPT_EXACT_MAXLEN, p, OptExactInfo::s, and UChar.

Referenced by optimize_node_left().

static void copy_mml ( MinMaxLen to,
MinMaxLen from 
)
static

Definition at line 4107 of file regcomp.c.

References MinMaxLen::max, and MinMaxLen::min.

Referenced by set_bound_node_opt_info().

static void copy_node_opt_info ( NodeOptInfo to,
NodeOptInfo from 
)
static

Definition at line 4497 of file regcomp.c.

Referenced by optimize_node_left().

static void copy_opt_anc_info ( OptAncInfo to,
OptAncInfo from 
)
static

Definition at line 4150 of file regcomp.c.

Referenced by concat_left_node_opt_info(), and concat_opt_exact_info().

static void copy_opt_env ( OptEnv to,
OptEnv from 
)
static

Definition at line 4137 of file regcomp.c.

Referenced by optimize_node_left().

static void copy_opt_exact_info ( OptExactInfo to,
OptExactInfo from 
)
static
static void copy_opt_map_info ( OptMapInfo to,
OptMapInfo from 
)
static

Definition at line 4382 of file regcomp.c.

Referenced by optimize_node_left(), and select_opt_map_info().

static OnigDistance distance_add ( OnigDistance  d1,
OnigDistance  d2 
)
static

Definition at line 92 of file regcomp.c.

References ONIG_INFINITE_DISTANCE.

Referenced by add_mml(), get_char_length_tree1(), and get_max_match_length().

static OnigDistance distance_multiply ( OnigDistance  d,
int  m 
)
static
static int distance_value ( MinMaxLen mm)
static

Definition at line 4041 of file regcomp.c.

References MinMaxLen::max, MinMaxLen::min, and ONIG_INFINITE_DISTANCE.

Referenced by comp_distance_value().

static int divide_look_behind_alternatives ( Node node)
static
static int entry_repeat_range ( regex_t reg,
int  id,
int  lower,
int  upper 
)
static
static int expand_case_fold_make_rem_string ( Node **  rnode,
UChar s,
UChar end,
regex_t reg 
)
static
static int expand_case_fold_string ( Node node,
regex_t reg 
)
static
static int expand_case_fold_string_alt ( int  item_num,
OnigCaseFoldCodeItem  items[],
UChar p,
int  slen,
UChar end,
regex_t reg,
Node **  rnode 
)
static
static int get_char_length_tree ( Node node,
regex_t reg,
int *  len 
)
static

Definition at line 2424 of file regcomp.c.

References get_char_length_tree1().

Referenced by compile_anchor_node(), and setup_look_behind().

static int get_char_length_tree1 ( Node node,
regex_t reg,
int *  len,
int  level 
)
static
static Node* get_head_value_node ( Node node,
int  exact,
regex_t reg 
)
static
static int get_max_match_length ( Node node,
OnigDistance max,
ScanEnv env 
)
static
static int get_min_match_length ( Node node,
OnigDistance min,
ScanEnv env 
)
static
static int is_anychar_star_quantifier ( QtfrNode qn)
static
static int is_equal_mml ( MinMaxLen a,
MinMaxLen b 
)
static

Definition at line 4087 of file regcomp.c.

References MinMaxLen::max, and MinMaxLen::min.

Referenced by alt_merge_opt_exact_info().

static int is_full_opt_exact_info ( OptExactInfo ex)
static

Definition at line 4217 of file regcomp.c.

References OptExactInfo::len, and OPT_EXACT_MAXLEN.

Referenced by optimize_node_left().

static int is_left_anchor ( int  anc)
static
static int is_not_included ( Node x,
Node y,
regex_t reg 
)
static
static int is_set_opt_anc_info ( OptAncInfo to,
int  anc 
)
static

Definition at line 4184 of file regcomp.c.

References OptAncInfo::left_anchor, and OptAncInfo::right_anchor.

Referenced by optimize_node_left().

static int map_position_value ( OnigEncoding  enc,
int  i 
)
static

Definition at line 4017 of file regcomp.c.

References i, and ONIGENC_MBC_MINLEN.

Referenced by add_char_opt_map_info(), alt_merge_opt_map_info(), and select_opt_exact_info().

static int next_setup ( Node node,
Node next_node,
regex_t reg 
)
static
int onig_bbuf_init ( BBuf buf,
OnigDistance  size 
)

Definition at line 144 of file regcomp.c.

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

void onig_chain_link_add ( regex_t to,
regex_t add 
)
void onig_chain_reduce ( regex_t reg)
int onig_compile ( regex_t reg,
const UChar pattern,
const UChar pattern_end,
OnigErrorInfo einfo,
const char *  sourcefile,
int  sourceline 
)

Definition at line 5316 of file regcomp.c.

References add_opcode(), re_pattern_buffer::alloc, ScanEnv::backrefed_mem, BBUF_INIT, BIT_STATUS_AT, BIT_STATUS_ON_ALL, ScanEnv::bt_mem_end, re_pattern_buffer::bt_mem_end, ScanEnv::bt_mem_start, re_pattern_buffer::bt_mem_start, ScanEnv::capture_history, re_pattern_buffer::capture_history, clear_optimize_info(), COMPILE_INIT_SIZE, compile_tree(), ScanEnv::enc, OnigErrorInfo::enc, re_pattern_buffer::enc, err, ScanEnv::error, ScanEnv::error_end, i, IS_FIND_CONDITION, IS_NOT_NULL, IS_SYNTAX_BV, ScanEnv::mem_nodes_dynamic, NULL, ScanEnv::num_call, re_pattern_buffer::num_call, re_pattern_buffer::num_comb_exp_check, ScanEnv::num_mem, re_pattern_buffer::num_mem, ScanEnv::num_named, re_pattern_buffer::num_null_check, re_pattern_buffer::num_repeat, ONIG_IS_OPTION_ON, onig_node_free(), ONIG_OPTION_CAPTURE_GROUP, onig_parse_make_tree(), ONIG_STATE_COMPILING, ONIG_STATE_NORMAL, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP, OP_END, re_pattern_buffer::options, OnigErrorInfo::par, OnigErrorInfo::par_end, re_pattern_buffer::repeat_range, re_pattern_buffer::repeat_range_alloc, set_optimize_info_from_tree(), setup_tree(), ScanEnv::sourcefile, ScanEnv::sourceline, re_pattern_buffer::stack_pop_level, STACK_POP_LEVEL_ALL, STACK_POP_LEVEL_FREE, STACK_POP_LEVEL_MEM_START, re_pattern_buffer::state, ScanEnv::syntax, UChar, ScanEnv::unset_addr_list, USE_SUBEXP_CALL, re_pattern_buffer::used, and xfree().

Referenced by onig_new(), onig_new_with_source(), and onig_new_without_alloc().

int onig_end ( void  )
void onig_free ( regex_t reg)
void onig_free_body ( regex_t reg)
OnigCaseFoldType onig_get_default_case_fold_flag ( void  )

Definition at line 35 of file regcomp.c.

References OnigDefaultCaseFoldFlag.

int onig_init ( void  )

Definition at line 5622 of file regcomp.c.

References onigenc_init(), THREAD_ATOMIC_END, THREAD_ATOMIC_START, and THREAD_SYSTEM_INIT.

Referenced by onig_reg_init().

int onig_is_code_in_cc ( OnigEncoding  enc,
OnigCodePoint  code,
CClassNode cc 
)
int onig_is_code_in_cc_len ( int  elen,
OnigCodePoint  code,
CClassNode cc 
)
int onig_is_in_code_range ( const UChar p,
OnigCodePoint  code 
)
size_t onig_memsize ( const regex_t reg)
int onig_new ( regex_t **  reg,
const UChar pattern,
const UChar pattern_end,
OnigOptionType  option,
OnigEncoding  enc,
const OnigSyntaxType syntax,
OnigErrorInfo einfo 
)
int onig_new_without_alloc ( regex_t reg,
const UChar pattern,
const UChar pattern_end,
OnigOptionType  option,
OnigEncoding  enc,
OnigSyntaxType syntax,
OnigErrorInfo einfo 
)

Definition at line 5585 of file regcomp.c.

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

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

Definition at line 41 of file regcomp.c.

References OnigDefaultCaseFoldFlag.

void onig_transfer ( regex_t to,
regex_t from 
)

Definition at line 5268 of file regcomp.c.

References REGEX_TRANSFER, THREAD_ATOMIC_END, and THREAD_ATOMIC_START.

static int optimize_node_left ( Node node,
NodeOptInfo opt,
OptEnv env 
)
static

Definition at line 4577 of file regcomp.c.

References add_char_amb_opt_map_info(), add_char_opt_map_info(), add_mml(), add_opt_anc_info(), alt_merge_node_opt_info(), NodeOptInfo::anc, ANCHOR_ANYCHAR_STAR, ANCHOR_ANYCHAR_STAR_MASK, ANCHOR_ANYCHAR_STAR_ML, ANCHOR_BEGIN_BUF, ANCHOR_BEGIN_LINE, ANCHOR_BEGIN_POSITION, ANCHOR_END_BUF, ANCHOR_END_LINE, ANCHOR_LOOK_BEHIND, ANCHOR_LOOK_BEHIND_NOT, ANCHOR_PREC_READ, ANCHOR_PREC_READ_NOT, ANCHOR_SEMI_END_BUF, BRefNode::back_num, ScanEnv::backrefed_mem, BACKREFS_P, BIT_STATUS_AT, BITSET_AT, CClassNode::bs, OptEnv::case_fold_flag, clear_node_opt_info(), concat_left_node_opt_info(), concat_opt_exact_info(), concat_opt_exact_info_str(), copy_node_opt_info(), copy_opt_env(), copy_opt_exact_info(), copy_opt_map_info(), distance_multiply(), OptEnv::enc, ENCLOSE_MEMORY, ENCLOSE_OPTION, ENCLOSE_STOP_BACKTRACK, StrNode::end, NodeOptInfo::exb, NodeOptInfo::exm, NodeOptInfo::expr, get_max_match_length(), get_min_match_length(), QtfrNode::greedy, i, OptExactInfo::ignore_case, IS_CALL_RECURSION, IS_ENCLOSE_MAX_FIXED, IS_ENCLOSE_MIN_FIXED, is_full_opt_exact_info(), IS_MULTILINE, IS_NCCLASS_NOT, IS_NOT_NULL, IS_REPEAT_INFINITE, is_set_opt_anc_info(), OptExactInfo::len, NodeOptInfo::len, QtfrNode::lower, NodeOptInfo::map, max(), MinMaxLen::max, EncloseNode::max_len, MAX_NODE_OPT_INFO_REF_COUNT, CClassNode::mbuf, min(), MinMaxLen::min, EncloseNode::min_len, OptEnv::mmd, NANCHOR, NBREF, NCALL, NCAR, NCCLASS, NCDR, NCTYPE, NENCLOSE, NQTFR, NST_RECURSION, NSTR, NSTRING_IS_AMBIG, NSTRING_IS_DONT_GET_OPT_INFO, 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_INFINITE_DISTANCE, ONIGENC_CTYPE_WORD, ONIGENC_IS_CODE_WORD, ONIGENC_MBC_MAXLEN_DIST, ONIGENC_MBC_MINLEN, onigenc_strlen(), ONIGERR_TYPE_BUG, EncloseNode::opt_count, EncloseNode::option, OptEnv::options, OptExactInfo::reach_end, EncloseNode::regnum, remove_opt_anc_info(), StrNode::s, OptEnv::scan_env, SCANENV_MEM_NODES, set_bound_node_opt_info(), set_mml(), SINGLE_BYTE_SIZE, BRefNode::state, QtfrNode::target, EncloseNode::target, type, EncloseNode::type, UChar, QtfrNode::upper, and OptMapInfo::value.

Referenced by set_optimize_info_from_tree().

static void remove_opt_anc_info ( OptAncInfo to,
int  anc 
)
static

Definition at line 4201 of file regcomp.c.

References is_left_anchor(), OptAncInfo::left_anchor, and OptAncInfo::right_anchor.

Referenced by optimize_node_left().

static void select_opt_exact_info ( OnigEncoding  enc,
OptExactInfo now,
OptExactInfo alt 
)
static
static void select_opt_map_info ( OptMapInfo now,
OptMapInfo alt 
)
static
static int select_str_opcode ( int  mb_len,
OnigDistance  str_len,
int  ignore_case 
)
static
static int set_bm_skip ( UChar s,
UChar end,
OnigEncoding enc  ARG_UNUSED,
UChar  skip[],
int **  int_skip 
)
static

Definition at line 3941 of file regcomp.c.

References i, IS_NULL, len, ONIG_CHAR_TABLE_SIZE, ONIGERR_MEMORY, and xmalloc.

Referenced by set_optimize_exact_info().

static void set_bound_node_opt_info ( NodeOptInfo opt,
MinMaxLen mmd 
)
static
static void set_mml ( MinMaxLen mml,
OnigDistance  min,
OnigDistance  max 
)
static

Definition at line 4094 of file regcomp.c.

References max(), MinMaxLen::max, min(), and MinMaxLen::min.

Referenced by optimize_node_left().

static int set_optimize_exact_info ( regex_t reg,
OptExactInfo e 
)
static
static int set_optimize_info_from_tree ( Node node,
regex_t reg,
ScanEnv scan_env 
)
static
static void set_optimize_map_info ( regex_t reg,
OptMapInfo m 
)
static
static void set_sub_anchor ( regex_t reg,
OptAncInfo anc 
)
static
static int setup_look_behind ( Node node,
regex_t reg,
ScanEnv env 
)
static
static int setup_tree ( Node node,
regex_t reg,
int  state,
ScanEnv env 
)
static

Definition at line 3691 of file regcomp.c.

References ALLOWED_ANCHOR_IN_LB, ALLOWED_ANCHOR_IN_LB_NOT, ALLOWED_ENCLOSE_IN_LB, ALLOWED_ENCLOSE_IN_LB_NOT, ALLOWED_TYPE_IN_LB, ANCHOR_LOOK_BEHIND, ANCHOR_LOOK_BEHIND_NOT, ANCHOR_PREC_READ, ANCHOR_PREC_READ_NOT, BRefNode::back_num, ScanEnv::backrefed_mem, BACKREFS_P, BIT_STATUS_ON_AT, ScanEnv::bt_mem_end, ScanEnv::bt_mem_start, check_type_tree(), ENCLOSE_MEMORY, ENCLOSE_OPTION, ENCLOSE_STOP_BACKTRACK, StrNode::end, expand_case_fold_string(), EXPAND_STRING_MAX_LENGTH, get_head_value_node(), get_max_match_length(), get_min_match_length(), QtfrNode::greedy, QtfrNode::head_exact, i, IN_ALT, IN_NOT, IN_REPEAT, IN_VAR_REPEAT, IS_BACKREF_NEST_LEVEL, IS_IGNORECASE, IS_NODE_TYPE_SIMPLE, IS_NOT_NULL, IS_REPEAT_INFINITE, len, QtfrNode::lower, NANCHOR, NBREF, NCAR, NCDR, NENCLOSE, next_setup(), NQ_TARGET_IS_EMPTY, NQTFR, NST_IN_REPEAT, NST_MEM_BACKREFED, NST_STOP_BT_SIMPLE_REPEAT, NSTR, NSTRING_IS_RAW, NSTRING_LEN, NT_ALT, NT_ANCHOR, NT_BREF, NT_CALL, NT_CANY, NT_CCLASS, NT_CTYPE, NT_ENCLOSE, NT_LIST, NT_QTFR, NT_STR, NTYPE, NULL, NULL_NODE, ScanEnv::num_mem, onig_node_conv_to_str_node(), onig_node_free(), onig_node_str_cat(), ONIGERR_INVALID_BACKREF, ONIGERR_INVALID_LOOK_BEHIND_PATTERN, re_pattern_buffer::options, options(), p, EncloseNode::regnum, StrNode::s, SCANENV_MEM_NODES, SET_ENCLOSE_STATUS, setup_look_behind(), QtfrNode::state, QtfrNode::target, EncloseNode::target, AnchorNode::target, QtfrNode::target_empty_info, type, EncloseNode::type, AnchorNode::type, and QtfrNode::upper.

Referenced by onig_compile().

static UChar* str_dup ( UChar s,
UChar end 
)
static

Definition at line 52 of file regcomp.c.

References CHECK_NULL_RETURN, len, NULL, UChar, xmalloc, and xmemcpy.

Referenced by set_optimize_exact_info().

static void swap_node ( Node a,
Node b 
)
static
static int update_string_node_case_fold ( regex_t reg,
Node node 
)
static

Variable Documentation

int onig_inited = 0
static

Definition at line 5536 of file regcomp.c.

OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN

Definition at line 32 of file regcomp.c.

unsigned char PadBuf[WORD_ALIGNMENT_SIZE]
static

Definition at line 48 of file regcomp.c.

Referenced by add_multi_byte_cclass().