gawk  5.1.0
About: GNU awk - pattern scanning and processing language.
  Fossies Dox: gawk-5.1.0.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

regexec.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STATE_NODE_CONTAINS(state, node)   ((state) != NULL && re_node_set_contains (&(state)->nodes, node))
 

Functions

static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, Idx n)
 
static void match_ctx_clean (re_match_context_t *mctx)
 
static void match_ctx_free (re_match_context_t *cache)
 
static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, Idx node, Idx str_idx, Idx from, Idx to)
 
static Idx search_cur_bkref_entry (const re_match_context_t *mctx, Idx str_idx)
 
static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx)
 
static re_sub_match_last_tmatch_ctx_add_sublast (re_sub_match_top_t *subtop, Idx node, Idx str_idx)
 
static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, Idx last_node, Idx last_str_idx)
 
static reg_errcode_t re_search_internal (const regex_t *preg, const char *string, Idx length, Idx start, Idx last_start, Idx stop, size_t nmatch, regmatch_t pmatch[], int eflags)
 
static regoff_t re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, Idx stop, bool ret_len)
 
static regoff_t re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, Idx stop, struct re_registers *regs, bool ret_len)
 
static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, int regs_allocated)
 
static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
 
static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, Idx *p_match_first)
 
static Idx check_halt_state_context (const re_match_context_t *mctx, const re_dfastate_t *state, Idx idx)
 
static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch)
 
static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
 
static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, bool fl_backtrack)
 
static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs)
 
static reg_errcode_t sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx)
 
static reg_errcode_t build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *cur_dest)
 
static reg_errcode_t update_cur_sifted_state (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, re_node_set *dest_nodes)
 
static reg_errcode_t add_epsilon_src_nodes (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates)
 
static bool check_dst_limits (const re_match_context_t *mctx, const re_node_set *limits, Idx dst_node, Idx dst_idx, Idx src_node, Idx src_idx)
 
static int check_dst_limits_calc_pos_1 (const re_match_context_t *mctx, int boundaries, Idx subexp_idx, Idx from_node, Idx bkref_idx)
 
static int check_dst_limits_calc_pos (const re_match_context_t *mctx, Idx limit, Idx subexp_idx, Idx node, Idx str_idx, Idx bkref_idx)
 
static reg_errcode_t check_subexp_limits (const re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, Idx str_idx)
 
static reg_errcode_t sift_states_bkref (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx str_idx, const re_node_set *candidates)
 
static reg_errcode_t merge_state_array (const re_dfa_t *dfa, re_dfastate_t **dst, re_dfastate_t **src, Idx num)
 
static re_dfastate_tfind_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
 
static re_dfastate_ttransit_state (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *state)
 
static re_dfastate_tmerge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *next_state)
 
static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, Idx str_idx)
 
static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes)
 
static reg_errcode_t get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
 
static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, Idx bkref_node, Idx bkref_str)
 
static Idx find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, Idx subexp_idx, int type)
 
static reg_errcode_t check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node, Idx top_str, Idx last_node, Idx last_str, int type)
 
static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, re_node_set *cur_nodes, re_node_set *next_nodes)
 
static reg_errcode_t check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, Idx ex_subexp, int type)
 
static reg_errcode_t check_arrival_expand_ecl_sub (const re_dfa_t *dfa, re_node_set *dst_nodes, Idx target, Idx ex_subexp, int type)
 
static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, Idx cur_str, Idx subexp_num, int type)
 
static bool build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
 
static Idx group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *states_node, bitset_t *states_ch)
 
static bool check_node_accept (const re_match_context_t *mctx, const re_token_t *node, Idx idx)
 
static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len)
 
int regexec (const regex_t *__restrict preg, const char *__restrict string, size_t nmatch, regmatch_t pmatch[], int eflags)
 
regoff_t re_match (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, struct re_registers *regs)
 
regoff_t re_search (struct re_pattern_buffer *bufp, const char *string, Idx length, Idx start, regoff_t range, struct re_registers *regs)
 
regoff_t re_match_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, struct re_registers *regs, Idx stop)
 
regoff_t re_search_2 (struct re_pattern_buffer *bufp, const char *string1, Idx length1, const char *string2, Idx length2, Idx start, regoff_t range, struct re_registers *regs, Idx stop)
 
void re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, __re_size_t num_regs, regoff_t *starts, regoff_t *ends)
 
static re_dfastate_tacquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, Idx idx)
 
static bool check_halt_node_context (const re_dfa_t *dfa, Idx node, unsigned int context)
 
static Idx proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, Idx *pidx, Idx node, re_node_set *eps_via_nodes, struct re_fail_stack_t *fs)
 
static Idx pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes)
 
static reg_errcode_t clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
 
static reg_errcode_t sub_epsilon_src_nodes (const re_dfa_t *dfa, Idx node, re_node_set *dest_nodes, const re_node_set *candidates)
 

Macro Definition Documentation

◆ STATE_NODE_CONTAINS

#define STATE_NODE_CONTAINS (   state,
  node 
)    ((state) != NULL && re_node_set_contains (&(state)->nodes, node))

Definition at line 1553 of file regexec.c.

Function Documentation

◆ acquire_init_state_context()

static re_dfastate_t* acquire_init_state_context ( reg_errcode_t err,
const re_match_context_t mctx,
Idx  idx 
)
inlinestatic

◆ add_epsilon_src_nodes()

◆ build_sifted_states()

◆ build_trtable()

◆ check_arrival()

◆ check_arrival_add_next_nodes()

◆ check_arrival_expand_ecl()

static reg_errcode_t check_arrival_expand_ecl ( const re_dfa_t dfa,
re_node_set cur_nodes,
Idx  ex_subexp,
int  type 
)
static

◆ check_arrival_expand_ecl_sub()

static reg_errcode_t __attribute_warn_unused_result__ check_arrival_expand_ecl_sub ( const re_dfa_t dfa,
re_node_set dst_nodes,
Idx  target,
Idx  ex_subexp,
int  type 
)
static

◆ check_dst_limits()

static bool check_dst_limits ( const re_match_context_t mctx,
const re_node_set limits,
Idx  dst_node,
Idx  dst_idx,
Idx  src_node,
Idx  src_idx 
)
static

◆ check_dst_limits_calc_pos()

static int check_dst_limits_calc_pos ( const re_match_context_t mctx,
Idx  limit,
Idx  subexp_idx,
Idx  node,
Idx  str_idx,
Idx  bkref_idx 
)
static

◆ check_dst_limits_calc_pos_1()

static int check_dst_limits_calc_pos_1 ( const re_match_context_t mctx,
int  boundaries,
Idx  subexp_idx,
Idx  from_node,
Idx  bkref_idx 
)
static

◆ check_halt_node_context()

static bool check_halt_node_context ( const re_dfa_t dfa,
Idx  node,
unsigned int  context 
)
static

Definition at line 1175 of file regexec.c.

References END_OF_RE, and NOT_SATISFY_NEXT_CONSTRAINT.

Referenced by check_halt_state_context().

◆ check_halt_state_context()

static Idx check_halt_state_context ( const re_match_context_t mctx,
const re_dfastate_t state,
Idx  idx 
)
static

◆ check_matching()

◆ check_node_accept()

◆ check_subexp_limits()

◆ check_subexp_matching_top()

◆ clean_state_log_if_needed()

◆ expand_bkref_cache()

◆ extend_buffers()

◆ find_recover_state()

◆ find_subexp_node()

static Idx find_subexp_node ( const re_dfa_t dfa,
const re_node_set nodes,
Idx  subexp_idx,
int  type 
)
static

Definition at line 2806 of file regexec.c.

References re_backref_cache_entry::node, and nodes.

Referenced by check_arrival_expand_ecl(), and get_subexp().

◆ free_fail_stack_return()

static reg_errcode_t free_fail_stack_return ( struct re_fail_stack_t fs)
static

◆ get_subexp()

◆ get_subexp_sub()

◆ group_nodes_into_DFAstates()

◆ match_ctx_add_entry()

◆ match_ctx_add_sublast()

◆ match_ctx_add_subtop()

◆ match_ctx_clean()

◆ match_ctx_free()

static void match_ctx_free ( re_match_context_t cache)
static

◆ match_ctx_init()

◆ merge_state_array()

static reg_errcode_t merge_state_array ( const re_dfa_t dfa,
re_dfastate_t **  dst,
re_dfastate_t **  src,
Idx  num 
)
static

◆ merge_state_with_log()

◆ pop_fail_stack()

static Idx pop_fail_stack ( struct re_fail_stack_t fs,
Idx pidx,
Idx  nregs,
regmatch_t regs,
re_node_set eps_via_nodes 
)
static

◆ proceed_next_node()

◆ prune_impossible_nodes()

◆ push_fail_stack()

◆ re_copy_regs()

static unsigned re_copy_regs ( struct re_registers *  regs,
regmatch_t pmatch,
Idx  nregs,
int  regs_allocated 
)
static

◆ re_match()

regoff_t re_match ( struct re_pattern_buffer bufp,
const char *  string,
Idx  length,
Idx  start,
struct re_registers *  regs 
)

Definition at line 276 of file regexec.c.

References re_search_stub().

◆ re_match_2()

regoff_t re_match_2 ( struct re_pattern_buffer bufp,
const char *  string1,
Idx  length1,
const char *  string2,
Idx  length2,
Idx  start,
struct re_registers *  regs,
Idx  stop 
)

Definition at line 297 of file regexec.c.

References re_search_2_stub(), and stop.

◆ re_search()

regoff_t re_search ( struct re_pattern_buffer bufp,
const char *  string,
Idx  length,
Idx  start,
regoff_t  range,
struct re_registers *  regs 
)

Definition at line 286 of file regexec.c.

References re_search_stub().

Referenced by research().

◆ re_search_2()

regoff_t re_search_2 ( struct re_pattern_buffer bufp,
const char *  string1,
Idx  length1,
const char *  string2,
Idx  length2,
Idx  start,
regoff_t  range,
struct re_registers *  regs,
Idx  stop 
)

Definition at line 309 of file regexec.c.

References re_search_2_stub(), and stop.

◆ re_search_2_stub()

static regoff_t re_search_2_stub ( struct re_pattern_buffer bufp,
const char *  string1,
Idx  length1,
const char *  string2,
Idx  length2,
Idx  start,
regoff_t  range,
struct re_registers *  regs,
Idx  stop,
bool  ret_len 
)
static

Definition at line 321 of file regexec.c.

References __glibc_unlikely, INT_ADD_WRAPV, memcpy, NULL, re_free, re_malloc, re_search_stub(), and stop.

Referenced by re_match_2(), and re_search_2().

◆ re_search_internal()

◆ re_search_stub()

static regoff_t re_search_stub ( struct re_pattern_buffer bufp,
const char *  string,
Idx  length,
Idx  start,
regoff_t  range,
Idx  stop,
struct re_registers *  regs,
bool  ret_len 
)
static

◆ re_set_registers()

void re_set_registers ( struct re_pattern_buffer bufp,
struct re_registers *  regs,
__re_size_t  num_regs,
regoff_t starts,
regoff_t ends 
)

Definition at line 537 of file regexec.c.

References NULL.

◆ regexec()

int regexec ( const regex_t *__restrict  preg,
const char *__restrict  string,
size_t  nmatch,
regmatch_t  pmatch[],
int  eflags 
)

◆ search_cur_bkref_entry()

static Idx search_cur_bkref_entry ( const re_match_context_t mctx,
Idx  str_idx 
)
static

◆ set_regs()

◆ sift_ctx_init()

static void sift_ctx_init ( re_sift_context_t sctx,
re_dfastate_t **  sifted_sts,
re_dfastate_t **  limited_sts,
Idx  last_node,
Idx  last_str_idx 
)
static

◆ sift_states_backward()

◆ sift_states_bkref()

◆ sub_epsilon_src_nodes()

static reg_errcode_t sub_epsilon_src_nodes ( const re_dfa_t dfa,
Idx  node,
re_node_set dest_nodes,
const re_node_set candidates 
)
static

◆ transit_state()

◆ transit_state_bkref()

◆ update_cur_sifted_state()

◆ update_regs()

static void update_regs ( const re_dfa_t dfa,
regmatch_t pmatch,
regmatch_t prev_idx_match,
Idx  cur_node,
Idx  cur_idx,
Idx  nmatch 
)
static

Definition at line 1485 of file regexec.c.

References cur_idx, memcpy, OP_CLOSE_SUBEXP, OP_OPEN_SUBEXP, regmatch_t::rm_eo, and regmatch_t::rm_so.

Referenced by set_regs().