fixed various reader issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-18 21:41:00 +09:00
parent ec4a6facee
commit b6e6274666
10 changed files with 181 additions and 66 deletions

View File

@ -6,7 +6,12 @@ x := (+ 10 20) "aaaa"; ##ERROR: syntax error - too many rvalues
##
x := (10 +); ##ERROR: syntax error - no operand after binary operator
x := (10 +); ##ERROR: syntax error - no operand after binary selector
---
10 + ##ERROR: syntax error - no operand after binary selector '+'
---
@ -82,8 +87,48 @@ defun :* fun1() { ##ERROR: syntax error - function name not symbol in defun
---
(10 + 20 30) ##ERROR: syntax error - too many operands
(10 + 20 30) ##ERROR: syntax error - redundant operand '30'
---
#**a ##ERROR: syntax error - invalid binary selector character 'a' after #**
---
abc- := 20 ##ERROR: syntax error - '-' prohibited as last character of identifier or identifier segment
---
self.g- := 20 ##ERROR: syntax error - '-' prohibited as last character of identifier or identifier segment
---
self.-g := 20 ##ERROR: syntax error - '-' prohibited as first character of identifier or identifier segment
---
if.abc := 20 ##ERROR: syntax error - wrong multi-segment identifier
---
abc. := 20 ##ERROR: syntax error - blank segment after 'abc.'
---
abc.? := 20 ##ERROR: syntax error - '?' prohibited as first character of identifier or identifier segment after 'abc.'
---
- := 20 ##ERROR: syntax error - bad lvalue - invalid element - -
---
+++ := 20 ##ERROR: syntax error - bad lvalue - invalid element - +++
##---
##1 + + +
##ASSERTION FAILURE: rstl->count == 3 at ../../../lib/read.c:1001
#
#
#HCL> 1 + 2 3 + 4
##ASSERTION FAILURE: rstl->count == 3 at ../../../lib/read.c:1002

View File

@ -1,5 +1,6 @@
## test class instantiation methods
fun UndefinedObject: ~= (oprnd) { return (nqv? self oprnd) } ## for if (a ~= nil) ...
fun Number: + (oprnd) { return (+ self oprnd) }
fun Number: - (oprnd) { return (- self oprnd) }
fun Number: * (oprnd) { return (* self oprnd) }
@ -44,14 +45,20 @@ class B :: A [ d e f ] {
};
};
a := ((B:newInstance 1 2 3):sum);
a := ((B:newInstance 1 2 3):sum)
if (a ~= 18) { printf "ERROR: a must be 18\n"; } \
else { printf "OK %d\n" a; };
else { printf "OK %d\n" a; }
b := (B:newInstance 2 3 4);
a := (b:get-a);
b := (B:newInstance 2 3 4)
a := (b:get-a)
if (a ~= 4) {printf "ERROR: a must be 4\n" } \
else { printf "OK %d\n" a };
else { printf "OK %d\n" a }
c := (object-new A)
a := (c:get-a)
if (a ~= nil) {printf "ERROR: a must be nil\n" } \
else { printf "OK %O\n" a }
a := (b:get-b);
if (a ~= 6) { printf "ERROR: a must be 6\n" } \

View File

@ -1 +1 @@
(1:) ##ERROR: syntax error - missing message after :
(1:) ##ERROR: syntax error - missing message after receiver

View File

@ -54,11 +54,12 @@ class A [ + ] { ##ERROR: syntax error - not variable name - +
---
fun xxx(x :: p q) { p := (x + 1); q := (x + 2) }
[a,[b]] := (xxx 20) ##ERROR: syntax error - invalid lvalue - not symbol in tuple
[a,[b]] := (xxx 20) ##ERROR: syntax error - bad lvalue - invalid element in tuple
printf "%d %d\n" a b
---
20 := 90 ##ERROR: syntax error - invalid lvalue - not symbol - 20
20 := 90 ##ERROR: syntax error - bad lvalue - invalid element - 20
---
@ -66,4 +67,8 @@ printf "%d %d\n" a b
---
[] := 10 ##ERROR: syntax error - invalid lvalue
[] := 10 ##ERROR: syntax error - bad lvalue - blank expression
---
+ + 100 ##ERROR: exception not handled - "unable to send + to #<PRIM> - '+' not found in Primitive"