Added escape sequences
This commit is contained in:
parent
85a6a957aa
commit
e5adcff1af
12 changed files with 87 additions and 7 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"git.akyoto.dev/cli/q/src/build/cpu"
|
||||
"git.akyoto.dev/cli/q/src/build/errors"
|
||||
"git.akyoto.dev/cli/q/src/build/expression"
|
||||
"git.akyoto.dev/cli/q/src/build/token"
|
||||
)
|
||||
|
||||
// ExpressionToRegister puts the result of an expression into the specified register.
|
||||
|
@ -29,6 +30,13 @@ func (f *Function) ExpressionToRegister(node *expression.Expression, register cp
|
|||
return err
|
||||
}
|
||||
|
||||
if node.Token.Kind == token.Array {
|
||||
array := f.VariableByName(node.Children[0].Token.Text(f.File.Bytes))
|
||||
offset, err := f.Number(node.Children[1].Token)
|
||||
f.MemoryRegister(asm.LOAD, asm.Memory{Base: array.Register, Offset: byte(offset), Length: 1}, register)
|
||||
return err
|
||||
}
|
||||
|
||||
if len(node.Children) == 1 {
|
||||
if !node.Token.IsUnaryOperator() {
|
||||
return errors.New(errors.MissingOperand, f.File, node.Token.End())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue