コード例 #1
0
ファイル: none.go プロジェクト: mm0205/gcasl
// NewNone returns a none.
func NewNone() *None {
	return &None{
		Label:   token.NewLabel(),
		Opcode:  token.NewOpcode(),
		Comment: token.NewComment(),
	}
}
コード例 #2
0
ファイル: start.go プロジェクト: mm0205/gcasl
// NewStart returns a start.
func NewStart() *Start {
	return &Start{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewAddress(),
		Comment:  token.NewComment(),
	}
}
コード例 #3
0
ファイル: dc.go プロジェクト: mm0205/gcasl
// NewDC returns a dc.
func NewDC() *DC {
	return &DC{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operands: []token.Token{},
		Comment:  token.NewComment(),
	}
}
コード例 #4
0
ファイル: ds.go プロジェクト: mm0205/gcasl
// NewDS returns a ds.
func NewDS() *DS {
	return &DS{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewNumber(),
		Comment:  token.NewComment(),
	}
}
コード例 #5
0
ファイル: adr.go プロジェクト: mm0205/gcasl
// NewAdr returns a adr.
func NewAdr() *Adr {
	return &Adr{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewAddress(),
		Comment:  token.NewComment(),
	}
}
コード例 #6
0
ファイル: r.go プロジェクト: mm0205/gcasl
// NewR returns a r.
func NewR() *R {
	return &R{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewRegister(),
		Comment:  token.NewComment(),
	}
}
コード例 #7
0
ファイル: radr.go プロジェクト: mm0205/gcasl
// NewRAdr returns a radr.
func NewRAdr() *RAdr {
	return &RAdr{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewRegister(),
		Operand2: token.NewAddress(),
		Comment:  token.NewComment(),
	}
}
コード例 #8
0
ファイル: inout.go プロジェクト: mm0205/gcasl
// NewInOut returns a inout.
func NewInOut() *InOut {
	return &InOut{
		Label:    token.NewLabel(),
		Opcode:   token.NewOpcode(),
		Operand1: token.NewOperandLabel(),
		Operand2: token.NewOperandLabel(),
		Comment:  token.NewComment(),
	}
}
コード例 #9
0
ファイル: label_test.go プロジェクト: mm0205/gcasl
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)
	}
}
コード例 #10
0
ファイル: register_test.go プロジェクト: mm0205/gcasl
func TestRegisterParse(t *testing.T) {
	testCaseList := []testCaseForTestRegisterParse{
		{data: `							LD      GR0, DATA1`},
		{data: `							LD      GR0, 65535`},
		{data: `							LD      GR0, #ABCD`},
		{data: `							LD      GR0, =12345`},
		{data: `							LD      GR0, =#1FE0`},
		{data: `							LD      GR0, ='string'`},
		{data: `							LD      GR0, ='''is esacped quote'`},
	}
	for _, testCase := range testCaseList {
		testData := testCase.data

		source := token.NewSource(testData)
		opcode := token.NewOpcode()
		err := opcode.Parse(source)
		if err != nil {
			t.Error(err)
		}

		register := token.NewRegister()
		err = register.Parse(source)
		if err != nil {
			t.Error(err)
		}

		comma := token.NewComma()
		err = comma.Parse(source)
		if err != nil {
			t.Error(err)
		}
		address := token.NewAddress()
		err = address.Parse(source)
		if err != nil {
			t.Error(err)
		}
	}
}
コード例 #11
0
ファイル: end.go プロジェクト: mm0205/gcasl
// NewEnd returns a end.
func NewEnd() *End {
	return &End{
		Opcode:  token.NewOpcode(),
		Comment: token.NewComment(),
	}
}