q/src/asm/Label.go

22 lines
407 B
Go

package asm
// Label represents a jump label.
type Label struct {
Name string
}
// String returns a human readable version.
func (data *Label) String() string {
return data.Name
}
// Label adds an instruction using a label.
func (a *Assembler) Label(mnemonic Mnemonic, name string) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: mnemonic,
Data: &Label{
Name: name,
},
})
}