Skip to content

Lua 55 support - #84

Merged
boolangery merged 3 commits into
masterfrom
feature/lua-55
Sep 12, 2026
Merged

boolangery merged 3 commits into
masterfrom
feature/lua-55

Conversation

@boolangery

@boolangery boolangery commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Adds Lua 5.5 support.

On the grammar side: global declarations (including global function and the global x * wildcard), named varargs (function f(...args)), an attribute on a whole local list, break as a statement of its own rather than part of retstat, and a stricter lexer for strings and escapes (\z, line continuations, nested long brackets).

While testing this I pulled the official Lua test suite in as a corpus (lua/lua at v5.5.1, 34 files) and ran every file through parse -> to_lua_source -> parse. All of them parsed, but the printer turned out to have a handful of bugs that only show up on real-world code:

  • a trailing comment on a table field swallowed the field's comma, which quietly broke the rest of the table
  • - -2 came out as --2, i.e. a comment
  • block indentation was applied inside long-bracket strings and \z continuations, changing the string's actual value
  • print"x" and f{...} were normalised to print("x") and f({...})

All four are fixed. The corpus round trip is now exact: same tree, every comment preserved, and printing is a fixpoint.

@boolangery
boolangery marked this pull request as ready for review September 12, 2026 13:18
@boolangery
boolangery merged commit 0f9cee5 into master Sep 12, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

1 participant