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

Ambiguous syntax detected #53

Open
zumoshi opened this issue Nov 16, 2023 · 0 comments
Open

Ambiguous syntax detected #53

zumoshi opened this issue Nov 16, 2023 · 0 comments

Comments

@zumoshi
Copy link

zumoshi commented Nov 16, 2023

Hi

I've failed to reproduce the syntax error described in Lua runtime for both simple cases e.g.

io.write
('A')

(IDE One result)

and the example mentioned in the link in this comment:

z = (function(...) print(...); return "Bar"; end)
("Foo"):sub(1,1)

io.write(z)

(IDE One result)

They work fine in both the online Lua playground and IDE One, but fail to parse with this library getting this error:

File "/home/.../site-packages/luaparser/builder.py", line 697, in parse_tail
    raise SyntaxException(
luaparser.builder.SyntaxException: (2,4): Error: Ambiguous syntax detected

Was this a limitation of older Lua versions or ...?

For context my use case was static analysis of an existing working code base, and I was forced to patch it to be able to get it parsed by this library which was not ideal.

Is there any chance this error can be removed with ambiguity solved the same way Lua itself does? or was there another reason for this to be added that I missed? I didn't find any other issues/pull requests referencing this error.

Thanks.

Edit: for the test case used Lua runtime resolves it to as if there was no newline present
image

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