mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Macro: Fix lexing of 4..log
Use same rules for .slint and macro. The test is `cargo test -p test-driver-rust` without the `build-time` feature (but that feature is enabled in the CI and that's why CI didn't catch this)
This commit is contained in:
parent
7295126838
commit
cb72e48aa4
1 changed files with 15 additions and 1 deletions
|
@ -127,7 +127,21 @@ fn fill_token_vec(stream: impl Iterator<Item = TokenTree>, vec: &mut Vec<parser:
|
|||
}
|
||||
';' => SyntaxKind::Semicolon,
|
||||
'!' => SyntaxKind::Bang,
|
||||
'.' => SyntaxKind::Dot,
|
||||
'.' => {
|
||||
// `4..log` is lexed as `4 . . log` in rust, but should be `4. . log` in slint
|
||||
if let Some(last) = vec.last_mut() {
|
||||
if last.kind == SyntaxKind::NumberLiteral
|
||||
&& are_token_touching(prev_span, p.span()).unwrap_or(false)
|
||||
&& !last.text.contains('.')
|
||||
&& !last.text.ends_with(char::is_alphabetic)
|
||||
{
|
||||
last.text = format!("{}.", last.text).into();
|
||||
prev_span = span;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
SyntaxKind::Dot
|
||||
}
|
||||
'+' => SyntaxKind::Plus,
|
||||
'-' => {
|
||||
if let Some(last) = vec.last_mut() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue