diff options
author | Ian C <ianc@noddybox.co.uk> | 2016-04-20 09:48:51 +0100 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2016-04-20 09:48:51 +0100 |
commit | 519fdd7d64c2d8366a3b3b076a1ec558f63e703e (patch) | |
tree | 71f3b3f6a435a8825868f1e5138041fd8d4d1eb0 /src | |
parent | a5984e6f82e9368e719e832764ebb4813ff5e797 (diff) |
Removed modulus and added '%' as a binary format marker.
Diffstat (limited to 'src')
-rw-r--r-- | src/casm.c | 2 | ||||
-rw-r--r-- | src/expr.c | 9 | ||||
-rw-r--r-- | src/label.c | 2 | ||||
-rw-r--r-- | src/test/1 | 10 |
4 files changed, 12 insertions, 11 deletions
@@ -57,7 +57,7 @@ */ static const char *casm_usage = -"Version 1.1\n" +"Version 1.2 development\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -55,7 +55,6 @@ #define TYPE_EQUALITY 17 #define TYPE_BOOL_AND 18 #define TYPE_BOOL_OR 19 -#define TYPE_MODULUS 20 #define TYPE_LT 21 #define TYPE_GT 22 #define TYPE_LTEQ 23 @@ -79,14 +78,13 @@ #define SYM_EQUALITY "==" #define SYM_BOOL_AND "&&" #define SYM_BOOL_OR "||" -#define SYM_MODULUS "%" #define SYM_LT "<" #define SYM_GT ">" #define SYM_LTEQ "<=" #define SYM_GTEQ ">=" #define SYM_INEQUALITY "!=" -#define OPERATOR_CHARS "{}/*+-~&|^<>=%!" +#define OPERATOR_CHARS "{}/*+-~&|^<>=!" #define IS_OPERATOR_TYPE(a) ((a)>=TYPE_OPERATOR) @@ -146,7 +144,6 @@ static const Operator op_info[]= {SYM_SHIFTR, 6, TYPE_SHIFTR, OpBinary, TRUE}, {SYM_MULTIPLY, 5, TYPE_MULTIPLY, OpBinary, TRUE}, {SYM_DIVIDE, 5, TYPE_DIVIDE, OpBinary, TRUE}, - {SYM_MODULUS, 5, TYPE_MODULUS, OpBinary, TRUE}, {SYM_ADD, 4, TYPE_ADD, OpBinary, TRUE}, {SYM_SUBTRACT, 4, TYPE_SUBTRACT, OpBinary, TRUE}, {SYM_EQUALITY, 1, TYPE_EQUALITY, OpBinary, TRUE}, @@ -561,10 +558,6 @@ static int EvalPostfix(Stack **stack, int *result) *result=left*right; break; - case TYPE_MODULUS: - *result=left%right; - break; - case TYPE_ADD: *result=left+right; break; diff --git a/src/label.c b/src/label.c index 75270ef..0807128 100644 --- a/src/label.c +++ b/src/label.c @@ -283,7 +283,7 @@ int LabelExpand(const char *expr, int *result) } else if (first == '%') { - found = ParseBase(expr, 2, result, '\0'); + found = ParseBase(expr + 1, 2, result, '\0'); } else if (last == 'b' || last == 'B') { @@ -32,7 +32,7 @@ expr1_7 equ 1 + 2 * 3 expr2_9 equ {1 + 2} * 3 bin1: equ 11110101b -bin2: equ 11110010b +bin2: equ %11110010 hex1: equ $1234 hex2 equ 1234h hex3: equ 0x1234 @@ -68,6 +68,14 @@ two fred ONE * 2 true1 equ one == 1 false1 equ one != 1 +true2 equ 1 == 1 && 2 == 2 +true3 equ 1 == 2 || 2 == 2 +false2 equ 1 == 2 && 2 == 2 +false3 equ 1 == 2 || 2 == 3 + +and1 equ 0x8123 & 256 +or1 equ 0x8123 | 256 + endaddr:end this is ignored |