re_token_type_t type, int index);
static bin_tree_t *re_dfa_add_tree_node (re_dfa_t *dfa,
bin_tree_t *left, bin_tree_t *right,
- re_token_t)
+ const re_token_t *token)
__attribute ((noinline));
static bin_tree_t *duplicate_tree (const bin_tree_t *src, re_dfa_t *dfa);
\f
int *new_idx, org_idx;
unsigned int constraint;
{
- re_token_t dup;
- int dup_idx;
-
- dup = dfa->nodes[org_idx];
- dup_idx = re_dfa_add_node (dfa, dup, 1);
+ int dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx], 1);
if (BE (dup_idx == -1, 0))
return REG_ESPACE;
dfa->nodes[dup_idx].constraint = constraint;
tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0))
return NULL;
- eor = re_dfa_add_tree_node (dfa, NULL, NULL, current_token);
+ eor = re_dfa_add_tree_node (dfa, NULL, NULL, ¤t_token);
if (tree != NULL)
root = create_tree (dfa, tree, eor, CONCAT, 0);
else
}
else
branch = NULL;
- tree = re_dfa_add_tree_node (dfa, tree, branch, alt_token);
+ tree = re_dfa_add_tree_node (dfa, tree, branch, &alt_token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
switch (token->type)
{
case CHARACTER:
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
{
bin_tree_t *mbc_remain;
fetch_token (token, regexp, syntax);
- mbc_remain = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ mbc_remain = re_dfa_add_tree_node (dfa, NULL, NULL, token);
tree = create_tree (dfa, tree, mbc_remain, CONCAT, 0);
if (BE (mbc_remain == NULL || tree == NULL, 0))
{
return NULL;
}
dfa->used_bkref_map |= 1 << (token->opr.idx - 1);
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
/* Then we can these characters as normal characters. */
token->type = CHARACTER;
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
{
bin_tree_t *tree_first, *tree_last;
token->opr.ctx_type = WORD_FIRST;
- tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->opr.ctx_type = WORD_LAST;
- tree_last = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree_last = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->type = OP_ALT;
- tree = re_dfa_add_tree_node (dfa, tree_first, tree_last, *token);
+ tree = re_dfa_add_tree_node (dfa, tree_first, tree_last, token);
if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0))
{
*err = REG_ESPACE;
}
else
{
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
fetch_token (token, regexp, syntax);
return tree;
case OP_PERIOD:
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
dfa->subexps[cur_nsub].start = dfa->nodes_len;
dfa->subexps[cur_nsub].end = -1;
- left_par = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ left_par = re_dfa_add_tree_node (dfa, NULL, NULL, token);
if (BE (left_par == NULL, 0))
{
*err = REG_ESPACE;
*err = REG_EPAREN;
return NULL;
}
- right_par = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
+ right_par = re_dfa_add_tree_node (dfa, NULL, NULL, token);
dfa->subexps[cur_nsub].end = dfa->nodes_len;
tree = ((tree == NULL) ? right_par
: create_tree (dfa, tree, right_par, CONCAT, 0));
if (start > 0)
{
elem = duplicate_tree (elem, dfa);
- work_tree = re_dfa_add_tree_node (dfa, elem, NULL, dup_token);
+ work_tree = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
tree = create_tree (dfa, tree, work_tree, CONCAT, 0);
if (BE (elem == NULL || work_tree == NULL || tree == NULL, 0))
goto parse_dup_op_espace;
}
else
{
- tree = re_dfa_add_tree_node (dfa, elem, NULL, dup_token);
+ tree = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
if (BE (tree == NULL, 0))
goto parse_dup_op_espace;
}
if (start > 0)
{
elem = duplicate_tree (elem, dfa);
- elem = re_dfa_add_tree_node (dfa, elem, NULL, dup_token);
+ elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
tree = create_tree (dfa, tree, elem, CONCAT, 0);
if (BE (elem == NULL || tree == NULL, 0))
goto parse_dup_op_espace;
}
else
{
- tree = elem = re_dfa_add_tree_node (dfa, elem, NULL, dup_token);
+ tree = elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
if (BE (tree == NULL, 0))
goto parse_dup_op_espace;
}
}
else
{
- tree = re_dfa_add_tree_node (dfa, tree, NULL, *token);
+ tree = re_dfa_add_tree_node (dfa, tree, NULL, token);
if (BE (tree == NULL, 0))
{
*err = REG_ESPACE;
/* Build a tree for simple bracket. */
br_token.type = SIMPLE_BRACKET;
br_token.opr.sbcset = sbcset;
- work_tree = re_dfa_add_tree_node (dfa, NULL, NULL, br_token);
+ work_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token);
if (BE (work_tree == NULL, 0))
goto parse_bracket_exp_espace;
}
br_token.type = COMPLEX_BRACKET;
br_token.opr.mbcset = mbcset;
- mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, br_token);
+ mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token);
if (BE (mbc_tree == NULL, 0))
goto parse_bracket_exp_espace;
/* Then join them by ALT node. */
alt_token.type = OP_ALT;
- work_tree = re_dfa_add_tree_node (dfa, work_tree, mbc_tree, alt_token);
+ work_tree = re_dfa_add_tree_node (dfa, work_tree, mbc_tree, &alt_token);
if (BE (mbc_tree != NULL, 1))
return work_tree;
}
/* Build a tree for simple bracket. */
br_token.type = SIMPLE_BRACKET;
br_token.opr.sbcset = sbcset;
- tree = re_dfa_add_tree_node (dfa, NULL, NULL, br_token);
+ tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token);
if (BE (tree == NULL, 0))
goto build_word_op_espace;
br_token.type = COMPLEX_BRACKET;
br_token.opr.mbcset = mbcset;
dfa->has_mb_node = 1;
- mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, br_token);
+ mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token);
if (BE (mbc_tree == NULL, 0))
goto build_word_op_espace;
/* Then join them by ALT node. */
alt_token.type = OP_ALT;
- tree = re_dfa_add_tree_node (dfa, tree, mbc_tree, alt_token);
+ tree = re_dfa_add_tree_node (dfa, tree, mbc_tree, &alt_token);
if (BE (mbc_tree != NULL, 1))
return tree;
}
re_dfa_t *dfa;
bin_tree_t *left;
bin_tree_t *right;
- re_token_t token;
+ const re_token_t *token;
{
- int new_idx = re_dfa_add_node (dfa, token, 0);
+ int new_idx = re_dfa_add_node (dfa, *token, 0);
if (new_idx == -1)
return NULL;