Mercurial > vim
comparison src/regexp.c @ 1209:070f2ac50cf8
updated for version 7.1b
author | vimboss |
---|---|
date | Thu, 10 May 2007 18:00:30 +0000 |
parents | e1dc2698121c |
children | 6d421b3c485b |
comparison
equal
deleted
inserted
replaced
1208:e9a34b503432 | 1209:070f2ac50cf8 |
---|---|
126 * | | | +-----+ | | 126 * | | | +-----+ | |
127 * | | +----------------+ | | 127 * | | +----------------+ | |
128 * | +---------------------------+ | | 128 * | +---------------------------+ | |
129 * +------------------------------------------------------+ | 129 * +------------------------------------------------------+ |
130 * | 130 * |
131 * They all start with a BRANCH for "\|" alternaties, even when there is only | 131 * They all start with a BRANCH for "\|" alternatives, even when there is only |
132 * one alternative. | 132 * one alternative. |
133 */ | 133 */ |
134 | 134 |
135 /* | 135 /* |
136 * The opcodes are: | 136 * The opcodes are: |
3108 static char_u *reg_tofree; | 3108 static char_u *reg_tofree; |
3109 static unsigned reg_tofreelen; | 3109 static unsigned reg_tofreelen; |
3110 | 3110 |
3111 /* | 3111 /* |
3112 * These variables are set when executing a regexp to speed up the execution. | 3112 * These variables are set when executing a regexp to speed up the execution. |
3113 * Which ones are set depends on whethere a single-line or multi-line match is | 3113 * Which ones are set depends on whether a single-line or multi-line match is |
3114 * done: | 3114 * done: |
3115 * single-line multi-line | 3115 * single-line multi-line |
3116 * reg_match ®match_T NULL | 3116 * reg_match ®match_T NULL |
3117 * reg_mmatch NULL ®mmatch_T | 3117 * reg_mmatch NULL ®mmatch_T |
3118 * reg_startp reg_match->startp <invalid> | 3118 * reg_startp reg_match->startp <invalid> |
5036 | 5036 |
5037 /* save the position after the found match for next */ | 5037 /* save the position after the found match for next */ |
5038 reg_save(&(((regbehind_T *)rp) - 1)->save_after, &backpos); | 5038 reg_save(&(((regbehind_T *)rp) - 1)->save_after, &backpos); |
5039 | 5039 |
5040 /* start looking for a match with operand at the current | 5040 /* start looking for a match with operand at the current |
5041 * postion. Go back one character until we find the | 5041 * position. Go back one character until we find the |
5042 * result, hitting the start of the line or the previous | 5042 * result, hitting the start of the line or the previous |
5043 * line (for multi-line matching). | 5043 * line (for multi-line matching). |
5044 * Set behind_pos to where the match should end, BHPOS | 5044 * Set behind_pos to where the match should end, BHPOS |
5045 * will match it. Save the current value. */ | 5045 * will match it. Save the current value. */ |
5046 (((regbehind_T *)rp) - 1)->save_behind = behind_pos; | 5046 (((regbehind_T *)rp) - 1)->save_behind = behind_pos; |
6621 if (tmpsub != NULL) | 6621 if (tmpsub != NULL) |
6622 { | 6622 { |
6623 /* copy prefix */ | 6623 /* copy prefix */ |
6624 len = (int)(p - newsub); /* not including ~ */ | 6624 len = (int)(p - newsub); /* not including ~ */ |
6625 mch_memmove(tmpsub, newsub, (size_t)len); | 6625 mch_memmove(tmpsub, newsub, (size_t)len); |
6626 /* interpretate tilde */ | 6626 /* interpret tilde */ |
6627 mch_memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen); | 6627 mch_memmove(tmpsub + len, reg_prev_sub, (size_t)prevlen); |
6628 /* copy postfix */ | 6628 /* copy postfix */ |
6629 if (!magic) | 6629 if (!magic) |
6630 ++p; /* back off \ */ | 6630 ++p; /* back off \ */ |
6631 STRCPY(tmpsub + len + prevlen, p + 1); | 6631 STRCPY(tmpsub + len + prevlen, p + 1); |
6860 } | 6860 } |
6861 if (no < 0) /* Ordinary character. */ | 6861 if (no < 0) /* Ordinary character. */ |
6862 { | 6862 { |
6863 if (c == K_SPECIAL && src[0] != NUL && src[1] != NUL) | 6863 if (c == K_SPECIAL && src[0] != NUL && src[1] != NUL) |
6864 { | 6864 { |
6865 /* Copy a specialy key as-is. */ | 6865 /* Copy a special key as-is. */ |
6866 if (copy) | 6866 if (copy) |
6867 { | 6867 { |
6868 *dst++ = c; | 6868 *dst++ = c; |
6869 *dst++ = *src++; | 6869 *dst++ = *src++; |
6870 *dst++ = *src++; | 6870 *dst++ = *src++; |
7044 return (int)((dst - dest) + 1); | 7044 return (int)((dst - dest) + 1); |
7045 } | 7045 } |
7046 | 7046 |
7047 #ifdef FEAT_EVAL | 7047 #ifdef FEAT_EVAL |
7048 /* | 7048 /* |
7049 * Used for the submatch() function: get the string from tne n'th submatch in | 7049 * Used for the submatch() function: get the string from the n'th submatch in |
7050 * allocated memory. | 7050 * allocated memory. |
7051 * Returns NULL when not in a ":s" command and for a non-existing submatch. | 7051 * Returns NULL when not in a ":s" command and for a non-existing submatch. |
7052 */ | 7052 */ |
7053 char_u * | 7053 char_u * |
7054 reg_submatch(no) | 7054 reg_submatch(no) |