aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/expressions.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-22 01:40:53 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-22 01:40:53 +0200
commitefa862d4f89401c5148746a5aba4d88ed6b6cbaa (patch)
tree22afe953b54b4b0fc6f80f0aef80c4ae45b8f3be /src/expressions.h
parent91f29f5b146453e67e15f8e91571b0f806526d1f (diff)
downloadsciteco-efa862d4f89401c5148746a5aba4d88ed6b6cbaa.tar.gz
fixed operator precedence list
* necessary since in SciTECO every operator has a different precedence. E.g. successive additions/subtractions cannot be evaluated from left to right (by their associativity). Perhaps this should be changed. * subtraction must have a higher precedence than addition, since (a+b)-c == a+(b-c) * division must have a higher precedence than multiplication since (a*b)/c == a*(b/c). This is not quite true for integer arithmetics. * this fixes expressions like 5-1+1 which were counterintuitively evaluated like 5-(1+1)
Diffstat (limited to 'src/expressions.h')
-rw-r--r--src/expressions.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/expressions.h b/src/expressions.h
index a0e2908..f97ec1c 100644
--- a/src/expressions.h
+++ b/src/expressions.h
@@ -159,11 +159,11 @@ public:
enum Operator {
OP_NIL = 0,
OP_POW, // ^*
- OP_MUL, // *
- OP_DIV, // /
OP_MOD, // ^/
- OP_ADD, // +
+ OP_DIV, // /
+ OP_MUL, // *
OP_SUB, // -
+ OP_ADD, // +
OP_AND, // &
OP_XOR, // ^#
OP_OR, // #