ast

package
v0.0.0-...-40ef3ae Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignStat

type AssignStat struct {
	LastLine int
	VarList  []Exp
	ExpList  []Exp
}

varlist ‘=’ explist varlist ::= var {‘,’ var} var ::= Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name

type BinopExp

type BinopExp struct {
	Line int // line of operator
	Op   int // operator
	Exp1 Exp
	Exp2 Exp
}

exp1 op exp2

type Block

type Block struct {
	LastLine int
	Stats    []Stat
	RetExps  []Exp
}

block ::= {stat} [retstat] retstat ::= return [explist] [‘;’] explist ::= exp {‘,’ exp}

type BreakStat

type BreakStat struct{ Line int } // break

type ConcatExp

type ConcatExp struct {
	Line int // line of last ..
	Exps []Exp
}

type DoStat

type DoStat struct{ Block *Block } // do block end

type EmptyStat

type EmptyStat struct{} // ‘;’

type Exp

type Exp interface{}

type FalseExp

type FalseExp struct{ Line int } // false

type FloatExp

type FloatExp struct {
	Line int
	Val  float64
}

type ForInStat

type ForInStat struct {
	LineOfDo int
	NameList []string
	ExpList  []Exp
	Block    *Block
}

for namelist in explist do block end namelist ::= Name {‘,’ Name} explist ::= exp {‘,’ exp}

type ForNumStat

type ForNumStat struct {
	LineOfFor int
	LineOfDo  int
	VarName   string
	InitExp   Exp
	LimitExp  Exp
	StepExp   Exp
	Block     *Block
}

for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end

type FuncCallExp

type FuncCallExp struct {
	Line      int // line of `(` ?
	LastLine  int // line of ')'
	PrefixExp Exp
	NameExp   *StringExp
	Args      []Exp
}

type FuncCallStat

type FuncCallStat = FuncCallExp // functioncall

type FuncDefExp

type FuncDefExp struct {
	Line     int
	LastLine int // line of `end`
	ParList  []string
	IsVararg bool
	Block    *Block
}

functiondef ::= function funcbody funcbody ::= ‘(’ [parlist] ‘)’ block end parlist ::= namelist [‘,’ ‘...’] | ‘...’ namelist ::= Name {‘,’ Name}

type GotoStat

type GotoStat struct{ Name string } // goto Name

type IfStat

type IfStat struct {
	Exps   []Exp
	Blocks []*Block
}

if exp then block {elseif exp then block} [else block] end

type IntegerExp

type IntegerExp struct {
	Line int
	Val  int64
}

Numeral

type LabelStat

type LabelStat struct{ Name string } // ‘::’ Name ‘::’

type LocalFuncDefStat

type LocalFuncDefStat struct {
	Name string
	Exp  *FuncDefExp
}

local function Name funcbody

type LocalVarDeclStat

type LocalVarDeclStat struct {
	LastLine int
	NameList []string
	ExpList  []Exp
}

local namelist [‘=’ explist] namelist ::= Name {‘,’ Name} explist ::= exp {‘,’ exp}

type NameExp

type NameExp struct {
	Line int
	Name string
}

type NilExp

type NilExp struct{ Line int } // nil

type ParensExp

type ParensExp struct {
	Exp Exp
}

type RepeatStat

type RepeatStat struct {
	Block *Block
	Exp   Exp
}

repeat block until exp

type Stat

type Stat interface{}

stat ::= ‘;’ |

varlist ‘=’ explist |
functioncall |
label |
break |
goto Name |
do block end |
while exp do block end |
repeat block until exp |
if exp then block {elseif exp then block} [else block] end |
for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end |
for namelist in explist do block end |
function funcname funcbody |
local function Name funcbody |
local namelist [‘=’ explist]

type StringExp

type StringExp struct {
	Line int
	Str  string
}

LiteralString

type TableAccessExp

type TableAccessExp struct {
	LastLine  int // line of `]` ?
	PrefixExp Exp
	KeyExp    Exp
}

type TableConstructorExp

type TableConstructorExp struct {
	Line     int // line of `{` ?
	LastLine int // line of `}`
	KeyExps  []Exp
	ValExps  []Exp
}

tableconstructor ::= ‘{’ [fieldlist] ‘}’ fieldlist ::= field {fieldsep field} [fieldsep] field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp fieldsep ::= ‘,’ | ‘;’

type TrueExp

type TrueExp struct{ Line int } // true

type UnopExp

type UnopExp struct {
	Line int // line of operator
	Op   int // operator
	Exp  Exp
}

unop exp

type VarargExp

type VarargExp struct{ Line int } // ...

type WhileStat

type WhileStat struct {
	Exp   Exp
	Block *Block
}

while exp do block end

Jump to

Keyboard shortcuts

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