Reduced token size
This commit is contained in:
parent
7bfd0e731d
commit
1e3705df55
47 changed files with 543 additions and 764 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue