// NewNone returns a none. func NewNone() *None { return &None{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Comment: token.NewComment(), } }
// NewStart returns a start. func NewStart() *Start { return &Start{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewAddress(), Comment: token.NewComment(), } }
// NewDC returns a dc. func NewDC() *DC { return &DC{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operands: []token.Token{}, Comment: token.NewComment(), } }
// NewDS returns a ds. func NewDS() *DS { return &DS{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewNumber(), Comment: token.NewComment(), } }
// NewAdr returns a adr. func NewAdr() *Adr { return &Adr{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewAddress(), Comment: token.NewComment(), } }
// NewR returns a r. func NewR() *R { return &R{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewRegister(), Comment: token.NewComment(), } }
// NewRAdr returns a radr. func NewRAdr() *RAdr { return &RAdr{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewRegister(), Operand2: token.NewAddress(), Comment: token.NewComment(), } }
// NewInOut returns a inout. func NewInOut() *InOut { return &InOut{ Label: token.NewLabel(), Opcode: token.NewOpcode(), Operand1: token.NewOperandLabel(), Operand2: token.NewOperandLabel(), Comment: token.NewComment(), } }
func TestLabelParse(t *testing.T) { label := token.NewLabel() source := token.NewSource("MAIN START") err := label.Parse(source) if err != nil { t.Error(err) } if label.TextValue() != "MAIN" { t.Errorf("Label error %#v", label) } opcode := token.NewOpcode() err = opcode.Parse(source) if err != nil { t.Error(err) } if opcode.TextValue() != "START" { t.Errorf("Label error %#v", opcode) } }