Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/event.rs')
| -rw-r--r-- | crates/parser/src/event.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/parser/src/event.rs b/crates/parser/src/event.rs index fb2616cf01..577eb0967b 100644 --- a/crates/parser/src/event.rs +++ b/crates/parser/src/event.rs @@ -72,11 +72,14 @@ pub(crate) enum Event { /// `n_raw_tokens = 2` is used to produced a single `>>`. Token { kind: SyntaxKind, - // Consider custom enum here? n_raw_tokens: u8, }, + /// When we parse `foo.0.0` or `foo. 0. 0` the lexer will hand us a float literal + /// instead of an integer literal followed by a dot as the lexer has no contextual knowledge. + /// This event instructs whatever consumes the events to split the float literal into + /// the corresponding parts. FloatSplitHack { - has_pseudo_dot: bool, + ends_in_dot: bool, }, Error { msg: String, @@ -128,8 +131,8 @@ pub(super) fn process(mut events: Vec<Event>) -> Output { Event::Token { kind, n_raw_tokens } => { res.token(kind, n_raw_tokens); } - Event::FloatSplitHack { has_pseudo_dot } => { - res.float_split_hack(has_pseudo_dot); + Event::FloatSplitHack { ends_in_dot } => { + res.float_split_hack(ends_in_dot); let ev = mem::replace(&mut events[i + 1], Event::tombstone()); assert!(matches!(ev, Event::Finish), "{ev:?}"); } |