about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-25 20:48:59 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-25 20:48:59 +0000
commita0788ec48cc3f1357075e8351aa7d62d20c63c15 (patch)
tree98cb218704b778cc4fccfd3c3ce0e4de31ba3eaa
parent63461e754479c272b75fc219416142f38b4fb23e (diff)
downloadglibc-a0788ec48cc3f1357075e8351aa7d62d20c63c15.tar.gz
glibc-a0788ec48cc3f1357075e8351aa7d62d20c63c15.tar.xz
glibc-a0788ec48cc3f1357075e8351aa7d62d20c63c15.zip
Update.
	* posix/regcomp.c (peek_token): Remove recent changes for anchor
	handling again.
	(parse_reg_exp): Likewise.
	* posix/regex.h: Remove RE_CARET_ANCHORS_HERE.

	(peek_token): Accept \s and \S as OP_SPACE and OP_NOTSPACE.
	(parse_expression): Replace build_word_op with
-rw-r--r--ChangeLog9
-rw-r--r--posix/regcomp.c11
-rw-r--r--posix/regex.h5
3 files changed, 13 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 36bda970f2..f1619f9a90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2003-09-25  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/regcomp.c (peek_token): Remove recent changes for anchor
+	handling again.
+	(parse_reg_exp): Likewise.
+	* posix/regex.h: Remove RE_CARET_ANCHORS_HERE.
+
 	* csu/Makefile ($(objpfx)version-info.h): Fix sed script to handle
 	banners.
 
@@ -239,8 +244,8 @@
 	* posix/regcomp.c (build_word_op): Rename like...
 	(build_charclass_op): ...this.  Accept two extra parameters,
 	CLASS_NAME and EXTRA.  Add EXTRA to the result, not only _.
-	(peek_token): accept \s and \S as OP_SPACE and OP_NOTSPACE.
-	(parse_expression): replace build_word_op with
+	(peek_token): Accept \s and \S as OP_SPACE and OP_NOTSPACE.
+	(parse_expression): Replace build_word_op with
 	build_charclass_op, add new arguments, accept OP_SPACE
 	and OP_NOTSPACE.
 	* posix/regex_internal.h (re_token_type_t): Add OP_SPACE
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 3d54f99363..e2f01fc499 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,11 +1660,12 @@ peek_token (token, input, syntax)
       token->type = OP_PERIOD;
       break;
     case '^':
-      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
+      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
 	  re_string_cur_idx (input) != 0)
 	{
 	  char prev = re_string_peek_byte (input, -1);
-	  if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
+	  if (prev != '|' && prev != '(' &&
+	      (!(syntax & RE_NEWLINE_ALT) || prev != '\n'))
 	    break;
 	}
       token->type = ANCHOR;
@@ -1799,7 +1800,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 | RE_CARET_ANCHORS_HERE);
+  current_token = fetch_token (regexp, syntax);
   tree = parse_reg_exp (regexp, preg, &current_token, syntax, 0, err);
   if (BE (*err != REG_NOERROR && tree == NULL, 0))
     return NULL;
@@ -1846,7 +1847,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 | RE_CARET_ANCHORS_HERE);
+      *token = fetch_token (regexp, syntax);
       if (token->type != OP_ALT && token->type != END_OF_RE
 	  && (nest == 0 || token->type != OP_CLOSE_SUBEXP))
 	{
diff --git a/posix/regex.h b/posix/regex.h
index 1ab3e243a7..e251962cef 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -170,11 +170,6 @@ typedef unsigned long int reg_syntax_t;
    If not set, then case is significant.  */
 #define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
 
-/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
-   for ^, because it is difficult to scan the regex backwards to find
-   whether ^ should be special.  */
-#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
-
 /* This global variable defines the particular regexp syntax to use (for
    some interfaces).  When a regexp is compiled, the syntax used is
    stored in the pattern buffer, so changing this does not affect