diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2023-02-07 17:41:16 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2023-02-07 17:41:16 +0100 |
| commit | 27cd509558a0fd9b47d267e445097363eb9db8ff (patch) | |
| tree | 67b72a533c51fcc3a765020ab934b8aadf2dad1b | |
| parent | e59487de38b1be5b06b92eb4a9d30c0adb32d9db (diff) | |
fix jointess for floats not being set properly
| -rw-r--r-- | crates/parser/src/shortcuts.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/parser/src/shortcuts.rs b/crates/parser/src/shortcuts.rs index 18a6f838fac..21939c34943 100644 --- a/crates/parser/src/shortcuts.rs +++ b/crates/parser/src/shortcuts.rs @@ -43,18 +43,16 @@ impl<'a> LexedStr<'a> { res.was_joint(); } res.push(kind); - } - if kind == SyntaxKind::FLOAT_NUMBER { // we set jointness for floating point numbers as a hack to inform the // parser about whether we have a `0.` or `0.1` style float - if self.text(i).split_once('.').map_or(false, |(_, it)| it.is_empty()) { - was_joint = false; - } else { - was_joint = true; + if kind == SyntaxKind::FLOAT_NUMBER { + if !self.text(i).split_once('.').map_or(true, |(_, it)| it.is_empty()) { + res.was_joint(); + } } - } else { - was_joint = true; } + + was_joint = true; } } res @@ -202,7 +200,7 @@ impl Builder<'_, '_> { (self.sink)(StrStep::Token { kind: SyntaxKind::DOT, text: "." }); if has_pseudo_dot { - assert!(right.is_empty()); + assert!(right.is_empty(), "{left}.{right}"); self.state = State::Normal; } else { (self.sink)(StrStep::Enter { kind: SyntaxKind::NAME_REF }); |
