Implemented data labels
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/build/asm"
|
||||
@ -37,7 +38,12 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
|
||||
return nil
|
||||
|
||||
case token.String:
|
||||
return errors.New(errors.NotImplemented, f.File, t.Position)
|
||||
value := t.Text()[1 : len(t.Bytes)-1]
|
||||
label := fmt.Sprintf("%s_data_%d", f.Name, f.count.data)
|
||||
f.assembler.Data[label] = []byte(value)
|
||||
f.RegisterLabel(asm.MOVE, register, label)
|
||||
f.count.data++
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.New(errors.InvalidExpression, f.File, t.Position)
|
||||
|
Reference in New Issue
Block a user