Reduced token size

This commit is contained in:
Eduard Urbach 2024-07-21 14:35:06 +02:00
parent 7bfd0e731d
commit 1e3705df55
Signed by: eduard
GPG key ID: 49226B848C78F6C8
47 changed files with 543 additions and 764 deletions

View file

@ -2,22 +2,23 @@ package core
import (
"git.akyoto.dev/cli/q/src/build/asm"
"git.akyoto.dev/cli/q/src/build/token"
)
// JumpIfTrue jumps to the label if the previous comparison was true.
func (f *Function) JumpIfTrue(operator string, label string) {
func (f *Function) JumpIfTrue(operator token.Kind, label string) {
switch operator {
case "==":
case token.Equal:
f.Jump(asm.JE, label)
case "!=":
case token.NotEqual:
f.Jump(asm.JNE, label)
case ">":
case token.Greater:
f.Jump(asm.JG, label)
case "<":
case token.Less:
f.Jump(asm.JL, label)
case ">=":
case token.GreaterEqual:
f.Jump(asm.JGE, label)
case "<=":
case token.LessEqual:
f.Jump(asm.JLE, label)
}
}