"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "support/regcomp.c" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

regcomp.c  (gawk-5.0.1.tar.xz):regcomp.c  (gawk-5.1.0.tar.xz)
skipping to change at line 1428 skipping to change at line 1428
re_dfa_t *dfa = (re_dfa_t *) extra; re_dfa_t *dfa = (re_dfa_t *) extra;
Idx idx = node->node_idx; Idx idx = node->node_idx;
reg_errcode_t err = REG_NOERROR; reg_errcode_t err = REG_NOERROR;
switch (node->token.type) switch (node->token.type)
{ {
case CONCAT: case CONCAT:
break; break;
case END_OF_RE: case END_OF_RE:
assert (node->next == NULL); DEBUG_ASSERT (node->next == NULL);
break; break;
case OP_DUP_ASTERISK: case OP_DUP_ASTERISK:
case OP_ALT: case OP_ALT:
{ {
Idx left, right; Idx left, right;
dfa->has_plural_match = 1; dfa->has_plural_match = 1;
if (node->left != NULL) if (node->left != NULL)
left = node->left->first->node_idx; left = node->left->first->node_idx;
else else
left = node->next->node_idx; left = node->next->node_idx;
if (node->right != NULL) if (node->right != NULL)
right = node->right->first->node_idx; right = node->right->first->node_idx;
else else
right = node->next->node_idx; right = node->next->node_idx;
assert (left > -1); DEBUG_ASSERT (left > -1);
assert (right > -1); DEBUG_ASSERT (right > -1);
err = re_node_set_init_2 (dfa->edests + idx, left, right); err = re_node_set_init_2 (dfa->edests + idx, left, right);
} }
break; break;
case ANCHOR: case ANCHOR:
case OP_OPEN_SUBEXP: case OP_OPEN_SUBEXP:
case OP_CLOSE_SUBEXP: case OP_CLOSE_SUBEXP:
err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx); err = re_node_set_init_1 (dfa->edests + idx, node->next->node_idx);
break; break;
case OP_BACK_REF: case OP_BACK_REF:
dfa->nexts[idx] = node->next->node_idx; dfa->nexts[idx] = node->next->node_idx;
if (node->token.type == OP_BACK_REF) if (node->token.type == OP_BACK_REF)
err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]); err = re_node_set_init_1 (dfa->edests + idx, dfa->nexts[idx]);
break; break;
default: default:
assert (!IS_EPSILON_NODE (node->token.type)); DEBUG_ASSERT (!IS_EPSILON_NODE (node->token.type));
dfa->nexts[idx] = node->next->node_idx; dfa->nexts[idx] = node->next->node_idx;
break; break;
} }
return err; return err;
} }
/* Duplicate the epsilon closure of the node ROOT_NODE. /* Duplicate the epsilon closure of the node ROOT_NODE.
Note that duplicated nodes have constraint INIT_CONSTRAINT in addition Note that duplicated nodes have constraint INIT_CONSTRAINT in addition
to their own constraint. */ to their own constraint. */
skipping to change at line 1645 skipping to change at line 1645
return REG_NOERROR; return REG_NOERROR;
} }
/* Calculate "eclosure" for all the node in DFA. */ /* Calculate "eclosure" for all the node in DFA. */
static reg_errcode_t static reg_errcode_t
calc_eclosure (re_dfa_t *dfa) calc_eclosure (re_dfa_t *dfa)
{ {
Idx node_idx; Idx node_idx;
bool incomplete; bool incomplete;
#ifdef DEBUG DEBUG_ASSERT (dfa->nodes_len > 0);
assert (dfa->nodes_len > 0);
#endif
incomplete = false; incomplete = false;
/* For each nodes, calculate epsilon closure. */ /* For each nodes, calculate epsilon closure. */
for (node_idx = 0; ; ++node_idx) for (node_idx = 0; ; ++node_idx)
{ {
reg_errcode_t err; reg_errcode_t err;
re_node_set eclosure_elem; re_node_set eclosure_elem;
if (node_idx == dfa->nodes_len) if (node_idx == dfa->nodes_len)
{ {
if (!incomplete) if (!incomplete)
break; break;
incomplete = false; incomplete = false;
node_idx = 0; node_idx = 0;
} }
#ifdef DEBUG DEBUG_ASSERT (dfa->eclosures[node_idx].nelem != -1);
assert (dfa->eclosures[node_idx].nelem != -1);
#endif
/* If we have already calculated, skip it. */ /* If we have already calculated, skip it. */
if (dfa->eclosures[node_idx].nelem != 0) if (dfa->eclosures[node_idx].nelem != 0)
continue; continue;
/* Calculate epsilon closure of 'node_idx'. */ /* Calculate epsilon closure of 'node_idx'. */
err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true); err = calc_eclosure_iter (&eclosure_elem, dfa, node_idx, true);
if (__glibc_unlikely (err != REG_NOERROR)) if (__glibc_unlikely (err != REG_NOERROR))
return err; return err;
if (dfa->eclosures[node_idx].nelem == 0) if (dfa->eclosures[node_idx].nelem == 0)
skipping to change at line 2432 skipping to change at line 2428
case OP_ALT: case OP_ALT:
case END_OF_RE: case END_OF_RE:
return NULL; return NULL;
case BACK_SLASH: case BACK_SLASH:
*err = REG_EESCAPE; *err = REG_EESCAPE;
return NULL; return NULL;
default: default:
/* Must not happen? */ /* Must not happen? */
#ifdef DEBUG DEBUG_ASSERT (false);
assert (0);
#endif
return NULL; return NULL;
} }
fetch_token (token, regexp, syntax); fetch_token (token, regexp, syntax);
while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
|| token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
{ {
bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token, bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token,
syntax, err); syntax, err);
if (__glibc_unlikely (*err != REG_NOERROR && dup_tree == NULL)) if (__glibc_unlikely (*err != REG_NOERROR && dup_tree == NULL))
skipping to change at line 3296 skipping to change at line 3290
*err = build_charclass (regexp->trans, sbcset, *err = build_charclass (regexp->trans, sbcset,
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
mbcset, &char_class_alloc, mbcset, &char_class_alloc,
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
(const char *) start_elem.opr.name, (const char *) start_elem.opr.name,
syntax); syntax);
if (__glibc_unlikely (*err != REG_NOERROR)) if (__glibc_unlikely (*err != REG_NOERROR))
goto parse_bracket_exp_free_return; goto parse_bracket_exp_free_return;
break; break;
default: default:
assert (0); DEBUG_ASSERT (false);
break; break;
} }
} }
if (__glibc_unlikely (token->type == END_OF_RE)) if (__glibc_unlikely (token->type == END_OF_RE))
{ {
*err = REG_EBRACK; *err = REG_EBRACK;
goto parse_bracket_exp_free_return; goto parse_bracket_exp_free_return;
} }
if (token->type == OP_CLOSE_BRACKET) if (token->type == OP_CLOSE_BRACKET)
break; break;
skipping to change at line 3652 skipping to change at line 3646
const char *class_name, const char *class_name,
const char *extra, bool non_match, const char *extra, bool non_match,
reg_errcode_t *err) reg_errcode_t *err)
{ {
re_bitset_ptr_t sbcset; re_bitset_ptr_t sbcset;
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
re_charset_t *mbcset; re_charset_t *mbcset;
Idx alloc = 0; Idx alloc = 0;
#endif /* not RE_ENABLE_I18N */ #endif /* not RE_ENABLE_I18N */
reg_errcode_t ret; reg_errcode_t ret;
re_token_t br_token;
bin_tree_t *tree; bin_tree_t *tree;
sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
if (__glibc_unlikely (sbcset == NULL)) if (__glibc_unlikely (sbcset == NULL))
{ {
*err = REG_ESPACE; *err = REG_ESPACE;
return NULL; return NULL;
} }
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
skipping to change at line 3703 skipping to change at line 3696
if (non_match) if (non_match)
bitset_not (sbcset); bitset_not (sbcset);
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
/* Ensure only single byte characters are set. */ /* Ensure only single byte characters are set. */
if (dfa->mb_cur_max > 1) if (dfa->mb_cur_max > 1)
bitset_mask (sbcset, dfa->sb_char); bitset_mask (sbcset, dfa->sb_char);
#endif #endif
/* Build a tree for simple bracket. */ /* Build a tree for simple bracket. */
#if defined GCC_LINT || defined lint re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset };
memset (&br_token, 0, sizeof br_token);
#endif
br_token.type = SIMPLE_BRACKET;
br_token.opr.sbcset = sbcset;
tree = create_token_tree (dfa, NULL, NULL, &br_token); tree = create_token_tree (dfa, NULL, NULL, &br_token);
if (__glibc_unlikely (tree == NULL)) if (__glibc_unlikely (tree == NULL))
goto build_word_op_espace; goto build_word_op_espace;
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
if (dfa->mb_cur_max > 1) if (dfa->mb_cur_max > 1)
{ {
bin_tree_t *mbc_tree; bin_tree_t *mbc_tree;
/* Build a tree for complex bracket. */ /* Build a tree for complex bracket. */
br_token.type = COMPLEX_BRACKET; br_token.type = COMPLEX_BRACKET;
skipping to change at line 3796 skipping to change at line 3785
} }
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
/* Functions for binary tree operation. */ /* Functions for binary tree operation. */
/* Create a tree node. */ /* Create a tree node. */
static bin_tree_t * static bin_tree_t *
create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
re_token_type_t type) re_token_type_t type)
{ {
re_token_t t; re_token_t t = { .type = type };
#if defined GCC_LINT || defined lint
memset (&t, 0, sizeof t);
#endif
t.type = type;
return create_token_tree (dfa, left, right, &t); return create_token_tree (dfa, left, right, &t);
} }
static bin_tree_t * static bin_tree_t *
create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
const re_token_t *token) const re_token_t *token)
{ {
bin_tree_t *tree; bin_tree_t *tree;
if (__glibc_unlikely (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE)) if (__glibc_unlikely (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE))
{ {
 End of changes. 10 change blocks. 
25 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)