ast

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	ExpList          []Exp
	TableConstructor ComplexExp
	String           token.Token
}

Args is an argument list when calling a function.

type Assignment

type Assignment struct {
	VarList []Var
	ExpList []Exp
}

Assignment is a Lua assignment. An expression list is assigned to a variable list.

type BinopExp

type BinopExp struct {
	Left  Exp
	Binop token.Token
	Right Exp
}

BinopExp is a binary expression.

type Block

type Block []Statement

Block is a list of statements. At least one statement is present. The last Statement may be of type LastStatement.

func (Block) LastStatement

func (b Block) LastStatement() (Statement, bool)

LastStatement returns the LastStatement in this Block, or false, if there is no LastStatement in this Block.

func (Block) StatementsWithoutLast

func (b Block) StatementsWithoutLast() []Statement

StatementsWithoutLast returns all statements in this Block that are not a LastStatement.

type Chunk

type Chunk struct {
	Name string
	Block
}

Chunk is just a Block, but is expected to run in a separate scope.

type ComplexExp

type ComplexExp interface {
	// contains filtered or unexported methods
}

ComplexExp is a not necessarily constant expression.

type DoBlock

type DoBlock struct {
	Do Block
}

DoBlock is a Lua do construct.

type ElseIf

type ElseIf struct {
	If   Exp
	Then Block
}

ElseIf is a Lua elseif construct.

type Exp

type Exp interface {
	// contains filtered or unexported methods
}

Exp is a Lua expression. This is either a SimpleExp or a ComplexExp.

type Field

type Field struct {
	LeftExp  Exp
	LeftName token.Token
	RightExp Exp
}

Field is a field in a table constructor.

func (Field) Anonymous

func (f Field) Anonymous() bool

type ForBlock

type ForBlock struct {
	Name token.Token
	From Exp
	To   Exp
	Step Exp
	Do   Block
}

ForBlock is a Lua for construct, using the production from,to,step.

type ForInBlock

type ForInBlock struct {
	NameList []token.Token
	In       []Exp
	Do       Block
}

ForInBlock is a Lua for in construct.

type FuncBody

type FuncBody struct {
	ParList ParList
	Block   Block
}

FuncBody is a Lua function body, including the parameter list.

type FuncName

type FuncName struct {
	Name1 []token.Token
	Name2 token.Token
}

FuncName is a function name, e.g. a.b.c:d or just foo.bar.

type Function

type Function struct {
	FuncName *FuncName
	FuncBody FuncBody
}

Function is a Lua function.

type FunctionCall

type FunctionCall struct {
	PrefixExp PrefixExp
}

FunctionCall is a Lua function call.

type IfBlock

type IfBlock struct {
	If     Exp
	Then   Block
	ElseIf []ElseIf
	Else   Block
}

IfBlock is a Lua if construct.

type LastStatement

type LastStatement struct {
	ExpList []Exp
	Break   bool
}

LastStatement is a Lua last statement in a Block.

type Local

type Local struct {
	NameList []token.Token
	ExpList  []Exp
}

Local is a Lua local construct.

type LocalFunction

type LocalFunction struct {
	Name     token.Token
	FuncBody FuncBody
}

LocalFunction is a Lua local function construct.

type ParList

type ParList struct {
	NameList []token.Token
	Ellipsis bool
}

ParList is a function parameter list.

type PrefixExp

type PrefixExp struct {
	Name token.Token
	Exp  Exp

	Fragments []PrefixExpFragment
}

PrefixExp is a prefix expression.

type PrefixExpFragment

type PrefixExpFragment struct {
	Exp  Exp
	Name token.Token
	Args *Args
}

type RepeatBlock

type RepeatBlock struct {
	Repeat Block
	Until  Exp
}

RepeatBlock is a Lua repeat construct.

type SimpleExp

type SimpleExp struct {
	Nil      token.Token
	False    token.Token
	True     token.Token
	Number   token.Token
	String   token.Token
	Ellipsis token.Token
}

SimpleExp is a simple and constant expression.

type Statement

type Statement interface {
	// contains filtered or unexported methods
}

Statement is a Lua statement.

type TableConstructor

type TableConstructor struct {
	Fields []Field
}

TableConstructor is a table constructor, which consists of a list of Fields.

type UnopExp

type UnopExp struct {
	Unop token.Token
	Exp  Exp
}

UnopExp is a unary expression.

type Var

type Var struct {
	PrefixExp
}

Var is a variable declaration without assignment.

type WhileBlock

type WhileBlock struct {
	While Exp
	Do    Block
}

WhileBlock is a Lua while construct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL