Fix precedence bugs in regexp code.

Submitted by: Matthew Dempsky
This commit is contained in:
sperber 2006-10-31 09:35:19 +00:00
parent bf9dc18cc6
commit c46c84f66c
1 changed files with 11 additions and 10 deletions

View File

@ -66,10 +66,10 @@ posix_compile_regexp(s48_value pattern,
s48_value sch_regex;
int status;
S48_DECLARE_GC_PROTECT(1);
int flags = S48_EXTRACT_BOOLEAN(extended_p) ? REG_EXTENDED : 0 |
S48_EXTRACT_BOOLEAN(ignore_case_p) ? REG_ICASE : 0 |
S48_EXTRACT_BOOLEAN(submatches_p) ? 0 : REG_NOSUB |
S48_EXTRACT_BOOLEAN(newline_p) ? REG_NEWLINE : 0;
int flags = (S48_EXTRACT_BOOLEAN(extended_p) ? REG_EXTENDED : 0) |
(S48_EXTRACT_BOOLEAN(ignore_case_p) ? REG_ICASE : 0) |
(S48_EXTRACT_BOOLEAN(submatches_p) ? 0 : REG_NOSUB) |
(S48_EXTRACT_BOOLEAN(newline_p) ? REG_NEWLINE : 0);
S48_GC_PROTECT_1(pattern);
@ -111,8 +111,9 @@ posix_regexp_match(s48_value sch_regex, s48_value string,
size_t nmatch = 1 + S48_EXTRACT_VALUE_POINTER(sch_regex, regex_t)->re_nsub;
regmatch_t *pmatch,
pmatch_buffer[32];
int flags = S48_EXTRACT_BOOLEAN(bol_p) ? 0 : REG_NOTBOL |
S48_EXTRACT_BOOLEAN(eol_p) ? 0 : REG_NOTEOL;
int flags = (S48_EXTRACT_BOOLEAN(bol_p) ? 0 : REG_NOTBOL) |
(S48_EXTRACT_BOOLEAN(eol_p) ? 0 : REG_NOTEOL);
start = s48_extract_fixnum(sch_start);
len = S48_STRING_LENGTH(string);
@ -183,10 +184,10 @@ posix_regexp_error_message(s48_value pattern,
{
regex_t compiled_regex;
int status;
int flags = S48_EXTRACT_BOOLEAN(extended_p) ? REG_EXTENDED : 0 |
S48_EXTRACT_BOOLEAN(ignore_case_p) ? REG_ICASE : 0 |
S48_EXTRACT_BOOLEAN(submatches_p) ? 0 : REG_NOSUB |
S48_EXTRACT_BOOLEAN(newline_p) ? REG_NEWLINE : 0;
int flags = (S48_EXTRACT_BOOLEAN(extended_p) ? REG_EXTENDED : 0) |
(S48_EXTRACT_BOOLEAN(ignore_case_p) ? REG_ICASE : 0) |
(S48_EXTRACT_BOOLEAN(submatches_p) ? 0 : REG_NOSUB) |
(S48_EXTRACT_BOOLEAN(newline_p) ? REG_NEWLINE : 0);
S48_CHECK_STRING(pattern);