diff options
author | ZyX <kp-pav@yandex.ru> | 2017-10-03 00:39:40 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-10-15 19:13:50 +0300 |
commit | 0bc4e2237960712426da3774c1430f5874c49aea (patch) | |
tree | da09c83263afd905f6167f9a957b298b0bdd6cfe /src | |
parent | 6168e1127c1c80a3810854649b0776146545043b (diff) | |
download | rneovim-0bc4e2237960712426da3774c1430f5874c49aea.tar.gz rneovim-0bc4e2237960712426da3774c1430f5874c49aea.tar.bz2 rneovim-0bc4e2237960712426da3774c1430f5874c49aea.zip |
viml/parser/expressions: Forbid dot or alpha characters after a float
This is basically what Vim already does, in addition to forbidding floats should
there be a concat immediately before it.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/viml/parser/expressions.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 8e6f991e03..8c95d1db14 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -186,6 +186,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags) ret.data.num.is_float = false; CHARREG(kExprLexNumber, ascii_isdigit); if (flags & kELFlagAllowFloat) { + const LexExprToken non_float_ret = ret; if (pline.size > ret.len + 1 && pline.data[ret.len] == '.' && ascii_isdigit(pline.data[ret.len + 1])) { @@ -207,6 +208,11 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags) CHARREG(kExprLexNumber, ascii_isdigit); } } + if (pline.size > ret.len + && (pline.data[ret.len] == '.' + || ASCII_ISALPHA(pline.data[ret.len]))) { + ret = non_float_ret; + } } break; } |