Closed skx closed 6 years ago
I didn't fully explain, it is 5AM, this means we have to change the way we handle builtins too:
If we find an ident as an argument to a builtin we have to pass the value of that ident, and if a built-in is a built-in we pass the result of the expression being evaluated via expr().
Without this the implementation will break, because when we skip tokens to collect the arguments we'll not skip enough..
Made good progress in #27, but there are some breaking-changes for users who embed. Oops.
At some point I need to declare API-stability, but we're not there yet :)
Closed in #27.
This works:
These fails:
The reason for this is interesting. We store variables as
{token.IDENT }
, and we added special code to first of all look for a built-in every time we get the value of a variable. However for that to work we need to skip tokens more than we do.The solution to this problem is to treat builtins as something that can be handled by
expr
. Which means we stop faking the invokation of builtins, but actually do it for real. This will be easier to implement than describe!token.BUILTIN
RegisterBuiltin
scan our program and rewrite it, in place.token.BUILTIN
call expr() to get the value.