Skip to content
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

Picotool incorrectly flags parenthesized expressions as assertionerrors #92

Open
GiovanH opened this issue Sep 25, 2021 · 1 comment
Open

Comments

@GiovanH
Copy link

GiovanH commented Sep 25, 2021

The error message for all of these cases is always AssertionError, thrown at self._tokens[self._pos].matches(lexer.TokSymbol(keyword)) in lua.py.

Parenthesized functions
AssertionError (expected ) got ():

dbg=(function()
end)()

Correctly parsed:

dbg=function()
end
dbg = dbg()

Parenthesized tables
AssertionError (expected ) got :):
(note: tables have __sub methods defined in metatables)

somefunction({(table1 - table2):unpack()}))

Correctly parsed:

local temp = (self.pos - self.anchor)
somefunction({temp:unpack()}))
@GiovanH
Copy link
Author

GiovanH commented Sep 27, 2021

This can temporarily be worked around by replacing operators that require parentheticalization with their dunder builtin function equivalents:

This code (which is correct, but p8tool cannot parse)

somefunction((table1 - table2):unpack())

becomes

somefunction(table1:__sub(table2):unpack())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant