Пример #1
0
func (assembler *LineList) ParseR1R2(currentLine string) error {
	source := token.NewSource(currentLine)
	temp := line.NewR1R2()
	err := temp.Parse(source)
	if err != nil {
		return err
	}
	assembler.Lines = append(assembler.Lines, temp)
	return nil
}
Пример #2
0
func TestR1R2Parse(t *testing.T) {
	testCaseList := []testCaseForTestR1R2Parse{
		{data: `     LD		GR0, GR1`},
		{data: `     LD GR2		, 		GR3	; COMMENT`},
	}
	for _, testCase := range testCaseList {
		testData := testCase.data
		r1r2 := line.NewR1R2()
		source := token.NewSource(testData)
		err := r1r2.Parse(source)
		if err != nil {
			t.Error(err)
		}
		// t.Error(r1r2)
	}
}