lua/visitors/visitor
library
Classes
-
AssignExpr
-
Variables can be reassigned. This node encodes this operation.
While technically a binary operation by its format,
a rewrite required that it was evaluated in a different
grammar rule. Maybe in the future this encoding will be corrected.
-
AssignMultiExpr
-
Like DeclMultiVar, multiple variables can be reassigned at once.
-
AST
-
The entry node of any lua program.
A program is a collection of stmts.
-
BinaryExpr
-
Any binary expression (lhs op rhs) is encoded by this node.
op is the operator used on lhs and rhs expressions.
-
BooleanLiteral
-
BooleanLiteral.asTrue encodes the literal
true.
BooleanLiteral.asFalse encodes the literal false.
-
BreakStmt
-
Represents the keyword 'break' in lua.
-
DeclArg
-
This node tells the grammar how to
compose a function's argument list.
-
DeclMultiVar
-
Lua supports multivariable assignment.
Therefore it supports multivariable declarations.
-
DeclVar
-
This represents a variable declaration in lua.
The variable name will be id. It may have
initialization terms provided by init.
-
ForIterLoopStmt
-
The key-value variant of lua's for-loop control structure.
Unlike the step-wise variant, this destructures iterExpr
into key and value in each loop until there's nothing
left to destructure.
-
ForLoopStmt
-
The step-wise variant of lua's for-loop control structure.
-
FuncExpr
-
Function declarations can be assigned to variables
and are therefore math expressions.
-
GotoLabelStmt
-
Represents labels which goto statements use.
-
GotoStmt
-
Represents the 'goto' keyword in lua.
https://www.lua.org/manual/5.5/manual.html#3.3.4
-
GroupExpr
-
Group expressions are expressions wrapped in parents (...).
-
IfStmt
-
Represents a linked list of conditional statements.
Consider the chain if -> elif -> elif -> else.
Therefore else statements are IfStmt without an expr.
See IfStmt.terminalElse constructor.
-
KeyValStmt
-
For convenience, table
{key, value} expressions
are encoded as this node.
-
MathExpr
-
-
MemoryAccess
-
Memory access node encodes which operator op
was used, the callee resolved on the left-hand side,
the type for convenience, and the input args.
-
NilLiteral
-
Nil literals are encoded as this node.
-
NotExpr
-
In Lua, the not operator is used to negate a boolean value,
meaning it converts true to false and false to true.
-
NumberLiteral
-
Integers and real literals are encoded as this node.
-
RawExpr
-
Represents identifiers in lua.
Anything that is not a keyword or an expression
is likely an identifier like a variable name or
table fields. The spec defines labels as identifiers
but those are encoded in this lib by GotoLabelStmt.
-
RepeatUntilLoopStmt
-
Similar to a while-loop but conditional
expression untilExpr is the termination condition.
-
ReturnStmt
-
Represents the keyword 'return' in lua.
This keyword can return whole expressions
comma separated. See values.
-
SelfExpr
-
The token for 'self'.
While not a keyword in lua,
it is encoded as one in this lib
for convenience.
-
Stmt
-
Base grammar node.
-
StringLiteral
-
String literals are encoded as this node.
-
TableLiteral
-
Table literal expressions
{...} are encoded by this node.
-
UnaryExpr
-
Any tightly bound unary prefix is encoded by this node.
-
Visitor<T>
-
This abstraction visits every node class variant.
Visitors are the staple of this runtime implementation.
They can be used to implement semantic checks as well
as implement runtimes. Additionally custom visitors c
an walk the AST of a program and generate lua bytecode.
-
WhileLoopStmt
-
Lua while-do loop grammar node.