Mercurial > vim
comparison src/regexp_nfa.c @ 5895:b871734bf54e v7.4.290
updated for version 7.4.290
Problem: A non-greedy match followed by a branch is too greedy. (Ingo
Karkat)
Solution: Add NFA_MATCH when it is already in the state list if the position
differs.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 13 May 2014 16:44:29 +0200 |
parents | 99374096a76b |
children | 10fc95f48546 |
comparison
equal
deleted
inserted
replaced
5894:ff44a3a57ba0 | 5895:b871734bf54e |
---|---|
4322 default: | 4322 default: |
4323 if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) | 4323 if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) |
4324 { | 4324 { |
4325 /* This state is already in the list, don't add it again, | 4325 /* This state is already in the list, don't add it again, |
4326 * unless it is an MOPEN that is used for a backreference or | 4326 * unless it is an MOPEN that is used for a backreference or |
4327 * when there is a PIM. */ | 4327 * when there is a PIM. For NFA_MATCH check the position, |
4328 if (!nfa_has_backref && pim == NULL && !l->has_pim) | 4328 * lower position is preferred. */ |
4329 if (!nfa_has_backref && pim == NULL && !l->has_pim | |
4330 && state->c != NFA_MATCH) | |
4329 { | 4331 { |
4330 skip_add: | 4332 skip_add: |
4331 #ifdef ENABLE_LOG | 4333 #ifdef ENABLE_LOG |
4332 nfa_set_code(state->c); | 4334 nfa_set_code(state->c); |
4333 fprintf(log_fd, "> Not adding state %d to list %d. char %d: %s\n", | 4335 fprintf(log_fd, "> Not adding state %d to list %d. char %d: %s\n", |