comparison src/regex.c @ 10021:9203331b118a

(re_compile_fastmap): Really treat `succeed' like end.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Nov 1994 10:37:38 +0000
parents 659346eafd79
children a53798af4794
comparison
equal deleted inserted replaced
10020:c41ce96785a8 10021:9203331b118a
2780 INIT_FAIL_STACK (); 2780 INIT_FAIL_STACK ();
2781 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ 2781 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
2782 bufp->fastmap_accurate = 1; /* It will be when we're done. */ 2782 bufp->fastmap_accurate = 1; /* It will be when we're done. */
2783 bufp->can_be_null = 0; 2783 bufp->can_be_null = 0;
2784 2784
2785 while (p != pend || !FAIL_STACK_EMPTY ()) 2785 while (1)
2786 { 2786 {
2787 if (p == pend || *p == succeed) 2787 if (p == pend || *p == succeed)
2788 { 2788 {
2789 bufp->can_be_null |= path_can_be_null; 2789 /* We have reached the (effective) end of pattern. */
2790 2790 if (!FAIL_STACK_EMPTY ())
2791 /* Reset for next path. */ 2791 {
2792 path_can_be_null = true; 2792 bufp->can_be_null |= path_can_be_null;
2793 2793
2794 p = fail_stack.stack[--fail_stack.avail]; 2794 /* Reset for next path. */
2795 path_can_be_null = true;
2796
2797 p = fail_stack.stack[--fail_stack.avail];
2798 }
2799 else
2800 break;
2795 } 2801 }
2796 2802
2797 /* We should never be about to go beyond the end of the pattern. */ 2803 /* We should never be about to go beyond the end of the pattern. */
2798 assert (p < pend); 2804 assert (p < pend);
2799 2805