add remainder operation
This commit is contained in:
parent
56330a54ad
commit
919a9f255b
|
@ -150,6 +150,7 @@ std::any EmitVisitor::visitExpr(xlangParser::ExprContext *ctx) {
|
|||
std::any EmitVisitor::visitTerm(xlangParser::TermContext *ctx) {
|
||||
OPERATOR(Mul, visitTerm, term(), visitFactor, factor(), "mul");
|
||||
OPERATOR(Div, visitTerm, term(), visitFactor, factor(), "div");
|
||||
OPERATOR(Rem, visitTerm, term(), visitFactor, factor(), "rem");
|
||||
visitFactor(ctx->factor());
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ boolean : Not boolean
|
|||
expr : expr (Plus|Minus|BitAnd|BitOr|BitXor|ShiftLeft|ShiftRight) term
|
||||
| term
|
||||
;
|
||||
term : term (Mul|Div) factor
|
||||
term : term (Mul|Div|Rem) factor
|
||||
| factor
|
||||
;
|
||||
factor : Minus factor
|
||||
|
@ -81,6 +81,7 @@ ShiftRight : '>>';
|
|||
BitNot : '~';
|
||||
Mul : '*';
|
||||
Div : '/';
|
||||
Rem : '%';
|
||||
Comma : ',';
|
||||
Semicolon : ';';
|
||||
|
||||
|
|
Loading…
Reference in a new issue