-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teal unable to require base64 #865
Comments
I've looked into this a little bit more - the first thing to note is that I now realise my understanding
is incorrect - teal does still parse it's lua dependencies, it just parses less strictly. It looks like the lines that are causing the
in particular, if I manually swap these lines out for
then the command no longer fails, which suggests a failure to parse is being caused by the return value of The issue is also resolved if the loaded string is brought onto a single line, like
Or if explicit parentheses are added to the
If I find any more time I might see if I can dive deeper into this. |
New minimal example:
Errors:
|
It looks like this is caused by lines 3151 to 3154:
added to resolve #740 Because the previous token is a multiline string literal, I presume its token |
It's worth noting that this horrifying valid lua syntax:
executes successfully in lua and prints
This runs too with |
I know that tl will already add parentheses to any call with a string literal that doesn't have them (e.g it'll change I wonder if there's some possible solution in here where we move this earlier in the process, so that by the time it's checking if the previous token is on the same line, it's already added a token for the closing parenthesis, which will be on the same line. This of course doesn't solve the issue if a lua dependency is written like
or even
but frankly, I would be surprised if any developer actively chose to write their function calls like this |
The only alternative approach I can see that's fully compatible with all lua is that this insertion of an extra semicolon is turned off when parsing This would however mean that if someone is partway through adding typing to their |
@hishamhm do you have any suggestions here? |
What?
If trying to
tl run
a.tl
file that requires thebase64
lua package, the command fails, with the error:This worked on a previous version of teal (0.15.3-1), but since updating to 0.24.1, does not work.
It seems like teal is trying to validate the syntax on the
base64.lua
file, but (unless I'm misunderstanding, which is very possible), it should only check the types and syntax on thebase64.d.tl
file, and should just loadbase64.lua
like a standard lua file.Minimal example
The text was updated successfully, but these errors were encountered: