implemented simple binary operator handling in the reader code
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-02-10 12:23:34 +09:00
parent 0455d6cdb3
commit b86eb13fb1
3 changed files with 58 additions and 9 deletions

View File

@ -1,3 +1,22 @@
##
x := (+ 10 20) "aaaa"; ##ERROR: syntax error - too many rvalues
---
##
x := (10 +); ##ERROR: syntax error - no operand after binary operator
---
##
x := (10 + 20 * 4); ##ERROR: syntax error - prohibited binary operator
---
## you can't have another colon before the method..
(obj: :method) ##ERROR: syntax error - : disallowed

View File

@ -34,24 +34,24 @@ defclass B :: A | d e f | {
};
a := ((B:newInstance 1 2 3):sum);
if (/= a 18) { printf "ERROR: a must be 18\n"; } \
if (a /= 18) { printf "ERROR: a must be 18\n"; } \
else { printf "OK %d\n" a; };
b := (B:newInstance 2 3 4);
a := (b:get-a);
if (/= a 4) {printf "ERROR: a must be 4\n" } \
if (a /= 4) {printf "ERROR: a must be 4\n" } \
else { printf "OK %d\n" a };
a := (b:get-b);
if (/= a 6) { printf "ERROR: a must be 6\n" } \
if (a /= 6) { printf "ERROR: a must be 6\n" } \
else { printf "OK %d\n" a };
a := (b:get-c);
if (/= a 8) { printf "ERROR: a must be 8\n" } \
if (a /= 8) { printf "ERROR: a must be 8\n" } \
else {printf "OK %d\n" a };
a := (b:sum);
if (/= a 27) { printf "ERROR: a must be 27\n" } \
if (a /= 27) { printf "ERROR: a must be 27\n" } \
else { printf "OK %d\n" a };
## super is equivalent to self unless a message is sent to it.