A Tree-sitter grammar for Lua 5.5.
Built primarily to power a Zed extension, but compatible with any editor or tool that supports Tree-sitter — including VS Code (via nvim-treesitter or similar), Neovim, Emacs, and others.
You might want to check the Zed extension I'm working on: https://github.com/Zaenalos/Lua-Zed
- Full Lua 5.1 - 5.5 syntax support including
globaldeclarations, attributes (<const>,<close>), andglobal * - Complete syntax highlighting, check highlights.scm
npm install -g tree-sitter-cli
# or you might want to use bun
bun add -g tree-sitter-cli # requires node v22.22.1
tree-sitter parse your_file.lua
tree-sitter highlight your_file.lua
# testing
tree-sitter test
tree-sitter parse test-lua/*.lua| Suite | Status |
|---|---|
| Corpus (literals, expressions, statements, functions, comments) | ✅ 55/55 passing |
Sample file parsing (test-lua/*.lua) |
✅ No errors or missing nodes |
Found a bug or missing feature? Feel free to open an issue or submit a pull request.
Credits to Lua for the test files :)