summary refs log tree commit diff
path: root/posix/regcomp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-10-02 22:41:11 +0000
committerUlrich Drepper <drepper@redhat.com>2003-10-02 22:41:11 +0000
commit134abcb5b9ba854fec25051cd3c9f88e760913c5 (patch)
tree3988d22ca828c20e2fa396d7b021915a5d6f47e6 /posix/regcomp.c
parentb77ca0e82754c1b0615e5ca6acd343018ffcb287 (diff)
downloadglibc-134abcb5b9ba854fec25051cd3c9f88e760913c5.tar.gz
glibc-134abcb5b9ba854fec25051cd3c9f88e760913c5.tar.xz
glibc-134abcb5b9ba854fec25051cd3c9f88e760913c5.zip
Update.
2003-09-26  Paolo Bonzini  <bonzini@gnu.org>

	* posix/regcomp.c (parse_sub_exp): Pass RE_CARET_ANCHORS_HERE
	for the first token in a subexpression as well.

2003-10-02  Jakub Jelinek  <jakub@redhat.com>

	* posix/regcomp.c (peek_token): Add 2003-09-20 changes for anchor
	handling again.
	(parse_reg_exp): Likewise.
	* posix/regex.h (RE_CARET_ANCHORS_HERE): Define.

	* posix/bug-regex11.c (tests): Add new tests.
	* posix/bug-regex12.c (tests): Add new test.
Diffstat (limited to 'posix/regcomp.c')
-rw-r--r--posix/regcomp.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index e2f01fc499..35a3b83f50 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -119,7 +119,7 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
 				      reg_syntax_t syntax);
 #endif /* not RE_ENABLE_I18N */
 static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
-				       const unsigned char *class_name,
+				       const unsigned char *class_name, 
 				       const unsigned char *extra, int not,
 				       reg_errcode_t *err);
 static void free_bin_tree (bin_tree_t *tree);
@@ -1660,12 +1660,11 @@ peek_token (token, input, syntax)
       token->type = OP_PERIOD;
       break;
     case '^':
-      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
+      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
 	  re_string_cur_idx (input) != 0)
 	{
 	  char prev = re_string_peek_byte (input, -1);
-	  if (prev != '|' && prev != '(' &&
-	      (!(syntax & RE_NEWLINE_ALT) || prev != '\n'))
+	  if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
 	    break;
 	}
       token->type = ANCHOR;
@@ -1800,7 +1799,7 @@ parse (regexp, preg, syntax, err)
   bin_tree_t *tree, *eor, *root;
   re_token_t current_token;
   int new_idx;
-  current_token = fetch_token (regexp, syntax);
+  current_token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
   tree = parse_reg_exp (regexp, preg, &current_token, syntax, 0, err);
   if (BE (*err != REG_NOERROR && tree == NULL, 0))
     return NULL;
@@ -1847,7 +1846,7 @@ parse_reg_exp (regexp, preg, token, syntax, nest, err)
     {
       re_token_t alt_token = *token;
       new_idx = re_dfa_add_node (dfa, alt_token, 0);
-      *token = fetch_token (regexp, syntax);
+      *token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
       if (token->type != OP_ALT && token->type != END_OF_RE
 	  && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
 	{
@@ -2178,7 +2177,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
       return NULL;
     }
   dfa->nodes[new_idx].opr.idx = cur_nsub;
-  *token = fetch_token (regexp, syntax);
+  *token = fetch_token (regexp, syntax | RE_CARET_ANCHORS_HERE);
 
   /* The subexpression may be a null string.  */
   if (token->type == OP_CLOSE_SUBEXP)