Mercurial > gnulib
comparison lib/regcomp.c @ 40245:eeb8fe2e91ad
autoupdate
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 17 Mar 2019 16:29:28 -0700 |
parents | 1a63e9768c53 |
children |
comparison
equal
deleted
inserted
replaced
40244:c39a0edd90d7 | 40245:eeb8fe2e91ad |
---|---|
1798 token->opr.c = c; | 1798 token->opr.c = c; |
1799 | 1799 |
1800 token->word_char = 0; | 1800 token->word_char = 0; |
1801 #ifdef RE_ENABLE_I18N | 1801 #ifdef RE_ENABLE_I18N |
1802 token->mb_partial = 0; | 1802 token->mb_partial = 0; |
1803 if (input->mb_cur_max > 1 && | 1803 if (input->mb_cur_max > 1 |
1804 !re_string_first_byte (input, re_string_cur_idx (input))) | 1804 && !re_string_first_byte (input, re_string_cur_idx (input))) |
1805 { | 1805 { |
1806 token->type = CHARACTER; | 1806 token->type = CHARACTER; |
1807 token->mb_partial = 1; | 1807 token->mb_partial = 1; |
1808 return 1; | 1808 return 1; |
1809 } | 1809 } |
1986 break; | 1986 break; |
1987 case '.': | 1987 case '.': |
1988 token->type = OP_PERIOD; | 1988 token->type = OP_PERIOD; |
1989 break; | 1989 break; |
1990 case '^': | 1990 case '^': |
1991 if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) && | 1991 if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) |
1992 re_string_cur_idx (input) != 0) | 1992 && re_string_cur_idx (input) != 0) |
1993 { | 1993 { |
1994 char prev = re_string_peek_byte (input, -1); | 1994 char prev = re_string_peek_byte (input, -1); |
1995 if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') | 1995 if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') |
1996 break; | 1996 break; |
1997 } | 1997 } |
1998 token->type = ANCHOR; | 1998 token->type = ANCHOR; |
1999 token->opr.ctx_type = LINE_FIRST; | 1999 token->opr.ctx_type = LINE_FIRST; |
2000 break; | 2000 break; |
2001 case '$': | 2001 case '$': |
2002 if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && | 2002 if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) |
2003 re_string_cur_idx (input) + 1 != re_string_length (input)) | 2003 && re_string_cur_idx (input) + 1 != re_string_length (input)) |
2004 { | 2004 { |
2005 re_token_t next; | 2005 re_token_t next; |
2006 re_string_skip_bytes (input, 1); | 2006 re_string_skip_bytes (input, 1); |
2007 peek_token (&next, input, syntax); | 2007 peek_token (&next, input, syntax); |
2008 re_string_skip_bytes (input, -1); | 2008 re_string_skip_bytes (input, -1); |
2032 } | 2032 } |
2033 c = re_string_peek_byte (input, 0); | 2033 c = re_string_peek_byte (input, 0); |
2034 token->opr.c = c; | 2034 token->opr.c = c; |
2035 | 2035 |
2036 #ifdef RE_ENABLE_I18N | 2036 #ifdef RE_ENABLE_I18N |
2037 if (input->mb_cur_max > 1 && | 2037 if (input->mb_cur_max > 1 |
2038 !re_string_first_byte (input, re_string_cur_idx (input))) | 2038 && !re_string_first_byte (input, re_string_cur_idx (input))) |
2039 { | 2039 { |
2040 token->type = CHARACTER; | 2040 token->type = CHARACTER; |
2041 return 1; | 2041 return 1; |
2042 } | 2042 } |
2043 #endif /* RE_ENABLE_I18N */ | 2043 #endif /* RE_ENABLE_I18N */ |
2331 fetch_token (token, regexp, syntax); | 2331 fetch_token (token, regexp, syntax); |
2332 return parse_expression (regexp, preg, token, syntax, nest, err); | 2332 return parse_expression (regexp, preg, token, syntax, nest, err); |
2333 } | 2333 } |
2334 FALLTHROUGH; | 2334 FALLTHROUGH; |
2335 case OP_CLOSE_SUBEXP: | 2335 case OP_CLOSE_SUBEXP: |
2336 if ((token->type == OP_CLOSE_SUBEXP) && | 2336 if ((token->type == OP_CLOSE_SUBEXP) |
2337 !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) | 2337 && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)) |
2338 { | 2338 { |
2339 *err = REG_ERPAREN; | 2339 *err = REG_ERPAREN; |
2340 return NULL; | 2340 return NULL; |
2341 } | 2341 } |
2342 FALLTHROUGH; | 2342 FALLTHROUGH; |