enhanced the binop expression check in leave_list() in read.c
All checks were successful
continuous-integration/drone/push Build is passing

fixed the issue of the lost line terminator after the comment text which caused the next line to be treated as the same line
This commit is contained in:
2024-03-09 17:10:51 +09:00
parent 081c6d1874
commit 8345e2f949
7 changed files with 50 additions and 23 deletions

View File

@ -14,7 +14,6 @@ check_ERRORS = \
call-5001.err \
class-5001.err \
do-5001.err \
do-5002.err \
feed-5001.err \
mlist-5001.err \
var-5001.err \

View File

@ -486,7 +486,6 @@ check_ERRORS = \
call-5001.err \
class-5001.err \
do-5001.err \
do-5002.err \
feed-5001.err \
mlist-5001.err \
var-5001.err \

View File

@ -1,3 +1,13 @@
## if `do` is not enclosed in `( )`, variable declaration is prohibited
do { | k | set k 10 };
do | k | {set k 10;}; ##ERROR: syntax error - variable declaration disallowed
---
## if `do` is not enclosed in `( )`, it supports only the limited number of expressions.
do ; ## this is ok
do 1; ## this is ok
do { set k 10; printf "k=%d\n" k; } { set k 20; printf "k=%d\n" k; }; ##ERROR: syntax error - more than one expression after do

View File

@ -1,8 +0,0 @@
## if `do` is not enclosed in `( )`, it supports only the limited number of expressions.
do ; ## this is ok
do 1; ## this is ok
do { set k 10; printf "k=%d\n" k; } ##ERROR: syntax error - more than one expression after do
{ set k 20; printf "k=%d\n" k; };

View File

@ -86,3 +86,7 @@ defun :: fun1() { ##ERROR: syntax error - function name not symbol in defun
defun :* fun1() { ##ERROR: syntax error - function name not symbol in defun
return 10;
};
---
(10 + 20 30) ##ERROR: syntax error - too many operands

View File

@ -23,8 +23,7 @@ defun mkfun(t) {
defun mkfund(t) {
return {fun(c) {
return (fun(d) {
##return (d + c t) ## this causes assertion failure.
return (d + c t)
return (+ d c t)
})
}}
}
@ -47,10 +46,8 @@ if (k = 50) {
};
k := {
## the return value of this expression is ignored
(mkfun 20) 30 ## having comment here cause an issue...
## the return value of this expression is the return value of the block expression
(mkfun 20) 40
(mkfun 20) 30 ## the return value of this expression is ignored
(mkfun 20) 40 ## the return value of this expression is the return value of the block expression
}
if (k = 60) {
printf "OK - %d\n" k