fastbasic icon indicating copy to clipboard operation
fastbasic copied to clipboard

partial reserved word matching in variables

Open marianodominguez opened this issue 2 years ago • 1 comments

Hello. I'm facing errors with certain var names. e.g

u%=0.12
cosu%=cos(u%)
cos4u%=cosu%*cosu%*cosu%*cosu%
u%=90*cos4u%

cannot compile:

BAS compile 'testfloat.bas' to 'testfloat.asm'
testfloat.bas:4:10: parse error, expected: '+', '-'
u%=90*cos4<--- HERE -->u%

all is ok if I rename the variable to c4u%

marianodominguez avatar Apr 12 '23 00:04 marianodominguez

This is expected, as function with a single parameter can be called without parentheses.

So, cos(4) is the same as cos 4 or cos4 since space is optional. So, it interprets cos4u as cos(4) and doesn't know what to do with u.

Therefore, I recommend you avoid using any variable names that are the name of real function, or the name of a function followed by a number.

EricCarrGH avatar Jun 14 '23 05:06 EricCarrGH

Closed as not-a-bug. Have Fun!

dmsc avatar Apr 23 '24 14:04 dmsc