diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-08-13 00:47:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 00:47:51 +0200 |
commit | ee5cc88a73401e4352660862631117c8319950f7 (patch) | |
tree | a9166f6ea1abf0262694ca06f04b27f7f1829c47 /src/nvim/regexp_nfa.c | |
parent | 97331cab675bee00337aed983e9a3e302e28a619 (diff) | |
parent | a4c957bab7270e0631f147f572b8d905d9c7acda (diff) | |
download | rneovim-ee5cc88a73401e4352660862631117c8319950f7.tar.gz rneovim-ee5cc88a73401e4352660862631117c8319950f7.tar.bz2 rneovim-ee5cc88a73401e4352660862631117c8319950f7.zip |
Merge #8851 from janlazo/vim-8.0.1227
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r-- | src/nvim/regexp_nfa.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 3b905f5efc..29191c14a8 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -2131,7 +2131,6 @@ static int nfa_regconcat(void) */ static int nfa_regbranch(void) { - int ch; int old_post_pos; old_post_pos = (int)(post_ptr - post_start); @@ -2140,10 +2139,13 @@ static int nfa_regbranch(void) if (nfa_regconcat() == FAIL) return FAIL; - ch = peekchr(); - /* Try next concats */ - while (ch == Magic('&')) { + // Try next concats + while (peekchr() == Magic('&')) { skipchr(); + // if concat is empty do emit a node + if (old_post_pos == (int)(post_ptr - post_start)) { + EMIT(NFA_EMPTY); + } EMIT(NFA_NOPEN); EMIT(NFA_PREV_ATOM_NO_WIDTH); old_post_pos = (int)(post_ptr - post_start); @@ -2153,7 +2155,6 @@ static int nfa_regbranch(void) if (old_post_pos == (int)(post_ptr - post_start)) EMIT(NFA_EMPTY); EMIT(NFA_CONCAT); - ch = peekchr(); } /* if a branch is empty, emit one node for it */ |