Module full_moon::ast[][src]

Expand description

Utilities for ASTs (Abstract Syntax Trees). Contains all nodes used by Full Moon (such as blocks).

Modules

lua52

Contains the nodes necessary to parse Lua 5.2. Only usable when the “lua52” feature flag is enabled.

owned

Exposes the Owned that nodes implement to produce an owned version of themselves. Owned versions are represented as the node with a lifetime of 'static. For example, if you have an Ast<'a>, calling ast.owned() on it will produce an owned Ast<'static>.

punctuated

A punctuated sequence of syntax tree nodes separated by punctuation (tokens).

span

A representation of a “contained span”, or a span within specific bounds.

types

Contains the types necessary to parse Roblox’s typed Lua. Only usable when the “roblox” feature flag is enabled.

Structs

Assignment

An assignment, such as x = y. Not used for LocalAssignments

Ast

An abstract syntax tree, contains all the nodes used in the code

Block

A block of statements, such as in if/do/etc block

Do

A do block, such as do ... end This is not used for things like while true do end, only those on their own

ElseIf

An elseif block in a bigger If statement

FunctionBody

A function body, everything except function x in function x(a, b, c) call() end

FunctionCall

A function being called, such as call()

FunctionDeclaration

A normal function declaration, supports simple declarations like function x() end as well as complicated declarations such as function x.y.z:a() end

FunctionName

A function name when being declared as FunctionDeclaration

GenericFor

A generic for loop, such as for index, value in pairs(list) do end

If

An if statement

LocalAssignment

An assignment to a local variable, such as local x = 1

LocalFunction

A declaration of a local function, such as local function x() end

MethodCall

A method call, such as x:y()

NumericFor

A numeric for loop, such as for index = 1, 10 do end

Repeat

A repeat loop

Return

A return statement

TableConstructor

A table being constructed, such as { 1, 2, 3 } or { a = 1 }

VarExpression

A complex expression used by Var, consisting of both a prefix and suffixes

While

A while loop

Enums

AstError

An error that occurs when creating the ast after tokenizing

BinOp

Operators that require two operands, such as X + Y or X - Y

Call

Something being called

Expression

An expression, mostly useful for getting values

Field

Fields of a TableConstructor

FunctionArgs

Arguments used for a function

Index

The indexing of something, such as x.y or x["y"] Values of variants are the keys, such as "y"

LastStmt

The last statement of a Block

Parameter

A parameter in a function declaration

Prefix

A node used before another in cases such as function calling The ("foo") part of ("foo"):upper()

Stmt

A statement that stands alone

Suffix

A suffix in certain cases, such as :y() in x:y() Can be stacked on top of each other, such as in x()()()

UnOp

Operators that require just one operand, such as #X

Value

Values that cannot be used standalone, but as part of things such as Stmt

Var

Used in Assignments and Values