An open API service indexing awesome lists of open source software.

https://github.com/tracyxmr/twee

A Lua/Luau parser for code analysis and editor integration.
https://github.com/tracyxmr/twee

lua luau parser tree-sitter

Last synced: 5 months ago
JSON representation

A Lua/Luau parser for code analysis and editor integration.

Awesome Lists containing this project

README

          

# twee
A Lua/Luau parser for code analysis and editor integration.

# features
* Serialize program into JSON.
* Parses local variable declarations along with type annotations.
* Parses binary operations as expressions, ordered by precedence.
* Allows for optional ';' after statements.
* Serializes with proper key-pair value resolution.

# example
Test for type annotations for Luau source:
```luau
local name: string = "blinx"
```

Output:
```json
[
{
"VariableDecl": {
"name": "name",
"value": {
"String": "blinx"
},
"type_annotation": "string"
}
}
]
```

# usage + test
```
cargo test
```

or

```
$ cargo build
$ ./twee --input example/input.lua --output example/tree.json
```