comparison src/regex.c @ 2639:cd00e5eeb22a

[xemacs-hg @ 2005-03-09 04:59:25 by stephent] small regex doc patch <876501fmab.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 09 Mar 2005 04:59:31 +0000
parents 3d8143fc88e1
children a034c4bd7877
comparison
equal deleted inserted replaced
2638:94aad03d0e1e 2639:cd00e5eeb22a
5176 regs->end[0] = (MATCHING_IN_FIRST_STRING 5176 regs->end[0] = (MATCHING_IN_FIRST_STRING
5177 ? ((regoff_t) (d - string1)) 5177 ? ((regoff_t) (d - string1))
5178 : ((regoff_t) (d - string2 + size1))); 5178 : ((regoff_t) (d - string2 + size1)));
5179 } 5179 }
5180 5180
5181 /* Go through the first `min (num_regs, regs->num_regs)' 5181 /* Map over the NUM_NONSHY_REGS non-shy internal registers.
5182 registers, since that is all we initialized. */ 5182 Copy each into the corresponding external register.
5183 MCNT indexes external registers. */
5183 for (mcnt = 1; mcnt < MIN (num_nonshy_regs, regs->num_regs); 5184 for (mcnt = 1; mcnt < MIN (num_nonshy_regs, regs->num_regs);
5184 mcnt++) 5185 mcnt++)
5185 { 5186 {
5186 int internal_reg = bufp->external_to_internal_register[mcnt]; 5187 int internal_reg = bufp->external_to_internal_register[mcnt];
5187 if (REG_UNSET (regstart[internal_reg]) || 5188 if (REG_UNSET (regstart[internal_reg]) ||
5196 } 5197 }
5197 } 5198 }
5198 } /* regs && !bufp->no_sub */ 5199 } /* regs && !bufp->no_sub */
5199 5200
5200 /* If we have regs and the regs structure has more elements than 5201 /* If we have regs and the regs structure has more elements than
5201 were in the pattern, set the extra elements to -1. If we 5202 were in the pattern, set the extra elements starting with
5202 (re)allocated the registers, this is the case, because we 5203 NUM_NONSHY_REGS to -1. If we (re)allocated the registers,
5203 always allocate enough to have at least one -1 at the end. 5204 this is the case, because we always allocate enough to have
5205 at least one -1 at the end.
5204 5206
5205 We do this even when no_sub is set because some applications 5207 We do this even when no_sub is set because some applications
5206 (XEmacs) reuse register structures which may contain stale 5208 (XEmacs) reuse register structures which may contain stale
5207 information, and permit attempts to access those registers. 5209 information, and permit attempts to access those registers.
5208 5210
5404 5406
5405 /* Find out if this group can match the empty string. */ 5407 /* Find out if this group can match the empty string. */
5406 p1 = p; /* To send to group_match_null_string_p. */ 5408 p1 = p; /* To send to group_match_null_string_p. */
5407 5409
5408 if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) 5410 if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
5409 REG_MATCH_NULL_STRING_P (reg_info[*p]) 5411 REG_MATCH_NULL_STRING_P (reg_info[*p])
5410 = group_match_null_string_p (&p1, pend, reg_info); 5412 = group_match_null_string_p (&p1, pend, reg_info);
5413
5414 DEBUG_PRINT2 (" group CAN%s match null string\n",
5415 REG_MATCH_NULL_STRING_P (reg_info[*p]) ? "NOT" : "");
5411 5416
5412 /* Save the position in the string where we were the last time 5417 /* Save the position in the string where we were the last time
5413 we were at this open-group operator in case the group is 5418 we were at this open-group operator in case the group is
5414 operated upon by a repetition operator, e.g., with `(a*)*b' 5419 operated upon by a repetition operator, e.g., with `(a*)*b'
5415 against `ab'; then we want to ignore where we are now in 5420 against `ab'; then we want to ignore where we are now in