github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/ast/breakstat.go (about) 1 package ast 2 3 import ( 4 "github.com/arnodel/golua/token" 5 ) 6 7 // BreakStat is a statement node representing the "break" statement. 8 type BreakStat struct { 9 Location 10 } 11 12 var _ Stat = BreakStat{} 13 14 // NewBreakStat returns a BreakStat instance (the token is needed to record the 15 // location of the statement). 16 func NewBreakStat(tok *token.Token) BreakStat { 17 return BreakStat{Location: LocFromToken(tok)} 18 } 19 20 // HWrite prints a tree representation of the node. 21 func (s BreakStat) HWrite(w HWriter) { 22 w.Writef("break") 23 } 24 25 // ProcessStat uses the given StatProcessor to process the receiver. 26 func (s BreakStat) ProcessStat(p StatProcessor) { 27 p.ProcessBreakStat(s) 28 }