✨ Percentage
This commit is contained in:
@@ -17,7 +17,15 @@ class Parser {
|
||||
}
|
||||
}
|
||||
|
||||
Expr parse() => parseAdd();
|
||||
Expr parse() {
|
||||
var expr = parseAdd();
|
||||
skipSpaces();
|
||||
if (!isEnd && current == '%') {
|
||||
eat();
|
||||
expr = PercentExpr(expr);
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
Expr parseAdd() {
|
||||
var expr = parseMul();
|
||||
@@ -46,6 +54,12 @@ class Parser {
|
||||
}
|
||||
skipSpaces();
|
||||
}
|
||||
// Handle percentage operator
|
||||
skipSpaces();
|
||||
if (!isEnd && current == '%') {
|
||||
eat();
|
||||
expr = PercentExpr(expr);
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user