Menu

#361 parsing source statement error

open
5
2012-03-28
2012-03-28
No

In the following program snippette:

/**/
yy1=reverse(right(3,2,1))copies('0'x,3) ; say 'yy1 =' c2x(yy1)
yy2=reverse(right(3,2,1))||'000000'x ; say 'yy2 =' c2x(yy2)
yy3=reverse(right(3,2,1))'000000'x ; say 'yy3 =' c2x(yy3)
yy4= 31'000000'x ; say 'yy4 =' c2x(yy4)
yy5= (31)'000000'x ; say 'yy5 =' c2x(yy5)

The last three statments don't have the three-char hex string appended.

Output:

yy1 = 3331000000
yy2 = 3331000000
yy3 = 3331
yy4 = 3331
yy5 = 3331

However, changing the hexstring to '77'x makes it work:

/**/
yy1=reverse(right(3,2,1))copies('37'x,3) ; say 'yy1 =' c2x(yy1)
yy2=reverse(right(3,2,1))||'373737'x ; say 'yy2 =' c2x(yy2)
yy3=reverse(right(3,2,1))'373737'x ; say 'yy3 =' c2x(yy3)
yy4= 31'373737'x ; say 'yy4 =' c2x(yy4)
yy5= (31)'373737'x ; say 'yy5 =' c2x(yy5)

Output:

yy1 = 3331373737
yy2 = 3331373737
yy3 = 3331373737
yy4 = 3331373737
yy5 = 3331373737
_______________________________ Gerard Schildberger

Discussion


Log in to post a comment.