mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Maybe everything else *should* have to deal with it
This commit is contained in:
parent
2fe38d3b63
commit
37443eb9a1
10 changed files with 34 additions and 39 deletions
|
@ -3,7 +3,7 @@ mod atom;
|
|||
use super::*;
|
||||
|
||||
pub(crate) use self::atom::{block_expr, match_arm_list};
|
||||
pub(super) use self::atom::{float_literal, literal, FLOAT_LITERAL_FIRST, LITERAL_FIRST};
|
||||
pub(super) use self::atom::{literal, FLOAT_LITERAL_FIRST, LITERAL_FIRST};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub(super) enum Semicolon {
|
||||
|
|
|
@ -53,16 +53,14 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> {
|
|||
// }
|
||||
pub(crate) fn float_literal(p: &mut Parser) {
|
||||
// Floats can be up to 3 tokens. The first token indicates how many there are.
|
||||
// We remap the first token to `FLOAT_NUMBER_PART` so that no subsequent code has to deal with
|
||||
// this awful, awful hack.
|
||||
let f = p.start();
|
||||
if p.at(FLOAT_NUMBER_START_0) {
|
||||
p.bump_remap(FLOAT_NUMBER_PART);
|
||||
p.bump(FLOAT_NUMBER_START_0);
|
||||
} else if p.at(FLOAT_NUMBER_START_1) {
|
||||
p.bump_remap(FLOAT_NUMBER_PART);
|
||||
p.bump(FLOAT_NUMBER_START_1);
|
||||
p.bump(DOT);
|
||||
} else if p.at(FLOAT_NUMBER_START_2) {
|
||||
p.bump_remap(FLOAT_NUMBER_PART);
|
||||
p.bump(FLOAT_NUMBER_START_2);
|
||||
p.bump(DOT);
|
||||
p.bump(FLOAT_NUMBER_PART);
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@ pub(crate) use self::{
|
|||
traits::assoc_item_list,
|
||||
use_item::use_tree_list,
|
||||
};
|
||||
use super::{expressions::float_literal, *};
|
||||
use super::*;
|
||||
|
||||
// test mod_contents
|
||||
// fn foo() {}
|
||||
|
@ -457,9 +457,6 @@ pub(crate) fn token_tree(p: &mut Parser) {
|
|||
return;
|
||||
}
|
||||
T![')'] | T![']'] => p.err_and_bump("unmatched brace"),
|
||||
FLOAT_NUMBER_START_0 | FLOAT_NUMBER_START_1 | FLOAT_NUMBER_START_2 => {
|
||||
float_literal(p);
|
||||
}
|
||||
_ => p.bump_any(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue