diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-09-24 04:07:03 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2015-09-24 04:15:04 +0200 |
commit | db510ba69e90039a9649a4bf3c8e6b7bdc5a09bd (patch) | |
tree | 53c17c17a778e9cab3d14102acb3822bd445ad7c /src/expressions.h | |
parent | 812cdd86ed6a05b69da1d137f1eff3a885353fe7 (diff) | |
download | sciteco-db510ba69e90039a9649a4bf3c8e6b7bdc5a09bd.tar.gz |
cleaned up operator precedence code
* use small values for low precedence
Diffstat (limited to 'src/expressions.h')
-rw-r--r-- | src/expressions.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/expressions.h b/src/expressions.h index e49880c..f357a1d 100644 --- a/src/expressions.h +++ b/src/expressions.h @@ -158,27 +158,32 @@ public: /** * Operator type. * The enumeration value divided by 16 represents - * its precedence (the lower, the higher). + * its precedence (small values mean low precedence). * In other words, the value's lower nibble is * reserved for enumerating operators of the * same precedence. */ enum Operator { - OP_NIL = 0, - OP_POW = 0x10, // ^* - OP_MOD = 0x20, // ^/ + /* + * Pseudo operators + */ + OP_NIL = 0x00, + OP_NEW, + OP_BRACE, + OP_LOOP, + OP_NUMBER, + /* + * Real operators + */ + OP_POW = 0x60, // ^* + OP_MOD = 0x50, // ^/ OP_DIV, // / OP_MUL, // * - OP_SUB = 0x30, // - + OP_SUB = 0x40, // - OP_ADD, // + - OP_AND = 0x40, // & - OP_XOR = 0x50, // ^# - OP_OR = 0x60, // # - // pseudo operators: - OP_NEW = 0xF0, - OP_BRACE, - OP_LOOP, - OP_NUMBER + OP_AND = 0x30, // & + OP_XOR = 0x20, // ^# + OP_OR = 0x10 // # }; private: |