add % modulo operator to El lexer, parser, codegen

Lexer and parser already had Percent token and precedence on the
compiler/string-interp branch. This commit adds the missing is_int_expr
case for Percent so that modulo expressions over Int operands are
correctly typed as Int (enabling arithmetic dispatch rather than
falling through to string concat or untyped paths).

binop_to_c already mapped Percent -> % at HEAD; only is_int_expr
needed the Percent arm.
This commit is contained in:
Will Anderson
2026-05-03 15:44:19 -05:00
parent 252ad04c96
commit 49a8a1c24b
+6
View File
@@ -1771,6 +1771,12 @@ fn is_int_expr(expr: Map<String, Any>) -> Bool {
}
return false
}
if str_eq(op, "Percent") {
if is_int_expr(expr["left"]) {
if is_int_expr(expr["right"]) { return true }
}
return false
}
return false
}
return false