Expand description
Strongly-typed AST types for Lua, auto-generated from
tree-sitter-lua’s node-types.json.
This crate is generated by treesitter-types and is
automatically kept up to date when a new version of the grammar crate is released.
See the Tree-sitter project for more information about the underlying parser framework.
§Example
use treesitter_types_lua::*;
// A minimal Lua hello-world program.
let src = b"\
function greet(name)
print(\"Hello, \" .. name .. \"!\")
end
greet(\"World\")
";
// Parse the source with tree-sitter and convert into typed AST.
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_lua::LANGUAGE.into()).unwrap();
let tree = parser.parse(src, None).unwrap();
let chunk = Chunk::from_node(tree.root_node(), src).unwrap();
// The chunk has two top-level children:
// a function statement and a function call statement.
assert_eq!(chunk.children.len(), 2);
assert_eq!(chunk.span.start.row, 0);
assert!(chunk.span.end.row >= 4);Re-exports§
pub use tree_sitter_lua;pub use treesitter_types::tree_sitter;
Structs§
- Arguments
- Assignment
Statement - Attribute
- Binary
Expression - Block
- Bracket
Index Expression - Break
Statement - Chunk
- Comment
- Comment
Content - DoStatement
- DotIndex
Expression - Else
Statement - Elseif
Statement - Empty
Statement - Escape
Sequence - Expression
List - False
- Field
- ForGeneric
Clause - ForNumeric
Clause - ForStatement
- Function
Call - Function
Declaration - Function
Definition - Goto
Statement - Hash
Bang Line - Identifier
- IfStatement
- Implicit
Variable Declaration - Label
Statement - Method
Index Expression - Nil
- Number
- Parameters
- Parenthesized
Expression - Repeat
Statement - Return
Statement - Span
- String
- String
Content - Table
Constructor - True
- Unary
Expression - Vararg
Expression - Variable
Declaration - Variable
List - While
Statement
Enums§
- AnyNode
- Assignment
Statement Children - Assignment
Statement Operator - Binary
Expression Operator - Block
Children - Bracket
Index Expression Table - Chunk
Children - Comment
End - Comment
Start - Declaration
- DotIndex
Expression Table - Expression
- Field
Name - Field
Operator - ForGeneric
Clause Children - ForNumeric
Clause Operator - ForStatement
Clause - Function
Call Name - Function
Declaration Name - IfStatement
Alternative - Method
Index Expression Table - Parse
Error - Statement
- String
End - String
Start - Unary
Expression Operator - Variable
- Variable
Declaration Children