somehow i forgot operator % all this time

This commit is contained in:
Adam D. Ruppe 2018-03-10 19:22:16 -05:00
parent d042d294d4
commit 9eafac3c7c
1 changed files with 6 additions and 4 deletions

View File

@ -342,13 +342,13 @@ private enum string[] keywords = [
private enum string[] symbols = [ private enum string[] symbols = [
"//", "/*", "/+", "//", "/*", "/+",
"&&", "||", "&&", "||",
"+=", "-=", "*=", "/=", "~=", "==", "<=", ">=","!=", "+=", "-=", "*=", "/=", "~=", "==", "<=", ">=","!=", "%=",
"&=", "|=", "^=", "&=", "|=", "^=",
"..", "..",
".",",",";",":", ".",",",";",":",
"[", "]", "{", "}", "(", ")", "[", "]", "{", "}", "(", ")",
"&", "|", "^", "&", "|", "^",
"+", "-", "*", "/", "=", "<", ">","~","!", "+", "-", "*", "/", "=", "<", ">","~","!","%"
]; ];
// we need reference semantics on this all the time // we need reference semantics on this all the time
@ -1124,7 +1124,7 @@ class BinaryExpression : Expression {
//writeln(left, " "~op~" ", right); //writeln(left, " "~op~" ", right);
var n; var n;
foreach(ctOp; CtList!("+", "-", "*", "/", "==", "!=", "<=", ">=", ">", "<", "~", "&&", "||", "&", "|", "^")) foreach(ctOp; CtList!("+", "-", "*", "/", "==", "!=", "<=", ">=", ">", "<", "~", "&&", "||", "&", "|", "^", "%"))
if(ctOp == op) { if(ctOp == op) {
n = mixin("left "~ctOp~" right"); n = mixin("left "~ctOp~" right");
} }
@ -1159,7 +1159,7 @@ class OpAssignExpression : Expression {
//writeln(left, " "~op~"= ", right); //writeln(left, " "~op~"= ", right);
var n; var n;
foreach(ctOp; CtList!("+=", "-=", "*=", "/=", "~=", "&=", "|=", "^=")) foreach(ctOp; CtList!("+=", "-=", "*=", "/=", "~=", "&=", "|=", "^=", "%="))
if(ctOp[0..1] == op) if(ctOp[0..1] == op)
n = mixin("v.getVar(sc) "~ctOp~" right"); n = mixin("v.getVar(sc) "~ctOp~" right");
@ -2056,6 +2056,7 @@ Expression parseFactor(MyTokenStreamHere)(ref MyTokenStreamHere tokens) {
switch(peek.str) { switch(peek.str) {
case "*": case "*":
case "/": case "/":
case "%":
tokens.popFront(); tokens.popFront();
e1 = new BinaryExpression(peek.str, e1, parsePart(tokens)); e1 = new BinaryExpression(peek.str, e1, parsePart(tokens));
break; break;
@ -2121,6 +2122,7 @@ Expression parseAddend(MyTokenStreamHere)(ref MyTokenStreamHere tokens) {
case "*=": case "*=":
case "/=": case "/=":
case "~=": case "~=":
case "%=":
tokens.popFront(); tokens.popFront();
return new OpAssignExpression(peek.str[0..1], e1, parseExpression(tokens)); return new OpAssignExpression(peek.str[0..1], e1, parseExpression(tokens));
default: default: