Menu ▾ ▴

#1 "List.idx" construct fails in bool ops

open
nobody
None
3
2002-01-11
2002-01-11
No

List items can be accessed by variables held in
indexes, for example in the following statement:

/var = list.idx

This statement works fine, however when the same
format is used within a boolean test there is a syntax
error as demonstrated below (see proposal at bottom):

zz> /a={6 7 8 9}
zz> /b=2
zz> /print a.b
7
zz> /if (7 > 2) { /print "ok" }
ok
zz> /if (a.b > 2) { /print "ok" }
+ **** SYNTAX ERROR ****
| got: '{ 6 7 8 9 (z^??7
L@Dg@'
| expected one of: num_e '('
| string_e string_t '-' int int64 float double
ident qstring
| 'cast_to_float'
| /if (a.b > 2) { /print "ok" }
| ^
| line 14 of stdin
| a == { 6 7 8 9 }
zz>

I think the problem is that the boolean operators are
not recognizing the "list.idx" construct. I tested a
simillar program(it used "==" instead) by making the
following changes within sys.c:

OPEN($cond) GSB($arg) M("==") GSB($arg) PROC(s_eq) END
//OPEN($cond) GSB(string_e) M("==") GSB(string_e) PROC
(s_eq) END
//OPEN($cond) GSB(num_e) M("==") GSB(num_e) PROC
(s_eq) END

and the above error is fixed! However this change
might have effects elsewhere so I want to wait until
our testsuits are complete before trying this change.
-James

Discussion


Log in to post a comment.