Expand description
let source = " <lua source code> ";
let block = match lua_parser::parse_str(&source) {
Ok(block) => block,
Err(err) => {
println!("{}", err);
return;
}
};
println!("AST:\n{:#?}", block);
Structs§
- AttName
- pair of variable name and attribute.
- Block
- block of statements. return statement must be optionally placed at the end of the block.
- Expr
Binary Data - Internal data for binary operation
- Expr
Bool - lua boolean literal value
- Expr
Function - unnamed function
- Expr
Function Call - function call.
prefix(args)
orprefix:method(args)
. - Expr
Ident - just identifier
- ExprNil
- Expr
Numeric - lua numeric literal value
- Expr
String - lua string literal value
- Expr
Table - table constructor, a list of fields
- Expr
Table Index table[index]
,table.index
- Expr
Unary Data - Internal data for unary operation
- Expr
Variadic ...
- Function
Call Arguments - Function
Name - function name.
a sequence of identifiers separated by dots, and an optional colon followed by an identifier.
e.g.
a.b.c:d
- Invalid
Token - Parameter
List - parameter list for named & anonymous function definition
- Parser
- struct that holds parser data, DFA tables
- Return
Statement - return statement
- Span
- range of a token in the source code
- Spanned
String - string with span information.
- Stmt
Assignment l0, l1, l2 = r0, r1, r2
. variadic...
can be used in bothl
andr
- Stmt
Break - break statement
- StmtDo
- do - end statements block
- Stmt
Else If - else-if fragment for if statements
- StmtFor
- for statement with start, end, step.
- Stmt
ForGeneric - for statement with generic expressions.
- Stmt
Function Definition - function definition statement.
- Stmt
Function Definition Local - local function definition statement.
- Stmt
Goto - Goto statement
- StmtIf
- if statement
- Stmt
Label - label definition
- Stmt
Local Declaration - local variable declaration.
- Stmt
None - Stmt
Repeat - repeat statement
- Stmt
While - while statement
- Table
Field KeyValue - table field constructor [key] =
value
- Table
Field Name Value - table field constructor
name = value
- Table
Field Value - table field constructor
value
- Token
- Token classification and metadata.
- Tokenizer
- lazy tokenize iterator.
Enums§
- Attrib
- local variable attribute.
either
const
orclose
. - Chunk
OrExpressions - for interpreter to handle both chunk and expression
- Expr
Binary - binary operation.
lhs OP rhs
- Expr
Unary - unary operation.
OP x
- Expression
- lua value & expression
- IntOr
Float - Lua’s numeric representation, can be either integer or float.
- Parse
Error - error when tokenizing & parsing lua source code
- Statement
- lua statement
- Table
Field - table field
- Tokenize
Error
Functions§
- parse_
bytes - parse lua source code to AST
- parse_
str - parse lua source code to AST
Type Aliases§
- Context
- type alias for
Context
- Float
Type - type alias for lua float type.
- IntType
- type alias for lua integer type.
- Invalid
Terminal Error - type alias for
InvalidTerminalError
- Stmt
Function Call - function call statement.