mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Implement % as a unit
This commit is contained in:
parent
c3aae7648a
commit
170564ecea
5 changed files with 59 additions and 1 deletions
|
@ -92,6 +92,16 @@ fn fill_token_vec(stream: TokenStream, vec: &mut Vec<parser::Token>) {
|
|||
}
|
||||
SyntaxKind::OrOr
|
||||
}
|
||||
'%' => {
|
||||
// % can only exist after number literal
|
||||
if let Some(last) = vec.last_mut() {
|
||||
if last.kind == SyntaxKind::NumberLiteral {
|
||||
last.text = format!("{}%", last.text).into();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
SyntaxKind::Error
|
||||
}
|
||||
_ => SyntaxKind::Error,
|
||||
};
|
||||
prev_spacing = p.spacing();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue