RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
204 stars 44 forks source link

Error is not thrown when `elseif` has a space e.g. `else if`, case is considered false instead. #195

Closed Atari2 closed 3 years ago

Atari2 commented 3 years ago

When elseif is written like else if asar will not throw an error but instead it'll just consider the statement following the else if automatically false. Snippet of code to reproduce:

org $008000
if 0 == 1
        db $00
else if 1 == 1
        db $01
else
        db $02
endif

This'll write $02 instead of throwing an error (or writing $01, but we all know asar hates whitespace). Screenshot to already ran example with counterexample: here

randomdude999 commented 3 years ago

i mean, to be precise, it doesn't consider the condition false, it just doesn't realize there's a condition there at all. and since this is in an inactive if statement, there are no unknown command errors either. anyways, fixed now. i also made it an error to have endif with arguments, though i doubt anyone would hit that.