summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-12-05 16:17:11 +0100
committerkdx <kikoodx@paranoici.org>2023-12-05 16:17:11 +0100
commit29a380366949cad972f419f205f04f024deca7de (patch)
tree4a473bba46d74ca0496023de47dc4457e14d5149 /src
parent07f9061b1287212cca8bdea2f07b7262e6d079b7 (diff)
downloadgolem-29a380366949cad972f419f205f04f024deca7de.tar.gz
inverted division operator
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 94dae81..e9061b5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -175,7 +175,7 @@ is_punct(const char *p)
if (strchr("|=", p[0]) != NULL && p[1] == '>')
return 2;
- return (strchr("+-*/%()<>,;{}[]=&^|", p[0]) != NULL);
+ return (strchr("+-*/\\%()<>,;{}[]=&^|", p[0]) != NULL);
}
static unsigned char
@@ -713,6 +713,10 @@ mul(Token **rest, Token *tok)
continue;
}
+ if (equal(tok, "\\")) {
+ node = new_binary(NOD_DIV, tok, primary(&tok, tok->next), node);
+ }
+
if (equal(tok, "%")) {
node = new_binary(NOD_MOD, tok, node, primary(&tok, tok->next));
continue;