Improved tokenizer

This commit is contained in:
2023-10-31 21:13:14 +01:00
parent 5c12992fca
commit c4b28fb66e
10 changed files with 57 additions and 53 deletions

View File

@ -22,7 +22,7 @@ func New() *Assembler {
}
// Finalize generates the final machine code.
func (a *Assembler) Finalize(verbose bool) ([]byte, []byte) {
func (a *Assembler) Finalize() ([]byte, []byte) {
code := make([]byte, 0, len(a.Instructions)*8)
data := make(Data, 0, 16)
pointers := []Pointer{}
@ -45,7 +45,7 @@ func (a *Assembler) Finalize(verbose bool) ([]byte, []byte) {
}
}
if verbose {
if config.Verbose {
for _, x := range a.Instructions {
log.Info.Println(x.String())
}

View File

@ -23,7 +23,7 @@ func TestHello(t *testing.T) {
a.MoveRegisterNumber(register.Syscall1, 0)
a.Syscall()
code, data := a.Finalize(false)
code, data := a.Finalize()
assert.DeepEqual(t, code, []byte{
0xb8, 0x01, 0x00, 0x00, 0x00,