github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/ast/labelstat.go (about)

     1  package ast
     2  
     3  // LabelStat is a statement node that represents a label.
     4  type LabelStat struct {
     5  	Location
     6  	Name
     7  }
     8  
     9  var _ Stat = LabelStat{}
    10  
    11  // NewLabelStat returns a LabelStat instance for the given label.
    12  func NewLabelStat(label Name) LabelStat {
    13  	return LabelStat{Location: label.Location, Name: label}
    14  }
    15  
    16  // ProcessStat uses the given StatProcessor to process the receiver.
    17  func (s LabelStat) ProcessStat(p StatProcessor) {
    18  	p.ProcessLabelStat(s)
    19  }
    20  
    21  // HWrite prints a tree representation of the node.
    22  func (s LabelStat) HWrite(w HWriter) {
    23  	w.Writef("label %s", s.Name.Val)
    24  }