Skip to content

Commit

Permalink
Combined common condition in tokenise.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmorgan committed Mar 27, 2024
1 parent a1e1054 commit 8c19bb6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions parser/tokenise.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ func Tokenise(input io.ByteReader) (program []Instruction, err error) {
pc--
}
case opAddVal:
if program[pc-1].SameOp(instruction) {
program[pc-1].operand += instruction.operand
program = program[:pc]
pc--
} else if program[pc-1].operator == opSetVal {
if program[pc-1].SameOp(instruction) ||
program[pc-1].operator == opSetVal {
program[pc-1].operand += instruction.operand
program = program[:pc]
pc--
Expand Down

0 comments on commit 8c19bb6

Please sign in to comment.