|
Post by n00b on Mar 17, 2023 15:56:42 GMT -6
I found a bug recently that can cause a program to completely crash depending on if you using a builtin function inside a function that starts with the same name.
ex.
sub Cost() cos(0) end sub
You don't even need to run the function for it to crash your program. Since this bug is likely caused by the tokenizer, its probably been around for years and just slipped under my radar. I will try to have this fixed in the next revision.
|
|
|
Post by aurel on Mar 18, 2023 1:59:08 GMT -6
how tokenizer can cause error ? cos is a IDENT ...and IDENT can be variable, keyword or function ..right?
so ..in my case token COST is just token as COS only if you made wrong token type
|
|
|
Post by n00b on Mar 18, 2023 9:30:31 GMT -6
how tokenizer can cause error ? cos is a IDENT ...and IDENT can be variable, keyword or function ..right? I think it is probably something like comparing the substring for one of the built-in functions to the function's length. I don't know where its happening at yet so I am not sure. It is most likely in the tokenizer. Once the parser runs "<id>cos" is changed to something like "func 48" (its probably not 48 but that is just an example).
|
|
|
Post by aurel on Mar 18, 2023 13:12:08 GMT -6
///I think it is probably something like comparing the substring for one of the built-in functions to the function's length///
yes then is something like that but good point nOOb ...i never tested in micro(A)
this for example (but i will right now)
func cos() c = cos(0) endfn
just to see what will happend
|
|
|
Post by aurel on Mar 18, 2023 13:20:31 GMT -6
well on first i think that will be ignored but error check show that i use function without name
|
|
|
Post by aurel on Mar 18, 2023 13:21:33 GMT -6
but when i changed to cosT() as fn name then i get 1 as result
|
|