diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 16:32:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 16:32:58 +0800 |
commit | 1bcddd5b53a0993789df7ec91fecea47dcfcccfa (patch) | |
tree | 774c6d91442f0035ac7e03729be79a53fcfc257d /src/nvim/regexp_nfa.c | |
parent | 45a3e7f6694c66c3577a47c7ff1fb8bfcc2ab7be (diff) | |
parent | e33ffab1a776518dbf59ba5fe82453fa019569eb (diff) | |
download | rneovim-1bcddd5b53a0993789df7ec91fecea47dcfcccfa.tar.gz rneovim-1bcddd5b53a0993789df7ec91fecea47dcfcccfa.tar.bz2 rneovim-1bcddd5b53a0993789df7ec91fecea47dcfcccfa.zip |
Merge pull request #20943 from zeertzjq/vim-8.2.4688
vim-patch:8.2.{4688,4693,4978},9.0.0053: regexp fixes
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r-- | src/nvim/regexp_nfa.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index fbd4e26c75..2f4b1b98c1 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -2094,6 +2094,12 @@ static int nfa_regatom(void) break; case '#': + if (regparse[0] == '=' && regparse[1] >= 48 + && regparse[1] <= 50) { + // misplaced \%#=1 + semsg(_(e_atom_engine_must_be_at_start_of_pattern), regparse[1]); + return FAIL; + } EMIT(NFA_CURSOR); break; @@ -2141,6 +2147,7 @@ static int nfa_regatom(void) int64_t n = 0; const int cmp = c; bool cur = false; + bool got_digit = false; if (c == '<' || c == '>') { c = getchr(); @@ -2151,7 +2158,7 @@ static int nfa_regatom(void) } while (ascii_isdigit(c)) { if (cur) { - semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c)); + semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c)); return FAIL; } if (n > (INT32_MAX - (c - '0')) / 10) { @@ -2161,10 +2168,15 @@ static int nfa_regatom(void) } n = n * 10 + (c - '0'); c = getchr(); + got_digit = true; } if (c == 'l' || c == 'c' || c == 'v') { int32_t limit = INT32_MAX; + if (!cur && !got_digit) { + semsg(_(e_nfa_regexp_missing_value_in_chr), no_Magic(c)); + return FAIL; + } if (c == 'l') { if (cur) { n = curwin->w_cursor.lnum; |