Beispiel #1
0
func (assembler *LineList) ParseRAdr(currentLine string) error {
	source := token.NewSource(currentLine)
	temp := line.NewRAdr()
	err := temp.Parse(source)
	if err != nil {
		return err
	}
	assembler.Lines = append(assembler.Lines, temp)
	return nil
}
Beispiel #2
0
func TestRAdrParse(t *testing.T) {
	testCaseList := []testCaseForTestRAdrParse{
		{data: `     ADDA  GR0, ADR1`},
		{data: `     SUBA GR0, ADR1 ; COMMENT`},
		{data: `         LD      GR0, ='A'`},
		{data: `LABEL     SRL GR0, ADR1	; COMMENT`},
	}
	for _, testCase := range testCaseList {
		testData := testCase.data
		radr := line.NewRAdr()
		source := token.NewSource(testData)
		err := radr.Parse(source)
		if err != nil {
			t.Error(err)
		}
		// t.Error(radr)
	}
}