--- M:/projects/python_working/Modules/_sre.c.bak60 Sat Sep 20 20:52:23 2008 +++ M:/projects/python_working/Modules/_sre.c Sun Sep 21 20:47:44 2008 @@ -580,10 +580,11 @@ } typedef struct SRE_CONTEXT { + SRE_CHAR* text_beginning; // The true start of the text. SRE_CHAR* text_ptr; - SRE_CHAR* text_start; - SRE_CHAR* text_end; - SRE_CHAR* final_linebreak; + SRE_CHAR* text_start; // The start of the text to search/match. + SRE_CHAR* text_end; // The end of the text to search/match; also the true end, or treated as such. + SRE_CHAR* final_linebreak; // The position of the final linebreak if it's final, otherwise NULL. SRE_CODE* pattern_ptr; int* repeat_counter; SRE_CHAR** repeat_start; @@ -718,19 +719,19 @@ } LOCAL(int) SRE_AT_BOUNDARY(SRE_CONTEXT* context) { - int before = context->text_ptr > context->text_start && SRE_IS_WORD(context->text_ptr[-1]); + int before = context->text_ptr > context->text_beginning && SRE_IS_WORD(context->text_ptr[-1]); int after = context->text_ptr < context->text_end && SRE_IS_WORD(context->text_ptr[0]); return before != after; } LOCAL(int) SRE_LOC_AT_BOUNDARY(SRE_CONTEXT* context) { - int before = context->text_ptr > context->text_start && SRE_LOC_IS_WORD(context->text_ptr[-1]); + int before = context->text_ptr > context->text_beginning && SRE_LOC_IS_WORD(context->text_ptr[-1]); int after = context->text_ptr < context->text_end && SRE_LOC_IS_WORD(context->text_ptr[0]); return before != after; } LOCAL(int) SRE_UNI_AT_BOUNDARY(SRE_CONTEXT* context) { - int before = context->text_ptr > context->text_start && SRE_UNI_IS_WORD(context->text_ptr[-1]); + int before = context->text_ptr > context->text_beginning && SRE_UNI_IS_WORD(context->text_ptr[-1]); int after = context->text_ptr < context->text_end && SRE_UNI_IS_WORD(context->text_ptr[0]); return before != after; } @@ -852,7 +853,8 @@ int result; context.text_ptr = state->ptr; - context.text_start = (SRE_CHAR *)state->beginning; + context.text_beginning = (SRE_CHAR *)state->beginning; + context.text_start = (SRE_CHAR *)state->start; context.text_end = (SRE_CHAR *)state->end; context.pattern_ptr = pattern_ptr; context.repeat_counter = state->repeat_counter; @@ -863,7 +865,7 @@ context.mark_count = state->mark_count; // Point to the final newline if it's the final character. - context.final_linebreak = context.text_start < context.text_end && SRE_IS_LINEBREAK(context.text_end[-1]) ? context.text_end - 1 : NULL; + context.final_linebreak = context.text_beginning < context.text_end && SRE_IS_LINEBREAK(context.text_end[-1]) ? context.text_end - 1 : NULL; TRACE(("|%p|%p|ENTER\n", context.pattern_ptr, context.text_ptr)); result = SRE_SAVE_BACKTRACK(&context, SRE_OP_FAILURE, NULL, -1); @@ -1682,7 +1684,7 @@ { // Boundary between word and non-word. // - int before = context.text_ptr > context.text_start && SRE_LOC_IS_WORD(context.text_ptr[-1]); + int before = context.text_ptr > context.text_beginning && SRE_LOC_IS_WORD(context.text_ptr[-1]); int after = context.text_ptr < context.text_end && SRE_LOC_IS_WORD(context.text_ptr[0]); TRACE(("|%p|%p|LOC_BOUNDARY\n", context.pattern_ptr, context.text_ptr)); if (before == after) @@ -1693,7 +1695,7 @@ { // Not boundary between word and non-word. // - int before = context.text_ptr > context.text_start && SRE_LOC_IS_WORD(context.text_ptr[-1]); + int before = context.text_ptr > context.text_beginning && SRE_LOC_IS_WORD(context.text_ptr[-1]); int after = context.text_ptr < context.text_end && SRE_LOC_IS_WORD(context.text_ptr[0]); TRACE(("|%p|%p|LOC_NOT_BOUNDARY\n", context.pattern_ptr, context.text_ptr)); if (before != after) @@ -1781,7 +1783,7 @@ { // Not boundary between word and non-word. // - int before = context.text_ptr > context.text_start && SRE_IS_WORD(context.text_ptr[-1]); + int before = context.text_ptr > context.text_beginning && SRE_IS_WORD(context.text_ptr[-1]); int after = context.text_ptr < context.text_end && SRE_IS_WORD(context.text_ptr[0]); TRACE(("|%p|%p|NOT_BOUNDARY\n", context.pattern_ptr, context.text_ptr)); if (before != after) @@ -4165,14 +4167,14 @@ // Start of line. // TRACE(("|%p|%p|START_OF_LINE\n", context.pattern_ptr, context.text_ptr)); - if (context.text_ptr > context.text_start && !SRE_IS_LINEBREAK(context.text_ptr[-1])) + if (context.text_ptr > context.text_beginning && !SRE_IS_LINEBREAK(context.text_ptr[-1])) goto backtrack; break; case SRE_OP_START_OF_STRING: // Start of string. // TRACE(("|%p|%p|START_OF_STRING\n", context.pattern_ptr, context.text_ptr)); - if (context.text_ptr > context.text_start) + if (context.text_ptr > context.text_beginning) goto backtrack; break; case SRE_OP_SUCCESS: @@ -4198,7 +4200,7 @@ { // Boundary between word and non-word. // - int before = context.text_ptr > context.text_start && SRE_UNI_IS_WORD(context.text_ptr[-1]); + int before = context.text_ptr > context.text_beginning && SRE_UNI_IS_WORD(context.text_ptr[-1]); int after = context.text_ptr < context.text_end && SRE_UNI_IS_WORD(context.text_ptr[0]); TRACE(("|%p|%p|UNI_BOUNDARY\n", context.pattern_ptr, context.text_ptr)); if (before == after) @@ -4225,7 +4227,7 @@ { // Not boundary between word and non-word. // - int before = context.text_ptr > context.text_start && SRE_UNI_IS_WORD(context.text_ptr[-1]); + int before = context.text_ptr > context.text_beginning && SRE_UNI_IS_WORD(context.text_ptr[-1]); int after = context.text_ptr < context.text_end && SRE_UNI_IS_WORD(context.text_ptr[0]); TRACE(("|%p|%p|UNI_NOT_BOUNDARY\n", context.pattern_ptr, context.text_ptr)); if (before != after)