ast

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNumber

func IsNumber(e ExpNode) bool

IsNumber returns true if the given expression node is a numerical value.

Types

type AssignStat

type AssignStat struct {
	Location
	Dest []Var
	Src  []ExpNode
}

AssignStat represents an assignment var1, ..., varN = src1, ..., srcM.

M and N do not have to be the same

func NewAssignStat

func NewAssignStat(dst []Var, src []ExpNode) AssignStat

NewAssignStat makes a new AssignStat.

func NewFunctionStat

func NewFunctionStat(fName Var, method Name, fx Function) AssignStat

NewFunctionStat returns an AssgnStat, ie. "function f() ..." gets transformed to "f = function() ...". This is a shortcut, probably should make a specific node for this.

func (AssignStat) HWrite

func (s AssignStat) HWrite(w HWriter)

HWrite prints the AST in tree form.

func (AssignStat) ProcessStat

func (s AssignStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type BFunctionCall

type BFunctionCall struct {
	Location
	Target ExpNode
	Method Name
	Args   []ExpNode
}

A BFunctionCall is an expression node that represents a function call surrounded by brackets. This changes the semantics of the call in some situations (e.g. ellipsis, tail calls).

For example:

return f(x)   -- this may return multiple values and will be subject to TCO
return (f(x)) -- this will only return one single value and will not be subject to TCO

func (BFunctionCall) HWrite

func (f BFunctionCall) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (BFunctionCall) ProcessExp

func (f BFunctionCall) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type BinOp

type BinOp struct {
	Location
	Left   ExpNode
	OpType ops.Op
	Right  []Operation
}

A BinOp is a expression node that represents any binary operator. The right hand side can be a list of operations of the same type (OpType). All operations of the same type have the same precedence and can be merged into a list.

func NewBinOp

func NewBinOp(left ExpNode, op ops.Op, opTok *token.Token, right ExpNode) *BinOp

NewBinOp creates a new BinOp from the given arguments. If the left node is already a BinOp node with the same operator type, a new node based on that will be created.

func (BinOp) HWrite

func (b BinOp) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (BinOp) ProcessExp

func (b BinOp) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type BlockStat

type BlockStat struct {
	Location
	Stats  []Stat
	Return []ExpNode
}

A BlockStat is a statement node that represents a block of statements, optionally ending in a return statement (if Return is not a nil slice - note that a bare return is encoded as a non-nil slice of length 0).

func NewBlockStat

func NewBlockStat(stats []Stat, rtn []ExpNode) BlockStat

NewBlockStat returns a BlockStat instance conatining the given stats and return statement.

func (BlockStat) HWrite

func (s BlockStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (BlockStat) ProcessStat

func (s BlockStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type Bool

type Bool struct {
	Location
	Val bool
}

Bool is an expression node representing a boolean literal.

func False

func False(tok *token.Token) Bool

False is a false boolean literal.

func True

func True(tok *token.Token) Bool

True is a true boolean literal.

func (Bool) HWrite

func (b Bool) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Bool) ProcessExp

func (b Bool) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type BreakStat

type BreakStat struct {
	Location
}

BreakStat is a statement node representing the "break" statement.

func NewBreakStat

func NewBreakStat(tok *token.Token) BreakStat

NewBreakStat returns a BreakStat instance (the token is needed to record the location of the statement).

func (BreakStat) HWrite

func (s BreakStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (BreakStat) ProcessStat

func (s BreakStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type CondStat

type CondStat struct {
	Cond ExpNode
	Body BlockStat
}

CondStat is a conditional statement, used in e.g. if statements and while / repeat until loops.

func (CondStat) HWrite

func (s CondStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

type EmptyStat

type EmptyStat struct {
	Location
}

EmptyStat is a statement expression containing an empty statement.

func NewEmptyStat

func NewEmptyStat(tok *token.Token) EmptyStat

NewEmptyStat returns an EmptyStat instance (located from the given token).

func (EmptyStat) HWrite

func (s EmptyStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (EmptyStat) ProcessStat

func (s EmptyStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type Etc

type Etc struct {
	Location
}

Etc is the "..." expression node (ellipsis).

func NewEtc

func NewEtc(tok *token.Token) Etc

NewEtc returns an Etc instance at the location given by the passed token.

func (Etc) HWrite

func (e Etc) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Etc) ProcessExp

func (e Etc) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

func (Etc) ProcessTailExp

func (e Etc) ProcessTailExp(p TailExpProcessor)

ProcessTailExp uses the given TailExpProcessor to process the reveiver.

type ExpNode

type ExpNode interface {
	Node
	ProcessExp(ExpProcessor)
}

ExpNode is an expression

func NewNumber

func NewNumber(id *token.Token) (ExpNode, error)

NewNumber returns an ExpNode that represents the numeric literal in the given token, or an error if it's not a valid numeric literal (the error should not happen, perhaps panic instead?).

type ExpProcessor

type ExpProcessor interface {
	ProcessBFunctionCallExp(BFunctionCall)
	ProcessBinOpExp(BinOp)
	ProcesBoolExp(Bool)
	ProcessEtcExp(Etc)
	ProcessFunctionExp(Function)
	ProcessFunctionCallExp(FunctionCall)
	ProcessIndexExp(IndexExp)
	ProcessNameExp(Name)
	ProcessNilExp(Nil)
	ProcessIntExp(Int)
	ProcessFloatExp(Float)
	ProcessStringExp(String)
	ProcessTableConstructorExp(TableConstructor)
	ProcessUnOpExp(UnOp)
}

An ExpProcessor can process all implementations of ExpNode (i.e. expressions)

type Float

type Float struct {
	Location
	Val float64
}

Float is an expression node representing a floating point numeric literal.

func NewFloat

func NewFloat(x float64) Float

NewFloat returns a Float instance with the given value.

func (Float) HWrite

func (f Float) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Float) ProcessExp

func (f Float) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type ForInStat

type ForInStat struct {
	Location
	Vars   []Name
	Params []ExpNode
	Body   BlockStat
}

ForInStat is a statement node representing the "for Vars in Params do Body end" statement.

func NewForInStat

func NewForInStat(startTok, endTok *token.Token, itervars []Name, params []ExpNode, body BlockStat) *ForInStat

NewForInStat returns a ForInStat instance from the given parts.

func (ForInStat) HWrite

func (s ForInStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (ForInStat) ProcessStat

func (s ForInStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type ForStat

type ForStat struct {
	Location
	Var   Name
	Start ExpNode
	Stop  ExpNode
	Step  ExpNode
	Body  BlockStat
}

ForStat represents the statement node "for Var = Start, Stop, Step do Body end".

func NewForStat

func NewForStat(startTok, endTok *token.Token, itervar Name, params []ExpNode, body BlockStat) *ForStat

NewForStat returns a ForStat from the given parts.

func (ForStat) HWrite

func (s ForStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (ForStat) ProcessStat

func (s ForStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type Function

type Function struct {
	Location
	ParList
	Body BlockStat
	Name string
}

A Function is an expression node representing a function definition, i.e. "function Name(ParList) do Body end". The Name is optional.

func NewFunction

func NewFunction(startTok, endTok *token.Token, parList ParList, body BlockStat) Function

NewFunction returns a Function instance built from the given arguments.

func (Function) HWrite

func (f Function) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Function) ProcessExp

func (f Function) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type FunctionCall

type FunctionCall struct {
	*BFunctionCall
}

A FunctionCall is an expression node that represents a function call.

func NewFunctionCall

func NewFunctionCall(target ExpNode, method Name, args []ExpNode) FunctionCall

NewFunctionCall returns a FunctionCall instance representing the call of <target> with <args>. The <method> arg should be non-nil if the call syntax included ":", e.g. stack:pop().

func (FunctionCall) InBrackets

func (f FunctionCall) InBrackets() *BFunctionCall

InBrackets turns the receiver into a BFunctionCall.

func (FunctionCall) ProcessExp

func (f FunctionCall) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

func (FunctionCall) ProcessStat

func (f FunctionCall) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

func (FunctionCall) ProcessTailExp

func (f FunctionCall) ProcessTailExp(p TailExpProcessor)

ProcessTailExp uses the give TailExpProcessor to process the receiver.

type GotoStat

type GotoStat struct {
	Location
	Label Name
}

GotoStat is a statement node representing a goto statement.

func NewGotoStat

func NewGotoStat(gotoTok *token.Token, lbl Name) GotoStat

NewGotoStat returns a GotoStat instance with the given label.

func (GotoStat) HWrite

func (s GotoStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (GotoStat) ProcessStat

func (s GotoStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type HWriter

type HWriter interface {
	Writef(string, ...interface{})
	Indent()
	Dedent()
	Next()
}

HWriter is an interface for printing nodes

type IfStat

type IfStat struct {
	Location
	If      CondStat
	ElseIfs []CondStat
	Else    *BlockStat
}

IfStat is a statement node representing an "if ... [elseif] ... [else] ... end" statement, where the else clause is optional and there can be 0 or more elseif clauses.

func NewIfStat

func NewIfStat(ifTok *token.Token, cond ExpNode, body BlockStat) IfStat

NewIfStat returns an IfStat with the given condition and then clause.

func (IfStat) AddElseIf

func (s IfStat) AddElseIf(cond ExpNode, body BlockStat) IfStat

AddElseIf returns an IfStat based on the receiver but adding an extra elseif clause.

func (IfStat) HWrite

func (s IfStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (IfStat) ProcessStat

func (s IfStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

func (IfStat) WithElse

func (s IfStat) WithElse(endTok *token.Token, body BlockStat) IfStat

WithElse returns an IfStat based on the receiver but with the given else clause.

type IndentWriter

type IndentWriter struct {
	// contains filtered or unexported fields
}

IndentWriter is an implementation of HWriter that writes AST with indentation to show the tree structure.

func NewIndentWriter

func NewIndentWriter(w io.Writer) *IndentWriter

NewIndentWriter returns a new pointer to IndentWriter that will write using the given io.Writer.

func (*IndentWriter) Dedent

func (w *IndentWriter) Dedent()

Dedent decrements the current indentation by one level.

func (*IndentWriter) Indent

func (w *IndentWriter) Indent()

Indent increments the current indentation by one level.

func (*IndentWriter) Next

func (w *IndentWriter) Next()

Next moves on to the next line and adds the necessary indentation.

func (*IndentWriter) Writef

func (w *IndentWriter) Writef(f string, args ...interface{})

Writef is like Printf.

type IndexExp

type IndexExp struct {
	Location
	Coll ExpNode
	Idx  ExpNode
}

An IndexExp is an expression node representing indexing, i.e. "Coll[Index]".

func NewIndexExp

func NewIndexExp(coll ExpNode, idx ExpNode) IndexExp

NewIndexExp returns an IndexExp instance for the given collection and index.

func (IndexExp) FunctionName

func (e IndexExp) FunctionName() string

FunctionName returns the function name associated with this expression (i.e. if it is part of a function definition statement), or an empty string if there is no sensible name.

func (IndexExp) HWrite

func (e IndexExp) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (IndexExp) ProcessExp

func (e IndexExp) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

func (IndexExp) ProcessVar

func (e IndexExp) ProcessVar(p VarProcessor)

ProcessVar uses the given VarProcessor to process the receiver.

type Int

type Int struct {
	Location
	Val uint64
}

Int is an expression node representing a non-negative integer literal.

func NewInt

func NewInt(val uint64) Int

NewInt returns an Int instance with the given value.

func (Int) HWrite

func (n Int) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Int) ProcessExp

func (n Int) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type LabelStat

type LabelStat struct {
	Location
	Name
}

LabelStat is a statement node that represents a label.

func NewLabelStat

func NewLabelStat(label Name) LabelStat

NewLabelStat returns a LabelStat instance for the given label.

func (LabelStat) HWrite

func (s LabelStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (LabelStat) ProcessStat

func (s LabelStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type LocalAttrib

type LocalAttrib uint8

LocalAttrib is the type of a local name attrib

const (
	NoAttrib    LocalAttrib = iota
	ConstAttrib             // <const>, introduced in Lua 5.4
	CloseAttrib             // <close>, introduced in Lua 5.4
)

Valid values for LocalAttrib

type LocalFunctionStat

type LocalFunctionStat struct {
	Location
	Function
	Name Name
}

LocalFunctionStat is a statement node that represents a local function definition, i.e. "local function Name() ...".

func NewLocalFunctionStat

func NewLocalFunctionStat(name Name, fx Function) LocalFunctionStat

NewLocalFunctionStat returns a LocalFunctionStat instance for the given name and function definition.

func (LocalFunctionStat) HWrite

func (s LocalFunctionStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (LocalFunctionStat) ProcessStat

func (s LocalFunctionStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type LocalStat

type LocalStat struct {
	Location
	NameAttribs []NameAttrib
	Values      []ExpNode
}

LocalStat is a statement node representing the declaration / definition of a list of local variables.

func NewLocalStat

func NewLocalStat(nameAttribs []NameAttrib, values []ExpNode) LocalStat

NewLocalStat returns a LocalStat instance defining the given names with the given values.

func (LocalStat) HWrite

func (s LocalStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (LocalStat) ProcessStat

func (s LocalStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type Location

type Location struct {
	// contains filtered or unexported fields
}

A Location is a span between two token in the source code.

func LocFromToken

func LocFromToken(tok *token.Token) Location

LocFromToken returns a location that starts and ends at the token's position.

func LocFromTokens

func LocFromTokens(t1, t2 *token.Token) Location

LocFromTokens returns a location that starts at t1 and ends at t2 (t1 and t2 may be nil).

func MergeLocations

func MergeLocations(l1, l2 Locator) Location

MergeLocations takes two locators and merges them into one Location, starting at the earliest start and ending at the latest end.

func (Location) EndPos

func (l Location) EndPos() *token.Pos

EndPos returns the end position of the location.

func (Location) Locate

func (l Location) Locate() Location

Locate returns the receiver.

func (Location) StartPos

func (l Location) StartPos() *token.Pos

StartPos returns the start position of the location.

type Locator

type Locator interface {
	Locate() Location
}

Locator can provide a location in code. All AST nodes are locators.

type Name

type Name struct {
	Location
	Val string
}

Name is an expression token representing a name (identifier).

func NewName

func NewName(id *token.Token) Name

NewName returns a Name instance with value taken from the given token.

func (Name) AstString

func (n Name) AstString() String

AstString returns a String with the same value and location as the receiver.

func (Name) FunctionName

func (n Name) FunctionName() string

FunctionName returns the string associated with the name.

func (Name) HWrite

func (n Name) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Name) ProcessExp

func (n Name) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

func (Name) ProcessVar

func (n Name) ProcessVar(p VarProcessor)

ProcessVar process the receiver using the given VarProcessor.

type NameAttrib

type NameAttrib struct {
	Location
	Name   Name
	Attrib LocalAttrib
}

A NameAttrib is a name introduce by a local definition, together with an optional attribute (in Lua 5.4 that is 'close' or 'const').

func NewNameAttrib

func NewNameAttrib(name Name, attribName *Name, attrib LocalAttrib) NameAttrib

NewNameAttrib returns a new NameAttribe for the given name and attrib.

type Nil

type Nil struct {
	Location
}

Nil is an expression node representing "nil".

func NewNil

func NewNil(tok *token.Token) Nil

NewNil returns a Nil instance located where the given token is.

func (Nil) HWrite

func (n Nil) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (Nil) ProcessExp

func (n Nil) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type NoTableKey

type NoTableKey struct {
	Location
}

NoTableKey is a special expression node that can only be used as the Key of a TableField, meaning a field with no key.

func (NoTableKey) HWrite

func (k NoTableKey) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (NoTableKey) ProcessExp

func (k NoTableKey) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver. It panics as this type is a placeholder that should not be processed as an expression.

type Node

type Node interface {
	Locator
	HWrite(w HWriter)
}

Node is a node in the AST

type Operation

type Operation struct {
	Op      ops.Op
	Operand ExpNode
}

An Operation is a pair (operator, operand) which can be applied to an expression node (e.g. "+ 2" or "/ 5").

type ParList

type ParList struct {
	Params  []Name
	HasDots bool
}

A ParList represents a function parameter list (it is not a node).

func NewParList

func NewParList(params []Name, hasDots bool) ParList

NewParList returns ParList instance for the given parameters.

type RepeatStat

type RepeatStat struct {
	Location
	CondStat
}

RepeatStat ia a statement expression that represents a repeat / until statement.

func NewRepeatStat

func NewRepeatStat(repTok *token.Token, body BlockStat, cond ExpNode) RepeatStat

NewRepeatStat returns a RepeatStat instance representing the statement "repeat <body> until <cond>".

func (RepeatStat) HWrite

func (s RepeatStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (RepeatStat) ProcessStat

func (s RepeatStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

type Stat

type Stat interface {
	Node
	ProcessStat(StatProcessor)
}

Stat is a statement

type StatProcessor

type StatProcessor interface {
	ProcessAssignStat(AssignStat)
	ProcessBlockStat(BlockStat)
	ProcessBreakStat(BreakStat)
	ProcessEmptyStat(EmptyStat)
	ProcessForInStat(ForInStat)
	ProcessForStat(ForStat)
	ProcessFunctionCallStat(FunctionCall)
	ProcessGotoStat(GotoStat)
	ProcessIfStat(IfStat)
	ProcessLabelStat(LabelStat)
	ProcessLocalFunctionStat(LocalFunctionStat)
	ProcessLocalStat(LocalStat)
	ProcessRepeatStat(RepeatStat)
	ProcessWhileStat(WhileStat)
}

A StatProcessor can process all implementations of Stat (i.e. statements).

type String

type String struct {
	Location
	Val []byte
}

String is a string literal.

func NewLongString

func NewLongString(id *token.Token) String

NewLongString returns a String computed from a token containing a Lua long string.

func NewString

func NewString(id *token.Token) (ss String, err error)

NewString returns a String from a token containing a Lua short string literal, or an error if it couln't (although perhaps it should panic instead? Parsing should ensure well-formed string token).

func (String) HWrite

func (s String) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (String) ProcessExp

func (s String) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type TableConstructor

type TableConstructor struct {
	Location
	Fields []TableField
}

A TableConstructor is an expression node representing a table literal, e.g.

{ "hello", 4.5, x = 2, [z] = true }

func NewTableConstructor

func NewTableConstructor(opTok, clTok *token.Token, fields []TableField) TableConstructor

NewTableConstructor returns a TableConstructor instance with the given fields.

func (TableConstructor) HWrite

func (c TableConstructor) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (TableConstructor) ProcessExp

func (c TableConstructor) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type TableField

type TableField struct {
	Location
	Key   ExpNode
	Value ExpNode
}

A TableField is a (key, value ) pair of expression nodes representing a field in a table literal. There is a special key type called "NoTableKey" for fields that do not have a key.

func NewTableField

func NewTableField(key ExpNode, value ExpNode) TableField

type TailExpNode

type TailExpNode interface {
	Node
	ProcessTailExp(TailExpProcessor)
}

TailExpNode is an expression which can be the tail of an exp list

type TailExpProcessor

type TailExpProcessor interface {
	ProcessEtcTailExp(Etc)
	ProcessFunctionCallTailExp(FunctionCall)
}

A TailExpProcessor can process all implementations fo TailExpNode.

type UnOp

type UnOp struct {
	Location
	Op      ops.Op
	Operand ExpNode
}

An UnOp is an expression node representing the application of a unary operation on an expression.

func NewUnOp

func NewUnOp(opTok *token.Token, op ops.Op, exp ExpNode) *UnOp

NewUnOp returns a UnOp instance from the given operator an expression.

func (UnOp) HWrite

func (u UnOp) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (UnOp) ProcessExp

func (u UnOp) ProcessExp(p ExpProcessor)

ProcessExp uses the given ExpProcessor to process the receiver.

type Var

type Var interface {
	ExpNode
	FunctionName() string
	ProcessVar(VarProcessor)
}

Var is an l-value, i.e. it can be assigned to.

type VarProcessor

type VarProcessor interface {
	ProcessIndexExpVar(IndexExp)
	ProcessNameVar(Name)
}

A VarProcessor can process all types of l-values.

type WhileStat

type WhileStat struct {
	Location
	CondStat
}

WhileStat represents a while / end statement

func NewWhileStat

func NewWhileStat(whileTok, endTok *token.Token, cond ExpNode, body BlockStat) WhileStat

NewWhileStat returns a WhileStat instance representing the statement "while <cond> do <body> done".

func (WhileStat) HWrite

func (s WhileStat) HWrite(w HWriter)

HWrite prints a tree representation of the node.

func (WhileStat) ProcessStat

func (s WhileStat) ProcessStat(p StatProcessor)

ProcessStat uses the given StatProcessor to process the receiver.

Jump to

Keyboard shortcuts

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