vim-patch:8.1.1355: obvious mistakes are accepted as valid expressions

Problem:    Obvious mistakes are accepted as valid expressions.
Solution:   Be more strict about parsing numbers. (Yasuhiro Matsumoto,
            closes vim/vim#3981)
16e9b85113

Update vim_str2nr_spec.lua to add more tests that use strict = true.
This commit is contained in:
Sean Dewar
2021-05-30 22:50:09 +01:00
parent cd18fe17a8
commit 34cb087955
13 changed files with 136 additions and 59 deletions

View File

@@ -351,7 +351,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
}
if (exp_start) {
vim_str2nr(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part,
(int)(ret.len - exp_start));
(int)(ret.len - exp_start), false);
}
if (exp_negative) {
exp_part += frac_size;
@@ -369,7 +369,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
int len;
int prep;
vim_str2nr(pline.data, &prep, &len, STR2NR_ALL, NULL,
&ret.data.num.val.integer, (int)pline.size);
&ret.data.num.val.integer, (int)pline.size, false);
ret.len = (size_t)len;
const uint8_t bases[] = {
[0] = 10,