diff options
| author | Juanma Barranquero | 2006-11-24 09:30:44 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2006-11-24 09:30:44 +0000 |
| commit | 7814e705eeb3c498bb20e1b8f2a897927294028a (patch) | |
| tree | dd1b88cbb345f58c25021c6295d6f44efa610e7d /src | |
| parent | 8b45f5fe0f0155d429499b82e3dc725cf68d5916 (diff) | |
| download | emacs-7814e705eeb3c498bb20e1b8f2a897927294028a.tar.gz emacs-7814e705eeb3c498bb20e1b8f2a897927294028a.zip | |
Whitespace/tab mixups.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex.c | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/src/regex.c b/src/regex.c index ae80ad0cee8..001be124ff3 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -12,13 +12,13 @@ | |||
| 12 | 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
| 17 | 17 | ||
| 18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
| 21 | USA. */ | 21 | USA. */ |
| 22 | 22 | ||
| 23 | /* TODO: | 23 | /* TODO: |
| 24 | - structure the opcode space into opcode+flag. | 24 | - structure the opcode space into opcode+flag. |
| @@ -139,7 +139,7 @@ | |||
| 139 | # endif | 139 | # endif |
| 140 | # define free xfree | 140 | # define free xfree |
| 141 | 141 | ||
| 142 | /* Converts the pointer to the char to BEG-based offset from the start. */ | 142 | /* Converts the pointer to the char to BEG-based offset from the start. */ |
| 143 | # define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d)) | 143 | # define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d)) |
| 144 | # define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object))) | 144 | # define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object))) |
| 145 | 145 | ||
| @@ -540,7 +540,7 @@ init_syntax_once () | |||
| 540 | 540 | ||
| 541 | # define REGEX_REALLOCATE_STACK(source, osize, nsize) \ | 541 | # define REGEX_REALLOCATE_STACK(source, osize, nsize) \ |
| 542 | REGEX_REALLOCATE (source, osize, nsize) | 542 | REGEX_REALLOCATE (source, osize, nsize) |
| 543 | /* No need to explicitly free anything. */ | 543 | /* No need to explicitly free anything. */ |
| 544 | # define REGEX_FREE_STACK(arg) ((void)0) | 544 | # define REGEX_FREE_STACK(arg) ((void)0) |
| 545 | 545 | ||
| 546 | # endif /* not REGEX_MALLOC */ | 546 | # endif /* not REGEX_MALLOC */ |
| @@ -654,7 +654,7 @@ typedef enum | |||
| 654 | jump, | 654 | jump, |
| 655 | 655 | ||
| 656 | /* Followed by two-byte relative address of place to resume at | 656 | /* Followed by two-byte relative address of place to resume at |
| 657 | in case of failure. */ | 657 | in case of failure. */ |
| 658 | on_failure_jump, | 658 | on_failure_jump, |
| 659 | 659 | ||
| 660 | /* Like on_failure_jump, but pushes a placeholder instead of the | 660 | /* Like on_failure_jump, but pushes a placeholder instead of the |
| @@ -691,7 +691,7 @@ typedef enum | |||
| 691 | jump_n, | 691 | jump_n, |
| 692 | 692 | ||
| 693 | /* Set the following two-byte relative address to the | 693 | /* Set the following two-byte relative address to the |
| 694 | subsequent two-byte number. The address *includes* the two | 694 | subsequent two-byte number. The address *includes* the two |
| 695 | bytes of number. */ | 695 | bytes of number. */ |
| 696 | set_number_at, | 696 | set_number_at, |
| 697 | 697 | ||
| @@ -699,7 +699,7 @@ typedef enum | |||
| 699 | wordend, /* Succeeds if at word end. */ | 699 | wordend, /* Succeeds if at word end. */ |
| 700 | 700 | ||
| 701 | wordbound, /* Succeeds if at a word boundary. */ | 701 | wordbound, /* Succeeds if at a word boundary. */ |
| 702 | notwordbound, /* Succeeds if not at a word boundary. */ | 702 | notwordbound, /* Succeeds if not at a word boundary. */ |
| 703 | 703 | ||
| 704 | symbeg, /* Succeeds if at symbol beginning. */ | 704 | symbeg, /* Succeeds if at symbol beginning. */ |
| 705 | symend, /* Succeeds if at symbol end. */ | 705 | symend, /* Succeeds if at symbol end. */ |
| @@ -717,8 +717,8 @@ typedef enum | |||
| 717 | after_dot, /* Succeeds if after point. */ | 717 | after_dot, /* Succeeds if after point. */ |
| 718 | 718 | ||
| 719 | /* Matches any character whose category-set contains the specified | 719 | /* Matches any character whose category-set contains the specified |
| 720 | category. The operator is followed by a byte which contains a | 720 | category. The operator is followed by a byte which contains a |
| 721 | category code (mnemonic ASCII character). */ | 721 | category code (mnemonic ASCII character). */ |
| 722 | categoryspec, | 722 | categoryspec, |
| 723 | 723 | ||
| 724 | /* Matches any character whose category-set does not contain the | 724 | /* Matches any character whose category-set does not contain the |
| @@ -807,7 +807,7 @@ extract_number_and_incr (destination, source) | |||
| 807 | 807 | ||
| 808 | /* Store a multibyte character in three contiguous bytes starting | 808 | /* Store a multibyte character in three contiguous bytes starting |
| 809 | DESTINATION, and increment DESTINATION to the byte after where the | 809 | DESTINATION, and increment DESTINATION to the byte after where the |
| 810 | character is stored. Therefore, DESTINATION must be an lvalue. */ | 810 | character is stored. Therefore, DESTINATION must be an lvalue. */ |
| 811 | 811 | ||
| 812 | #define STORE_CHARACTER_AND_INCR(destination, character) \ | 812 | #define STORE_CHARACTER_AND_INCR(destination, character) \ |
| 813 | do { \ | 813 | do { \ |
| @@ -818,7 +818,7 @@ extract_number_and_incr (destination, source) | |||
| 818 | } while (0) | 818 | } while (0) |
| 819 | 819 | ||
| 820 | /* Put into DESTINATION a character stored in three contiguous bytes | 820 | /* Put into DESTINATION a character stored in three contiguous bytes |
| 821 | starting at SOURCE. */ | 821 | starting at SOURCE. */ |
| 822 | 822 | ||
| 823 | #define EXTRACT_CHARACTER(destination, source) \ | 823 | #define EXTRACT_CHARACTER(destination, source) \ |
| 824 | do { \ | 824 | do { \ |
| @@ -854,13 +854,13 @@ extract_number_and_incr (destination, source) | |||
| 854 | && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH))) | 854 | && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH))) |
| 855 | 855 | ||
| 856 | /* Return the address of end of RANGE_TABLE. COUNT is number of | 856 | /* Return the address of end of RANGE_TABLE. COUNT is number of |
| 857 | ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' | 857 | ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' |
| 858 | is start of range and end of range. `* 3' is size of each start | 858 | is start of range and end of range. `* 3' is size of each start |
| 859 | and end. */ | 859 | and end. */ |
| 860 | #define CHARSET_RANGE_TABLE_END(range_table, count) \ | 860 | #define CHARSET_RANGE_TABLE_END(range_table, count) \ |
| 861 | ((range_table) + (count) * 2 * 3) | 861 | ((range_table) + (count) * 2 * 3) |
| 862 | 862 | ||
| 863 | /* Test if C is in RANGE_TABLE. A flag NOT is negated if C is in. | 863 | /* Test if C is in RANGE_TABLE. A flag NOT is negated if C is in. |
| 864 | COUNT is number of ranges in RANGE_TABLE. */ | 864 | COUNT is number of ranges in RANGE_TABLE. */ |
| 865 | #define CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count) \ | 865 | #define CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count) \ |
| 866 | do \ | 866 | do \ |
| @@ -1667,7 +1667,7 @@ do { \ | |||
| 1667 | REGSTART, REGEND -- arrays of string positions. | 1667 | REGSTART, REGEND -- arrays of string positions. |
| 1668 | 1668 | ||
| 1669 | Also assumes the variables `fail_stack' and (if debugging), `bufp', | 1669 | Also assumes the variables `fail_stack' and (if debugging), `bufp', |
| 1670 | `pend', `string1', `size1', `string2', and `size2'. */ | 1670 | `pend', `string1', `size1', `string2', and `size2'. */ |
| 1671 | 1671 | ||
| 1672 | #define POP_FAILURE_POINT(str, pat) \ | 1672 | #define POP_FAILURE_POINT(str, pat) \ |
| 1673 | do { \ | 1673 | do { \ |
| @@ -1936,7 +1936,7 @@ struct range_table_work_area | |||
| 1936 | { | 1936 | { |
| 1937 | int *table; /* actual work area. */ | 1937 | int *table; /* actual work area. */ |
| 1938 | int allocated; /* allocated size for work area in bytes. */ | 1938 | int allocated; /* allocated size for work area in bytes. */ |
| 1939 | int used; /* actually used size in words. */ | 1939 | int used; /* actually used size in words. */ |
| 1940 | int bits; /* flag to record character classes */ | 1940 | int bits; /* flag to record character classes */ |
| 1941 | }; | 1941 | }; |
| 1942 | 1942 | ||
| @@ -1978,7 +1978,7 @@ struct range_table_work_area | |||
| 1978 | FREE_STACK_RETURN (tem); \ | 1978 | FREE_STACK_RETURN (tem); \ |
| 1979 | } while (0) | 1979 | } while (0) |
| 1980 | 1980 | ||
| 1981 | /* Free allocated memory for WORK_AREA. */ | 1981 | /* Free allocated memory for WORK_AREA. */ |
| 1982 | #define FREE_RANGE_TABLE_WORK_AREA(work_area) \ | 1982 | #define FREE_RANGE_TABLE_WORK_AREA(work_area) \ |
| 1983 | do { \ | 1983 | do { \ |
| 1984 | if ((work_area).table) \ | 1984 | if ((work_area).table) \ |
| @@ -2478,7 +2478,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2478 | re_char *beg_interval; | 2478 | re_char *beg_interval; |
| 2479 | 2479 | ||
| 2480 | /* Address of the place where a forward jump should go to the end of | 2480 | /* Address of the place where a forward jump should go to the end of |
| 2481 | the containing expression. Each alternative of an `or' -- except the | 2481 | the containing expression. Each alternative of an `or' -- except the |
| 2482 | last -- ends with a forward jump of this sort. */ | 2482 | last -- ends with a forward jump of this sort. */ |
| 2483 | unsigned char *fixup_alt_jump = 0; | 2483 | unsigned char *fixup_alt_jump = 0; |
| 2484 | 2484 | ||
| @@ -2550,11 +2550,11 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2550 | if (bufp->buffer) | 2550 | if (bufp->buffer) |
| 2551 | { /* If zero allocated, but buffer is non-null, try to realloc | 2551 | { /* If zero allocated, but buffer is non-null, try to realloc |
| 2552 | enough space. This loses if buffer's address is bogus, but | 2552 | enough space. This loses if buffer's address is bogus, but |
| 2553 | that is the user's responsibility. */ | 2553 | that is the user's responsibility. */ |
| 2554 | RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); | 2554 | RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); |
| 2555 | } | 2555 | } |
| 2556 | else | 2556 | else |
| 2557 | { /* Caller did not allocate a buffer. Do it for them. */ | 2557 | { /* Caller did not allocate a buffer. Do it for them. */ |
| 2558 | bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); | 2558 | bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); |
| 2559 | } | 2559 | } |
| 2560 | if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); | 2560 | if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); |
| @@ -2618,15 +2618,15 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2618 | p = pattern = whitespace_regexp; | 2618 | p = pattern = whitespace_regexp; |
| 2619 | pend = p + strlen (p); | 2619 | pend = p + strlen (p); |
| 2620 | break; | 2620 | break; |
| 2621 | } | 2621 | } |
| 2622 | 2622 | ||
| 2623 | case '^': | 2623 | case '^': |
| 2624 | { | 2624 | { |
| 2625 | if ( /* If at start of pattern, it's an operator. */ | 2625 | if ( /* If at start of pattern, it's an operator. */ |
| 2626 | p == pattern + 1 | 2626 | p == pattern + 1 |
| 2627 | /* If context independent, it's an operator. */ | 2627 | /* If context independent, it's an operator. */ |
| 2628 | || syntax & RE_CONTEXT_INDEP_ANCHORS | 2628 | || syntax & RE_CONTEXT_INDEP_ANCHORS |
| 2629 | /* Otherwise, depends on what's come before. */ | 2629 | /* Otherwise, depends on what's come before. */ |
| 2630 | || at_begline_loc_p (pattern, p, syntax)) | 2630 | || at_begline_loc_p (pattern, p, syntax)) |
| 2631 | BUF_PUSH ((syntax & RE_NO_NEWLINE_ANCHOR) ? begbuf : begline); | 2631 | BUF_PUSH ((syntax & RE_NO_NEWLINE_ANCHOR) ? begbuf : begline); |
| 2632 | else | 2632 | else |
| @@ -2639,7 +2639,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2639 | { | 2639 | { |
| 2640 | if ( /* If at end of pattern, it's an operator. */ | 2640 | if ( /* If at end of pattern, it's an operator. */ |
| 2641 | p == pend | 2641 | p == pend |
| 2642 | /* If context independent, it's an operator. */ | 2642 | /* If context independent, it's an operator. */ |
| 2643 | || syntax & RE_CONTEXT_INDEP_ANCHORS | 2643 | || syntax & RE_CONTEXT_INDEP_ANCHORS |
| 2644 | /* Otherwise, depends on what's next. */ | 2644 | /* Otherwise, depends on what's next. */ |
| 2645 | || at_endline_loc_p (p, pend, syntax)) | 2645 | || at_endline_loc_p (p, pend, syntax)) |
| @@ -2667,14 +2667,14 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2667 | } | 2667 | } |
| 2668 | 2668 | ||
| 2669 | { | 2669 | { |
| 2670 | /* 1 means zero (many) matches is allowed. */ | 2670 | /* 1 means zero (many) matches is allowed. */ |
| 2671 | boolean zero_times_ok = 0, many_times_ok = 0; | 2671 | boolean zero_times_ok = 0, many_times_ok = 0; |
| 2672 | boolean greedy = 1; | 2672 | boolean greedy = 1; |
| 2673 | 2673 | ||
| 2674 | /* If there is a sequence of repetition chars, collapse it | 2674 | /* If there is a sequence of repetition chars, collapse it |
| 2675 | down to just one (the right one). We can't combine | 2675 | down to just one (the right one). We can't combine |
| 2676 | interval operators with these because of, e.g., `a{2}*', | 2676 | interval operators with these because of, e.g., `a{2}*', |
| 2677 | which should only match an even number of `a's. */ | 2677 | which should only match an even number of `a's. */ |
| 2678 | 2678 | ||
| 2679 | for (;;) | 2679 | for (;;) |
| 2680 | { | 2680 | { |
| @@ -2714,7 +2714,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2714 | break; | 2714 | break; |
| 2715 | 2715 | ||
| 2716 | /* Now we know whether or not zero matches is allowed | 2716 | /* Now we know whether or not zero matches is allowed |
| 2717 | and also whether or not two or more matches is allowed. */ | 2717 | and also whether or not two or more matches is allowed. */ |
| 2718 | if (greedy) | 2718 | if (greedy) |
| 2719 | { | 2719 | { |
| 2720 | if (many_times_ok) | 2720 | if (many_times_ok) |
| @@ -2821,7 +2821,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2821 | laststart = b; | 2821 | laststart = b; |
| 2822 | 2822 | ||
| 2823 | /* We test `*p == '^' twice, instead of using an if | 2823 | /* We test `*p == '^' twice, instead of using an if |
| 2824 | statement, so we only need one BUF_PUSH. */ | 2824 | statement, so we only need one BUF_PUSH. */ |
| 2825 | BUF_PUSH (*p == '^' ? charset_not : charset); | 2825 | BUF_PUSH (*p == '^' ? charset_not : charset); |
| 2826 | if (*p == '^') | 2826 | if (*p == '^') |
| 2827 | p++; | 2827 | p++; |
| @@ -2829,7 +2829,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2829 | /* Remember the first position in the bracket expression. */ | 2829 | /* Remember the first position in the bracket expression. */ |
| 2830 | p1 = p; | 2830 | p1 = p; |
| 2831 | 2831 | ||
| 2832 | /* Push the number of bytes in the bitmap. */ | 2832 | /* Push the number of bytes in the bitmap. */ |
| 2833 | BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); | 2833 | BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); |
| 2834 | 2834 | ||
| 2835 | /* Clear the whole map. */ | 2835 | /* Clear the whole map. */ |
| @@ -2840,7 +2840,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2840 | && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) | 2840 | && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) |
| 2841 | SET_LIST_BIT ('\n'); | 2841 | SET_LIST_BIT ('\n'); |
| 2842 | 2842 | ||
| 2843 | /* Read in characters and ranges, setting map bits. */ | 2843 | /* Read in characters and ranges, setting map bits. */ |
| 2844 | for (;;) | 2844 | for (;;) |
| 2845 | { | 2845 | { |
| 2846 | boolean escaped_char = false; | 2846 | boolean escaped_char = false; |
| @@ -2864,7 +2864,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2864 | } | 2864 | } |
| 2865 | else | 2865 | else |
| 2866 | { | 2866 | { |
| 2867 | /* Could be the end of the bracket expression. If it's | 2867 | /* Could be the end of the bracket expression. If it's |
| 2868 | not (i.e., when the bracket expression is `[]' so | 2868 | not (i.e., when the bracket expression is `[]' so |
| 2869 | far), the ']' character bit gets set way below. */ | 2869 | far), the ']' character bit gets set way below. */ |
| 2870 | if (c == ']' && p2 != p1) | 2870 | if (c == ']' && p2 != p1) |
| @@ -2881,7 +2881,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2881 | if (!escaped_char && | 2881 | if (!escaped_char && |
| 2882 | syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') | 2882 | syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') |
| 2883 | { | 2883 | { |
| 2884 | /* Leave room for the null. */ | 2884 | /* Leave room for the null. */ |
| 2885 | unsigned char str[CHAR_CLASS_MAX_LENGTH + 1]; | 2885 | unsigned char str[CHAR_CLASS_MAX_LENGTH + 1]; |
| 2886 | const unsigned char *class_beg; | 2886 | const unsigned char *class_beg; |
| 2887 | 2887 | ||
| @@ -2962,7 +2962,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 2962 | 2962 | ||
| 2963 | /* Because the `:' may starts the range, we | 2963 | /* Because the `:' may starts the range, we |
| 2964 | can't simply set bit and repeat the loop. | 2964 | can't simply set bit and repeat the loop. |
| 2965 | Instead, just set it to C and handle below. */ | 2965 | Instead, just set it to C and handle below. */ |
| 2966 | c = ':'; | 2966 | c = ':'; |
| 2967 | } | 2967 | } |
| 2968 | } | 2968 | } |
| @@ -3029,7 +3029,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3029 | } | 3029 | } |
| 3030 | 3030 | ||
| 3031 | /* Discard any (non)matching list bytes that are all 0 at the | 3031 | /* Discard any (non)matching list bytes that are all 0 at the |
| 3032 | end of the map. Decrease the map-length byte too. */ | 3032 | end of the map. Decrease the map-length byte too. */ |
| 3033 | while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) | 3033 | while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) |
| 3034 | b[-1]--; | 3034 | b[-1]--; |
| 3035 | b += b[-1]; | 3035 | b += b[-1]; |
| @@ -3148,7 +3148,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3148 | } | 3148 | } |
| 3149 | 3149 | ||
| 3150 | /* These are the values to restore when we hit end of this | 3150 | /* These are the values to restore when we hit end of this |
| 3151 | group. They are all relative offsets, so that if the | 3151 | group. They are all relative offsets, so that if the |
| 3152 | whole pattern moves because of realloc, they will still | 3152 | whole pattern moves because of realloc, they will still |
| 3153 | be valid. */ | 3153 | be valid. */ |
| 3154 | COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; | 3154 | COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; |
| @@ -3204,7 +3204,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3204 | { | 3204 | { |
| 3205 | /* We don't just want to restore into `regnum', because | 3205 | /* We don't just want to restore into `regnum', because |
| 3206 | later groups should continue to be numbered higher, | 3206 | later groups should continue to be numbered higher, |
| 3207 | as in `(ab)c(de)' -- the second group is #2. */ | 3207 | as in `(ab)c(de)' -- the second group is #2. */ |
| 3208 | regnum_t this_group_regnum; | 3208 | regnum_t this_group_regnum; |
| 3209 | 3209 | ||
| 3210 | compile_stack.avail--; | 3210 | compile_stack.avail--; |
| @@ -3221,7 +3221,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3221 | pending_exact = 0; | 3221 | pending_exact = 0; |
| 3222 | 3222 | ||
| 3223 | /* We're at the end of the group, so now we know how many | 3223 | /* We're at the end of the group, so now we know how many |
| 3224 | groups were inside this one. */ | 3224 | groups were inside this one. */ |
| 3225 | if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0) | 3225 | if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0) |
| 3226 | BUF_PUSH_2 (stop_memory, this_group_regnum); | 3226 | BUF_PUSH_2 (stop_memory, this_group_regnum); |
| 3227 | } | 3227 | } |
| @@ -3236,7 +3236,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3236 | goto normal_char; | 3236 | goto normal_char; |
| 3237 | 3237 | ||
| 3238 | /* Insert before the previous alternative a jump which | 3238 | /* Insert before the previous alternative a jump which |
| 3239 | jumps to this alternative if the former fails. */ | 3239 | jumps to this alternative if the former fails. */ |
| 3240 | GET_BUFFER_SPACE (3); | 3240 | GET_BUFFER_SPACE (3); |
| 3241 | INSERT_JUMP (on_failure_jump, begalt, b + 6); | 3241 | INSERT_JUMP (on_failure_jump, begalt, b + 6); |
| 3242 | pending_exact = 0; | 3242 | pending_exact = 0; |
| @@ -3373,7 +3373,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3373 | b += 5; | 3373 | b += 5; |
| 3374 | 3374 | ||
| 3375 | /* Code to initialize the lower bound. Insert | 3375 | /* Code to initialize the lower bound. Insert |
| 3376 | before the `succeed_n'. The `5' is the last two | 3376 | before the `succeed_n'. The `5' is the last two |
| 3377 | bytes of this `set_number_at', plus 3 bytes of | 3377 | bytes of this `set_number_at', plus 3 bytes of |
| 3378 | the following `succeed_n'. */ | 3378 | the following `succeed_n'. */ |
| 3379 | insert_op2 (set_number_at, laststart, 5, lower_bound, b); | 3379 | insert_op2 (set_number_at, laststart, 5, lower_bound, b); |
| @@ -3443,7 +3443,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3443 | 3443 | ||
| 3444 | #ifdef emacs | 3444 | #ifdef emacs |
| 3445 | /* There is no way to specify the before_dot and after_dot | 3445 | /* There is no way to specify the before_dot and after_dot |
| 3446 | operators. rms says this is ok. --karl */ | 3446 | operators. rms says this is ok. --karl */ |
| 3447 | case '=': | 3447 | case '=': |
| 3448 | BUF_PUSH (at_dot); | 3448 | BUF_PUSH (at_dot); |
| 3449 | break; | 3449 | break; |
| @@ -3588,7 +3588,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3588 | /* We have only one byte following the exactn for the count. */ | 3588 | /* We have only one byte following the exactn for the count. */ |
| 3589 | || *pending_exact >= (1 << BYTEWIDTH) - MAX_MULTIBYTE_LENGTH | 3589 | || *pending_exact >= (1 << BYTEWIDTH) - MAX_MULTIBYTE_LENGTH |
| 3590 | 3590 | ||
| 3591 | /* If followed by a repetition operator. */ | 3591 | /* If followed by a repetition operator. */ |
| 3592 | || (p != pend && (*p == '*' || *p == '^')) | 3592 | || (p != pend && (*p == '*' || *p == '^')) |
| 3593 | || ((syntax & RE_BK_PLUS_QM) | 3593 | || ((syntax & RE_BK_PLUS_QM) |
| 3594 | ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?') | 3594 | ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?') |
| @@ -3680,7 +3680,7 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3680 | 3680 | ||
| 3681 | /* Subroutines for `regex_compile'. */ | 3681 | /* Subroutines for `regex_compile'. */ |
| 3682 | 3682 | ||
| 3683 | /* Store OP at LOC followed by two-byte integer parameter ARG. */ | 3683 | /* Store OP at LOC followed by two-byte integer parameter ARG. */ |
| 3684 | 3684 | ||
| 3685 | static void | 3685 | static void |
| 3686 | store_op1 (op, loc, arg) | 3686 | store_op1 (op, loc, arg) |
| @@ -3832,7 +3832,7 @@ analyse_first (p, pend, fastmap, multibyte) | |||
| 3832 | boolean not; | 3832 | boolean not; |
| 3833 | 3833 | ||
| 3834 | /* If all elements for base leading-codes in fastmap is set, this | 3834 | /* If all elements for base leading-codes in fastmap is set, this |
| 3835 | flag is set true. */ | 3835 | flag is set true. */ |
| 3836 | boolean match_any_multibyte_characters = false; | 3836 | boolean match_any_multibyte_characters = false; |
| 3837 | 3837 | ||
| 3838 | assert (p); | 3838 | assert (p); |
| @@ -3880,7 +3880,7 @@ analyse_first (p, pend, fastmap, multibyte) | |||
| 3880 | 3880 | ||
| 3881 | 3881 | ||
| 3882 | /* Following are the cases which match a character. These end | 3882 | /* Following are the cases which match a character. These end |
| 3883 | with `break'. */ | 3883 | with `break'. */ |
| 3884 | 3884 | ||
| 3885 | case exactn: | 3885 | case exactn: |
| 3886 | if (fastmap) | 3886 | if (fastmap) |
| @@ -4102,7 +4102,7 @@ analyse_first (p, pend, fastmap, multibyte) | |||
| 4102 | 4102 | ||
| 4103 | /* Getting here means we have found the possible starting | 4103 | /* Getting here means we have found the possible starting |
| 4104 | characters for one path of the pattern -- and that the empty | 4104 | characters for one path of the pattern -- and that the empty |
| 4105 | string does not match. We need not follow this path further. */ | 4105 | string does not match. We need not follow this path further. */ |
| 4106 | return 0; | 4106 | return 0; |
| 4107 | } /* while p */ | 4107 | } /* while p */ |
| 4108 | 4108 | ||
| @@ -4137,7 +4137,7 @@ re_compile_fastmap (bufp) | |||
| 4137 | 4137 | ||
| 4138 | assert (fastmap && bufp->buffer); | 4138 | assert (fastmap && bufp->buffer); |
| 4139 | 4139 | ||
| 4140 | bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ | 4140 | bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ |
| 4141 | bufp->fastmap_accurate = 1; /* It will be when we're done. */ | 4141 | bufp->fastmap_accurate = 1; /* It will be when we're done. */ |
| 4142 | 4142 | ||
| 4143 | analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, | 4143 | analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, |
| @@ -4182,7 +4182,7 @@ re_set_registers (bufp, regs, num_regs, starts, ends) | |||
| 4182 | } | 4182 | } |
| 4183 | WEAK_ALIAS (__re_set_registers, re_set_registers) | 4183 | WEAK_ALIAS (__re_set_registers, re_set_registers) |
| 4184 | 4184 | ||
| 4185 | /* Searching routines. */ | 4185 | /* Searching routines. */ |
| 4186 | 4186 | ||
| 4187 | /* Like re_search_2, below, but only one string is specified, and | 4187 | /* Like re_search_2, below, but only one string is specified, and |
| 4188 | doesn't let you say where to stop matching. */ | 4188 | doesn't let you say where to stop matching. */ |
| @@ -4251,7 +4251,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) | |||
| 4251 | int endpos = startpos + range; | 4251 | int endpos = startpos + range; |
| 4252 | boolean anchored_start; | 4252 | boolean anchored_start; |
| 4253 | 4253 | ||
| 4254 | /* Nonzero if we have to concern multibyte character. */ | 4254 | /* Nonzero if we have to concern multibyte character. */ |
| 4255 | const boolean multibyte = RE_MULTIBYTE_P (bufp); | 4255 | const boolean multibyte = RE_MULTIBYTE_P (bufp); |
| 4256 | 4256 | ||
| 4257 | /* Check for out-of-range STARTPOS. */ | 4257 | /* Check for out-of-range STARTPOS. */ |
| @@ -4321,7 +4321,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) | |||
| 4321 | /* If a fastmap is supplied, skip quickly over characters that | 4321 | /* If a fastmap is supplied, skip quickly over characters that |
| 4322 | cannot be the start of a match. If the pattern can match the | 4322 | cannot be the start of a match. If the pattern can match the |
| 4323 | null string, however, we don't need to skip characters; we want | 4323 | null string, however, we don't need to skip characters; we want |
| 4324 | the first null string. */ | 4324 | the first null string. */ |
| 4325 | if (fastmap && startpos < total_size && !bufp->can_be_null) | 4325 | if (fastmap && startpos < total_size && !bufp->can_be_null) |
| 4326 | { | 4326 | { |
| 4327 | register re_char *d; | 4327 | register re_char *d; |
| @@ -4329,7 +4329,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) | |||
| 4329 | 4329 | ||
| 4330 | d = POS_ADDR_VSTRING (startpos); | 4330 | d = POS_ADDR_VSTRING (startpos); |
| 4331 | 4331 | ||
| 4332 | if (range > 0) /* Searching forwards. */ | 4332 | if (range > 0) /* Searching forwards. */ |
| 4333 | { | 4333 | { |
| 4334 | register int lim = 0; | 4334 | register int lim = 0; |
| 4335 | int irange = range; | 4335 | int irange = range; |
| @@ -4403,7 +4403,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) | |||
| 4403 | 4403 | ||
| 4404 | startpos += irange - range; | 4404 | startpos += irange - range; |
| 4405 | } | 4405 | } |
| 4406 | else /* Searching backwards. */ | 4406 | else /* Searching backwards. */ |
| 4407 | { | 4407 | { |
| 4408 | int room = (startpos >= size1 | 4408 | int room = (startpos >= size1 |
| 4409 | ? size2 + size1 - startpos | 4409 | ? size2 + size1 - startpos |
| @@ -4526,7 +4526,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, | |||
| 4526 | } \ | 4526 | } \ |
| 4527 | 4527 | ||
| 4528 | /* Test if at very beginning or at very end of the virtual concatenation | 4528 | /* Test if at very beginning or at very end of the virtual concatenation |
| 4529 | of `string1' and `string2'. If only one string, it's `string2'. */ | 4529 | of `string1' and `string2'. If only one string, it's `string2'. */ |
| 4530 | #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) | 4530 | #define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) |
| 4531 | #define AT_STRINGS_END(d) ((d) == end2) | 4531 | #define AT_STRINGS_END(d) ((d) == end2) |
| 4532 | 4532 | ||
| @@ -4547,7 +4547,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, | |||
| 4547 | 4547 | ||
| 4548 | The DEC Alpha C compiler 3.x generates incorrect code for the | 4548 | The DEC Alpha C compiler 3.x generates incorrect code for the |
| 4549 | test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of | 4549 | test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of |
| 4550 | AT_WORD_BOUNDARY, so this code is disabled. Expanding the | 4550 | AT_WORD_BOUNDARY, so this code is disabled. Expanding the |
| 4551 | macro and introducing temporary variables works around the bug. */ | 4551 | macro and introducing temporary variables works around the bug. */ |
| 4552 | 4552 | ||
| 4553 | #if 0 | 4553 | #if 0 |
| @@ -4749,7 +4749,7 @@ mutually_exclusive_p (bufp, p1, p2) | |||
| 4749 | { | 4749 | { |
| 4750 | /* Now, we are sure that P2 has no range table. | 4750 | /* Now, we are sure that P2 has no range table. |
| 4751 | So, for the size of bitmap in P2, `p2[1]' is | 4751 | So, for the size of bitmap in P2, `p2[1]' is |
| 4752 | enough. But P1 may have range table, so the | 4752 | enough. But P1 may have range table, so the |
| 4753 | size of bitmap table of P1 is extracted by | 4753 | size of bitmap table of P1 is extracted by |
| 4754 | using macro `CHARSET_BITMAP_SIZE'. | 4754 | using macro `CHARSET_BITMAP_SIZE'. |
| 4755 | 4755 | ||
| @@ -4780,7 +4780,7 @@ mutually_exclusive_p (bufp, p1, p2) | |||
| 4780 | { | 4780 | { |
| 4781 | int idx; | 4781 | int idx; |
| 4782 | /* We win if the charset_not inside the loop lists | 4782 | /* We win if the charset_not inside the loop lists |
| 4783 | every character listed in the charset after. */ | 4783 | every character listed in the charset after. */ |
| 4784 | for (idx = 0; idx < (int) p2[1]; idx++) | 4784 | for (idx = 0; idx < (int) p2[1]; idx++) |
| 4785 | if (! (p2[2 + idx] == 0 | 4785 | if (! (p2[2 + idx] == 0 |
| 4786 | || (idx < CHARSET_BITMAP_SIZE (p1) | 4786 | || (idx < CHARSET_BITMAP_SIZE (p1) |
| @@ -4874,7 +4874,7 @@ WEAK_ALIAS (__re_match, re_match) | |||
| 4874 | 4874 | ||
| 4875 | #ifdef emacs | 4875 | #ifdef emacs |
| 4876 | /* In Emacs, this is the string or buffer in which we | 4876 | /* In Emacs, this is the string or buffer in which we |
| 4877 | are matching. It is used for looking up syntax properties. */ | 4877 | are matching. It is used for looking up syntax properties. */ |
| 4878 | Lisp_Object re_match_object; | 4878 | Lisp_Object re_match_object; |
| 4879 | #endif | 4879 | #endif |
| 4880 | 4880 | ||
| @@ -4884,11 +4884,11 @@ Lisp_Object re_match_object; | |||
| 4884 | matching at STOP. | 4884 | matching at STOP. |
| 4885 | 4885 | ||
| 4886 | If REGS is non-null and the `no_sub' field of BUFP is nonzero, we | 4886 | If REGS is non-null and the `no_sub' field of BUFP is nonzero, we |
| 4887 | store offsets for the substring each group matched in REGS. See the | 4887 | store offsets for the substring each group matched in REGS. See the |
| 4888 | documentation for exactly how many groups we fill. | 4888 | documentation for exactly how many groups we fill. |
| 4889 | 4889 | ||
| 4890 | We return -1 if no match, -2 if an internal error (such as the | 4890 | We return -1 if no match, -2 if an internal error (such as the |
| 4891 | failure stack overflowing). Otherwise, we return the length of the | 4891 | failure stack overflowing). Otherwise, we return the length of the |
| 4892 | matched substring. */ | 4892 | matched substring. */ |
| 4893 | 4893 | ||
| 4894 | int | 4894 | int |
| @@ -4920,7 +4920,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4920 | WEAK_ALIAS (__re_match_2, re_match_2) | 4920 | WEAK_ALIAS (__re_match_2, re_match_2) |
| 4921 | 4921 | ||
| 4922 | /* This is a separate function so that we can force an alloca cleanup | 4922 | /* This is a separate function so that we can force an alloca cleanup |
| 4923 | afterwards. */ | 4923 | afterwards. */ |
| 4924 | static int | 4924 | static int |
| 4925 | re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | 4925 | re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) |
| 4926 | struct re_pattern_buffer *bufp; | 4926 | struct re_pattern_buffer *bufp; |
| @@ -4939,7 +4939,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4939 | re_char *end1, *end2; | 4939 | re_char *end1, *end2; |
| 4940 | 4940 | ||
| 4941 | /* Pointers into string1 and string2, just past the last characters in | 4941 | /* Pointers into string1 and string2, just past the last characters in |
| 4942 | each to consider matching. */ | 4942 | each to consider matching. */ |
| 4943 | re_char *end_match_1, *end_match_2; | 4943 | re_char *end_match_1, *end_match_2; |
| 4944 | 4944 | ||
| 4945 | /* Where we are in the data, and the end of the current string. */ | 4945 | /* Where we are in the data, and the end of the current string. */ |
| @@ -4955,10 +4955,10 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4955 | re_char *p = bufp->buffer; | 4955 | re_char *p = bufp->buffer; |
| 4956 | re_char *pend = p + bufp->used; | 4956 | re_char *pend = p + bufp->used; |
| 4957 | 4957 | ||
| 4958 | /* We use this to map every character in the string. */ | 4958 | /* We use this to map every character in the string. */ |
| 4959 | RE_TRANSLATE_TYPE translate = bufp->translate; | 4959 | RE_TRANSLATE_TYPE translate = bufp->translate; |
| 4960 | 4960 | ||
| 4961 | /* Nonzero if we have to concern multibyte character. */ | 4961 | /* Nonzero if we have to concern multibyte character.*/ |
| 4962 | const boolean multibyte = RE_MULTIBYTE_P (bufp); | 4962 | const boolean multibyte = RE_MULTIBYTE_P (bufp); |
| 4963 | 4963 | ||
| 4964 | /* Failure point stack. Each place that can handle a failure further | 4964 | /* Failure point stack. Each place that can handle a failure further |
| @@ -4967,8 +4967,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4967 | the subexpressions we're currently inside, plus the number of such | 4967 | the subexpressions we're currently inside, plus the number of such |
| 4968 | registers, and, finally, two char *'s. The first char * is where | 4968 | registers, and, finally, two char *'s. The first char * is where |
| 4969 | to resume scanning the pattern; the second one is where to resume | 4969 | to resume scanning the pattern; the second one is where to resume |
| 4970 | scanning the strings. */ | 4970 | scanning the strings. */ |
| 4971 | #ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ | 4971 | #ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ |
| 4972 | fail_stack_type fail_stack; | 4972 | fail_stack_type fail_stack; |
| 4973 | #endif | 4973 | #endif |
| 4974 | #ifdef DEBUG | 4974 | #ifdef DEBUG |
| @@ -4982,7 +4982,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 4982 | #endif | 4982 | #endif |
| 4983 | 4983 | ||
| 4984 | /* We fill all the registers internally, independent of what we | 4984 | /* We fill all the registers internally, independent of what we |
| 4985 | return, for use in backreferences. The number here includes | 4985 | return, for use in backreferences. The number here includes |
| 4986 | an element for register zero. */ | 4986 | an element for register zero. */ |
| 4987 | size_t num_regs = bufp->re_nsub + 1; | 4987 | size_t num_regs = bufp->re_nsub + 1; |
| 4988 | 4988 | ||
| @@ -5008,7 +5008,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5008 | 5008 | ||
| 5009 | /* Logically, this is `best_regend[0]'. But we don't want to have to | 5009 | /* Logically, this is `best_regend[0]'. But we don't want to have to |
| 5010 | allocate space for that if we're not allocating space for anything | 5010 | allocate space for that if we're not allocating space for anything |
| 5011 | else (see below). Also, we never need info about register 0 for | 5011 | else (see below). Also, we never need info about register 0 for |
| 5012 | any of the other register vectors, and it seems rather a kludge to | 5012 | any of the other register vectors, and it seems rather a kludge to |
| 5013 | treat `best_regend' differently than the rest. So we keep track of | 5013 | treat `best_regend' differently than the rest. So we keep track of |
| 5014 | the end of the best match so far in a separate variable. We | 5014 | the end of the best match so far in a separate variable. We |
| @@ -5066,7 +5066,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5066 | regstart[reg] = regend[reg] = NULL; | 5066 | regstart[reg] = regend[reg] = NULL; |
| 5067 | 5067 | ||
| 5068 | /* We move `string1' into `string2' if the latter's empty -- but not if | 5068 | /* We move `string1' into `string2' if the latter's empty -- but not if |
| 5069 | `string1' is null. */ | 5069 | `string1' is null. */ |
| 5070 | if (size2 == 0 && string1 != NULL) | 5070 | if (size2 == 0 && string1 != NULL) |
| 5071 | { | 5071 | { |
| 5072 | string2 = string1; | 5072 | string2 = string1; |
| @@ -5123,7 +5123,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5123 | DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); | 5123 | DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); |
| 5124 | DEBUG_PRINT1 ("'\n"); | 5124 | DEBUG_PRINT1 ("'\n"); |
| 5125 | 5125 | ||
| 5126 | /* This loops over pattern commands. It exits by returning from the | 5126 | /* This loops over pattern commands. It exits by returning from the |
| 5127 | function if the match is complete, or it drops through if the match | 5127 | function if the match is complete, or it drops through if the match |
| 5128 | fails at this starting point in the input data. */ | 5128 | fails at this starting point in the input data. */ |
| 5129 | for (;;) | 5129 | for (;;) |
| @@ -5146,7 +5146,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5146 | boolean best_match_p; | 5146 | boolean best_match_p; |
| 5147 | 5147 | ||
| 5148 | /* AIX compiler got confused when this was combined | 5148 | /* AIX compiler got confused when this was combined |
| 5149 | with the previous declaration. */ | 5149 | with the previous declaration. */ |
| 5150 | if (same_str_p) | 5150 | if (same_str_p) |
| 5151 | best_match_p = d > match_end; | 5151 | best_match_p = d > match_end; |
| 5152 | else | 5152 | else |
| @@ -5184,7 +5184,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5184 | end_match_1' while the restored d is in string2. | 5184 | end_match_1' while the restored d is in string2. |
| 5185 | For example, the pattern `x.*y.*z' against the | 5185 | For example, the pattern `x.*y.*z' against the |
| 5186 | strings `x-' and `y-z-', if the two strings are | 5186 | strings `x-' and `y-z-', if the two strings are |
| 5187 | not consecutive in memory. */ | 5187 | not consecutive in memory. */ |
| 5188 | DEBUG_PRINT1 ("Restoring best registers.\n"); | 5188 | DEBUG_PRINT1 ("Restoring best registers.\n"); |
| 5189 | 5189 | ||
| 5190 | d = match_end; | 5190 | d = match_end; |
| @@ -5207,7 +5207,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5207 | { | 5207 | { |
| 5208 | /* Have the register data arrays been allocated? */ | 5208 | /* Have the register data arrays been allocated? */ |
| 5209 | if (bufp->regs_allocated == REGS_UNALLOCATED) | 5209 | if (bufp->regs_allocated == REGS_UNALLOCATED) |
| 5210 | { /* No. So allocate them with malloc. We need one | 5210 | { /* No. So allocate them with malloc. We need one |
| 5211 | extra element beyond `num_regs' for the `-1' marker | 5211 | extra element beyond `num_regs' for the `-1' marker |
| 5212 | GNU code uses. */ | 5212 | GNU code uses. */ |
| 5213 | regs->num_regs = MAX (RE_NREGS, num_regs + 1); | 5213 | regs->num_regs = MAX (RE_NREGS, num_regs + 1); |
| @@ -5239,7 +5239,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5239 | else | 5239 | else |
| 5240 | { | 5240 | { |
| 5241 | /* These braces fend off a "empty body in an else-statement" | 5241 | /* These braces fend off a "empty body in an else-statement" |
| 5242 | warning under GCC when assert expands to nothing. */ | 5242 | warning under GCC when assert expands to nothing. */ |
| 5243 | assert (bufp->regs_allocated == REGS_FIXED); | 5243 | assert (bufp->regs_allocated == REGS_FIXED); |
| 5244 | } | 5244 | } |
| 5245 | 5245 | ||
| @@ -5271,7 +5271,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5271 | were in the pattern, set the extra elements to -1. If | 5271 | were in the pattern, set the extra elements to -1. If |
| 5272 | we (re)allocated the registers, this is the case, | 5272 | we (re)allocated the registers, this is the case, |
| 5273 | because we always allocate enough to have at least one | 5273 | because we always allocate enough to have at least one |
| 5274 | -1 at the end. */ | 5274 | -1 at the end. */ |
| 5275 | for (reg = num_regs; reg < regs->num_regs; reg++) | 5275 | for (reg = num_regs; reg < regs->num_regs; reg++) |
| 5276 | regs->start[reg] = regs->end[reg] = -1; | 5276 | regs->start[reg] = regs->end[reg] = -1; |
| 5277 | } /* regs && !bufp->no_sub */ | 5277 | } /* regs && !bufp->no_sub */ |
| @@ -5289,7 +5289,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5289 | return mcnt; | 5289 | return mcnt; |
| 5290 | } | 5290 | } |
| 5291 | 5291 | ||
| 5292 | /* Otherwise match next pattern command. */ | 5292 | /* Otherwise match next pattern command. */ |
| 5293 | switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) | 5293 | switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) |
| 5294 | { | 5294 | { |
| 5295 | /* Ignore these. Used to ignore the n of succeed_n's which | 5295 | /* Ignore these. Used to ignore the n of succeed_n's which |
| @@ -5302,9 +5302,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5302 | DEBUG_PRINT1 ("EXECUTING succeed.\n"); | 5302 | DEBUG_PRINT1 ("EXECUTING succeed.\n"); |
| 5303 | goto succeed_label; | 5303 | goto succeed_label; |
| 5304 | 5304 | ||
| 5305 | /* Match the next n pattern characters exactly. The following | 5305 | /* Match the next n pattern characters exactly. The following |
| 5306 | byte in the pattern defines n, and the n bytes after that | 5306 | byte in the pattern defines n, and the n bytes after that |
| 5307 | are the characters to match. */ | 5307 | are the characters to match. */ |
| 5308 | case exactn: | 5308 | case exactn: |
| 5309 | mcnt = *p++; | 5309 | mcnt = *p++; |
| 5310 | DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); | 5310 | DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); |
| @@ -5468,7 +5468,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5468 | /* The beginning of a group is represented by start_memory. | 5468 | /* The beginning of a group is represented by start_memory. |
| 5469 | The argument is the register number. The text | 5469 | The argument is the register number. The text |
| 5470 | matched within the group is recorded (in the internal | 5470 | matched within the group is recorded (in the internal |
| 5471 | registers data structure) under the register number. */ | 5471 | registers data structure) under the register number. */ |
| 5472 | case start_memory: | 5472 | case start_memory: |
| 5473 | DEBUG_PRINT2 ("EXECUTING start_memory %d:\n", *p); | 5473 | DEBUG_PRINT2 ("EXECUTING start_memory %d:\n", *p); |
| 5474 | 5474 | ||
| @@ -5517,14 +5517,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5517 | case duplicate: | 5517 | case duplicate: |
| 5518 | { | 5518 | { |
| 5519 | register re_char *d2, *dend2; | 5519 | register re_char *d2, *dend2; |
| 5520 | int regno = *p++; /* Get which register to match against. */ | 5520 | int regno = *p++; /* Get which register to match against. */ |
| 5521 | DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); | 5521 | DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); |
| 5522 | 5522 | ||
| 5523 | /* Can't back reference a group which we've never matched. */ | 5523 | /* Can't back reference a group which we've never matched. */ |
| 5524 | if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) | 5524 | if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) |
| 5525 | goto fail; | 5525 | goto fail; |
| 5526 | 5526 | ||
| 5527 | /* Where in input to try to start matching. */ | 5527 | /* Where in input to try to start matching. */ |
| 5528 | d2 = regstart[regno]; | 5528 | d2 = regstart[regno]; |
| 5529 | 5529 | ||
| 5530 | /* Remember the start point to rollback upon failure. */ | 5530 | /* Remember the start point to rollback upon failure. */ |
| @@ -5637,7 +5637,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5637 | pushes NULL as the value for the string on the stack. Then | 5637 | pushes NULL as the value for the string on the stack. Then |
| 5638 | `POP_FAILURE_POINT' will keep the current value for the | 5638 | `POP_FAILURE_POINT' will keep the current value for the |
| 5639 | string, instead of restoring it. To see why, consider | 5639 | string, instead of restoring it. To see why, consider |
| 5640 | matching `foo\nbar' against `.*\n'. The .* matches the foo; | 5640 | matching `foo\nbar' against `.*\n'. The .* matches the foo; |
| 5641 | then the . fails against the \n. But the next thing we want | 5641 | then the . fails against the \n. But the next thing we want |
| 5642 | to do is match the \n against the \n; if we restored the | 5642 | to do is match the \n against the \n; if we restored the |
| 5643 | string value, we would be back at the foo. | 5643 | string value, we would be back at the foo. |
| @@ -5782,7 +5782,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5782 | IMMEDIATE_QUIT_CHECK; | 5782 | IMMEDIATE_QUIT_CHECK; |
| 5783 | EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ | 5783 | EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ |
| 5784 | DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); | 5784 | DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); |
| 5785 | p += mcnt; /* Do the jump. */ | 5785 | p += mcnt; /* Do the jump. */ |
| 5786 | DEBUG_PRINT2 ("(to %p).\n", p); | 5786 | DEBUG_PRINT2 ("(to %p).\n", p); |
| 5787 | break; | 5787 | break; |
| 5788 | 5788 | ||
| @@ -5875,7 +5875,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5875 | if (/* Case 2: Only one of S1 and S2 is Sword. */ | 5875 | if (/* Case 2: Only one of S1 and S2 is Sword. */ |
| 5876 | ((s1 == Sword) != (s2 == Sword)) | 5876 | ((s1 == Sword) != (s2 == Sword)) |
| 5877 | /* Case 3: Both of S1 and S2 are Sword, and macro | 5877 | /* Case 3: Both of S1 and S2 are Sword, and macro |
| 5878 | WORD_BOUNDARY_P (C1, C2) returns nonzero. */ | 5878 | WORD_BOUNDARY_P (C1, C2) returns nonzero. */ |
| 5879 | || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) | 5879 | || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) |
| 5880 | not = !not; | 5880 | not = !not; |
| 5881 | } | 5881 | } |
| @@ -5889,7 +5889,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5889 | 5889 | ||
| 5890 | /* We FAIL in one of the following cases: */ | 5890 | /* We FAIL in one of the following cases: */ |
| 5891 | 5891 | ||
| 5892 | /* Case 1: D is at the end of string. */ | 5892 | /* Case 1: D is at the end of string. */ |
| 5893 | if (AT_STRINGS_END (d)) | 5893 | if (AT_STRINGS_END (d)) |
| 5894 | goto fail; | 5894 | goto fail; |
| 5895 | else | 5895 | else |
| @@ -5921,7 +5921,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5921 | s1 = SYNTAX (c1); | 5921 | s1 = SYNTAX (c1); |
| 5922 | 5922 | ||
| 5923 | /* ... and S1 is Sword, and WORD_BOUNDARY_P (C1, C2) | 5923 | /* ... and S1 is Sword, and WORD_BOUNDARY_P (C1, C2) |
| 5924 | returns 0. */ | 5924 | returns 0. */ |
| 5925 | if ((s1 == Sword) && !WORD_BOUNDARY_P (c1, c2)) | 5925 | if ((s1 == Sword) && !WORD_BOUNDARY_P (c1, c2)) |
| 5926 | goto fail; | 5926 | goto fail; |
| 5927 | } | 5927 | } |
| @@ -5965,7 +5965,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5965 | s2 = SYNTAX (c2); | 5965 | s2 = SYNTAX (c2); |
| 5966 | 5966 | ||
| 5967 | /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) | 5967 | /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) |
| 5968 | returns 0. */ | 5968 | returns 0. */ |
| 5969 | if ((s2 == Sword) && !WORD_BOUNDARY_P (c1, c2)) | 5969 | if ((s2 == Sword) && !WORD_BOUNDARY_P (c1, c2)) |
| 5970 | goto fail; | 5970 | goto fail; |
| 5971 | } | 5971 | } |
| @@ -5977,7 +5977,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5977 | 5977 | ||
| 5978 | /* We FAIL in one of the following cases: */ | 5978 | /* We FAIL in one of the following cases: */ |
| 5979 | 5979 | ||
| 5980 | /* Case 1: D is at the end of string. */ | 5980 | /* Case 1: D is at the end of string. */ |
| 5981 | if (AT_STRINGS_END (d)) | 5981 | if (AT_STRINGS_END (d)) |
| 5982 | goto fail; | 5982 | goto fail; |
| 5983 | else | 5983 | else |
| @@ -5994,7 +5994,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) | |||
| 5994 | PREFETCH (); | 5994 | PREFETCH (); |
| 5995 | c2 = RE_STRING_CHAR (d, dend - d); | 5995 | c2 = RE_STRING_CHAR (d, dend - d); |
| 5996 | s2 = SYNTAX (c2); | 5996 | s2 = SYNTAX (c2); |
| 5997 | 5997 | ||
| 5998 | /* Case 2: S2 is neither Sword nor Ssymbol. */ | 5998 | /* Case 2: S2 is neither Sword nor Ssymbol. */ |
| 5999 | if (s2 != Sword && s2 != Ssymbol) | 5999 | if (s2 != Sword && s2 != Ssymbol) |
| 6000 | goto fail; | 6000 | goto fail; |