mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Parser: Hint for the mod function when parsing %
Was reported several times: - https://github.com/slint-ui/slint/discussions/4190 - https://github.com/slint-ui/slint/issues/3980
This commit is contained in:
parent
2404cce0bc
commit
2ce161ced8
2 changed files with 18 additions and 0 deletions
|
@ -134,6 +134,12 @@ fn parse_expression_helper(p: &mut impl Parser, precedence: OperatorPrecedence)
|
|||
parse_expression_helper(&mut *p, OperatorPrecedence::Mul);
|
||||
}
|
||||
|
||||
if p.nth(0).kind() == SyntaxKind::Percent {
|
||||
p.error("Unexpected '%'. For the unit, it should be attached to the number. If you're looking for the modulo operator, use the 'Math.mod(x, y)' function");
|
||||
p.consume();
|
||||
return false;
|
||||
}
|
||||
|
||||
if precedence >= OperatorPrecedence::Add {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue