mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 09:48:19 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user