Update.
2003-11-21 Ulrich Drepper <drepper@redhat.com> * posix/regcomp.c (fetch_token): Change interface to match peek_token. This avoid some copying and reduces code size.
This commit is contained in:
parent
73163a0973
commit
f0d77aa8af
|
@ -1,3 +1,8 @@
|
||||||
|
2003-11-21 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* posix/regcomp.c (fetch_token): Change interface to match
|
||||||
|
peek_token. This avoid some copying and reduces code size.
|
||||||
|
|
||||||
2003-11-21 Jakub Jelinek <jakub@redhat.com>
|
2003-11-21 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* posix/bug-regex19.c (tests): Add more tests.
|
* posix/bug-regex19.c (tests): Add more tests.
|
||||||
|
@ -7,8 +12,6 @@
|
||||||
* posix/tst-rxspencer.c (mb_tests): Don't run identical multi-byte
|
* posix/tst-rxspencer.c (mb_tests): Don't run identical multi-byte
|
||||||
tests multiple times unnecessarily.
|
tests multiple times unnecessarily.
|
||||||
|
|
||||||
2003-11-21 Jakub Jelinek <jakub@redhat.com>
|
|
||||||
|
|
||||||
* posix/bug-regex19.c (BRE, ERE): Define.
|
* posix/bug-regex19.c (BRE, ERE): Define.
|
||||||
(tests): Add many new tests, remove UTF-8 ones.
|
(tests): Add many new tests, remove UTF-8 ones.
|
||||||
(do_one_test, do_mb_tests): New functions.
|
(do_one_test, do_mb_tests): New functions.
|
||||||
|
|
|
@ -51,7 +51,8 @@ static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa,
|
||||||
static void calc_inveclosure (re_dfa_t *dfa);
|
static void calc_inveclosure (re_dfa_t *dfa);
|
||||||
static int fetch_number (re_string_t *input, re_token_t *token,
|
static int fetch_number (re_string_t *input, re_token_t *token,
|
||||||
reg_syntax_t syntax);
|
reg_syntax_t syntax);
|
||||||
static re_token_t fetch_token (re_string_t *input, reg_syntax_t syntax);
|
static void fetch_token (re_token_t *result, re_string_t *input,
|
||||||
|
reg_syntax_t syntax);
|
||||||
static int peek_token (re_token_t *token, re_string_t *input,
|
static int peek_token (re_token_t *token, re_string_t *input,
|
||||||
reg_syntax_t syntax);
|
reg_syntax_t syntax);
|
||||||
static int peek_token_bracket (re_token_t *token, re_string_t *input,
|
static int peek_token_bracket (re_token_t *token, re_string_t *input,
|
||||||
|
@ -1588,16 +1589,13 @@ calc_eclosure_iter (new_set, dfa, node, root)
|
||||||
/* Fetch a token from INPUT.
|
/* Fetch a token from INPUT.
|
||||||
We must not use this function inside bracket expressions. */
|
We must not use this function inside bracket expressions. */
|
||||||
|
|
||||||
static re_token_t
|
static void
|
||||||
fetch_token (input, syntax)
|
fetch_token (result, input, syntax)
|
||||||
|
re_token_t *result;
|
||||||
re_string_t *input;
|
re_string_t *input;
|
||||||
reg_syntax_t syntax;
|
reg_syntax_t syntax;
|
||||||
{
|
{
|
||||||
re_token_t token;
|
re_string_skip_bytes (input, peek_token (result, input, syntax));
|
||||||
int consumed_byte;
|
|
||||||
consumed_byte = peek_token (&token, input, syntax);
|
|
||||||
re_string_skip_bytes (input, consumed_byte);
|
|
||||||
return token;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Peek a token from INPUT, and return the length of the token.
|
/* Peek a token from INPUT, and return the length of the token.
|
||||||
|
@ -1927,7 +1925,7 @@ parse (regexp, preg, syntax, err)
|
||||||
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
|
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
|
||||||
bin_tree_t *tree, *eor, *root;
|
bin_tree_t *tree, *eor, *root;
|
||||||
re_token_t current_token;
|
re_token_t current_token;
|
||||||
current_token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
fetch_token (¤t_token, regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
|
tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err);
|
||||||
if (BE (*err != REG_NOERROR && tree == NULL, 0))
|
if (BE (*err != REG_NOERROR && tree == NULL, 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1971,7 +1969,7 @@ parse_reg_exp (regexp, preg, token, syntax, nest, err)
|
||||||
while (token->type == OP_ALT)
|
while (token->type == OP_ALT)
|
||||||
{
|
{
|
||||||
re_token_t alt_token = *token;
|
re_token_t alt_token = *token;
|
||||||
*token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
if (token->type != OP_ALT && token->type != END_OF_RE
|
if (token->type != OP_ALT && token->type != END_OF_RE
|
||||||
&& (nest == 0 || token->type != OP_CLOSE_SUBEXP))
|
&& (nest == 0 || token->type != OP_CLOSE_SUBEXP))
|
||||||
{
|
{
|
||||||
|
@ -2073,7 +2071,7 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
||||||
&& !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
|
&& !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
|
||||||
{
|
{
|
||||||
bin_tree_t *mbc_remain;
|
bin_tree_t *mbc_remain;
|
||||||
*token = fetch_token (regexp, syntax);
|
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);
|
tree = create_tree (dfa, tree, mbc_remain, CONCAT, 0);
|
||||||
if (BE (mbc_remain == NULL || tree == NULL, 0))
|
if (BE (mbc_remain == NULL || tree == NULL, 0))
|
||||||
|
@ -2129,7 +2127,7 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
||||||
}
|
}
|
||||||
else if (syntax & RE_CONTEXT_INDEP_OPS)
|
else if (syntax & RE_CONTEXT_INDEP_OPS)
|
||||||
{
|
{
|
||||||
*token = fetch_token (regexp, syntax);
|
fetch_token (token, regexp, syntax);
|
||||||
return parse_expression (regexp, preg, token, syntax, nest, err);
|
return parse_expression (regexp, preg, token, syntax, nest, err);
|
||||||
}
|
}
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
|
@ -2188,7 +2186,7 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
||||||
by repetition operators.
|
by repetition operators.
|
||||||
eg. RE"^*" is invalid or "<ANCHOR(^)><CHAR(*)>",
|
eg. RE"^*" is invalid or "<ANCHOR(^)><CHAR(*)>",
|
||||||
it must not be "<ANCHOR(^)><REPEAT(*)>". */
|
it must not be "<ANCHOR(^)><REPEAT(*)>". */
|
||||||
*token = fetch_token (regexp, syntax);
|
fetch_token (token, regexp, syntax);
|
||||||
return tree;
|
return tree;
|
||||||
case OP_PERIOD:
|
case OP_PERIOD:
|
||||||
tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
|
tree = re_dfa_add_tree_node (dfa, NULL, NULL, *token);
|
||||||
|
@ -2233,7 +2231,7 @@ parse_expression (regexp, preg, token, syntax, nest, err)
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*token = fetch_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)
|
||||||
|
@ -2298,7 +2296,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dfa->nodes[left_par->node_idx].opr.idx = cur_nsub;
|
dfa->nodes[left_par->node_idx].opr.idx = cur_nsub;
|
||||||
*token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
|
fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE);
|
||||||
|
|
||||||
/* The subexpression may be a null string. */
|
/* The subexpression may be a null string. */
|
||||||
if (token->type == OP_CLOSE_SUBEXP)
|
if (token->type == OP_CLOSE_SUBEXP)
|
||||||
|
@ -2378,7 +2376,7 @@ parse_dup_op (dup_elem, regexp, dfa, token, syntax, err)
|
||||||
if (BE (start == 0 && end == 0, 0))
|
if (BE (start == 0 && end == 0, 0))
|
||||||
{
|
{
|
||||||
/* We treat "<re>{0}" and "<re>{0,0}" as null string. */
|
/* We treat "<re>{0}" and "<re>{0,0}" as null string. */
|
||||||
*token = fetch_token (regexp, syntax);
|
fetch_token (token, regexp, syntax);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2457,7 +2455,7 @@ parse_dup_op (dup_elem, regexp, dfa, token, syntax, err)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*token = fetch_token (regexp, syntax);
|
fetch_token (token, regexp, syntax);
|
||||||
return tree;
|
return tree;
|
||||||
|
|
||||||
parse_dup_op_espace:
|
parse_dup_op_espace:
|
||||||
|
@ -3591,7 +3589,7 @@ fetch_number (input, token, syntax)
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
*token = fetch_token (input, syntax);
|
fetch_token (token, input, syntax);
|
||||||
c = token->opr.c;
|
c = token->opr.c;
|
||||||
if (BE (token->type == END_OF_RE, 0))
|
if (BE (token->type == END_OF_RE, 0))
|
||||||
return -2;
|
return -2;
|
||||||
|
|
Loading…
Reference in New Issue