Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small brackets-parsing glitch (*solved*)
#1
Messing around with some of my other code over lunchtime with the latest beta (2100), I discovered a small error when parsing brackets.

Take a look at this code:
Code:
DIM test(10, 10) as UBYTE
DIM x as UBYTE
DIM y as UBYTE

x = 5
y = 5

PRINT test(x - 1, y)
PRINT test((x - 1), y)
PRINT test(x, y - 1)
PRINT test(x, (y - 1))

The final PRINT statement will not compile unless you remove the brackets from around the (y - 1). Strangely, the brackets seem to be okay if we're dealing with the first dimension of the array (so it's okay to have 'x - 1' in brackets), just not for the second. :-)
Reply
#2
Whoops, I forgot to mention that the compile error is this:
Code:
Error: syntax error. Unexpected token '(' [LLP]
Reply
#3
LTee Wrote:Whoops, I forgot to mention that the compile error is this:
Code:
Error: syntax error. Unexpected token '(' [LLP]
OMG! Confusedhock: This is going to be the new preprocessor (what a nightmare!) :mrgreen:
Try filtering it throug zxbpp:
Code:
zxbpp yourprogram.bas
The filtered program will be printed in the screen (stdout). If no error is given, then it's in the compiler parser.
Update: Confirmed. It's the preprocessor :x :roll:
Reply
#4
Oops! Sorry! :-D
Reply
#5
Ok, seems to be fixed.
As always, download 1.2.7-r2103 from here: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive">http://www.boriel.com/wiki/en/index.php ... IC:Archive</a><!-- m -->
Reply
#6
That seems to have done the trick, boriel - code's compiling and running normally now!

Many thanks, as usual! Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)