mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 14:03:35 +00:00
fix: Remap float parts as integers when parsed as indices
This commit is contained in:
parent
81b3e6d124
commit
dbb066b99e
2 changed files with 5 additions and 5 deletions
|
@ -323,8 +323,8 @@ fn name_ref_or_index(p: &mut Parser) {
|
||||||
p.at(IDENT) || p.at(INT_NUMBER) || p.at(FLOAT_NUMBER_PART) || p.at_ts(FLOAT_LITERAL_FIRST)
|
p.at(IDENT) || p.at(INT_NUMBER) || p.at(FLOAT_NUMBER_PART) || p.at_ts(FLOAT_LITERAL_FIRST)
|
||||||
);
|
);
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
if p.at_ts(FLOAT_LITERAL_FIRST) {
|
if p.at(FLOAT_NUMBER_PART) || p.at_ts(FLOAT_LITERAL_FIRST) {
|
||||||
p.bump_remap(FLOAT_NUMBER_PART);
|
p.bump_remap(INT_NUMBER);
|
||||||
} else {
|
} else {
|
||||||
p.bump_any();
|
p.bump_any();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ SOURCE_FILE
|
||||||
IDENT "x"
|
IDENT "x"
|
||||||
DOT "."
|
DOT "."
|
||||||
NAME_REF
|
NAME_REF
|
||||||
FLOAT_NUMBER_PART "0"
|
INT_NUMBER "0"
|
||||||
DOT "."
|
DOT "."
|
||||||
WHITESPACE " "
|
WHITESPACE " "
|
||||||
NAME_REF
|
NAME_REF
|
||||||
|
@ -67,10 +67,10 @@ SOURCE_FILE
|
||||||
IDENT "x"
|
IDENT "x"
|
||||||
DOT "."
|
DOT "."
|
||||||
NAME_REF
|
NAME_REF
|
||||||
FLOAT_NUMBER_PART "0"
|
INT_NUMBER "0"
|
||||||
DOT "."
|
DOT "."
|
||||||
NAME_REF
|
NAME_REF
|
||||||
FLOAT_NUMBER_PART "1"
|
INT_NUMBER "1"
|
||||||
SEMICOLON ";"
|
SEMICOLON ";"
|
||||||
WHITESPACE "\n "
|
WHITESPACE "\n "
|
||||||
EXPR_STMT
|
EXPR_STMT
|
||||||
|
|
Loading…
Reference in a new issue