fstirlitz / luaparse

A Lua parser written in JavaScript
https://fstirlitz.github.io/luaparse/
MIT License
459 stars 91 forks source link

Incorrect parsing for return statements #122

Closed omarkmu closed 2 years ago

omarkmu commented 2 years ago

When immediately followed by comma without an initial expression, the return statement should result in a syntax error. Currently, as long as a "second" expression is included, the parser does not recognize this. So, return, 1 is considered valid. This code seems to be the culprit. Note that if the expression after the comma is excluded, this correctly emits a syntax error.

fstirlitz commented 2 years ago

Fixed by 0f525b152516bc8afa34564de2423b039aa83bc1, thank you.