RPGHacker / asar

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

if statement can no longer have a bracket on same line #291

Closed Ankouno closed 6 months ago

Ankouno commented 8 months ago

The following code:

if (condition) {
}
endif

Fails in v1.80+ with the error message Broken if command., but does work in v1.71 and earlier. Not sure if this is an intentional behavior change or not. First noticed with this submission on SMWC, which currently fails to execute due to the change: https://www.smwcentral.net/?p=section&a=details&id=19029

It's an easy fix on the ASM side at least since you just need to move the bracket to a new line, but just want to make sure if this change was intentional as I can't find anything stating such in the docs or changelog.

RPGHacker commented 8 months ago

I'm not sure if this was an intentional change or not, but I do think it not working is "more correct". Asar is supposed to treat { and } as no-op commands. Asar (prior to version 2.0) is also supposed to treat an if (something) followed by any command on the same line as an inline if statement that doesn't require an endif (or maybe it also needs a collon inbetween, I don't quite remember). So I'd say the code above should actually throw something like a misplaced endif error (or, if it does require a collon, then I guess the Broken if command is also correct).

Apparently, xkas treated { and } as whitespace, but in Asar, they're no-op commands.

randomdude999 commented 8 months ago

inline if statements do require the colon, yes. this is indeed a bug in if statement parsing, if 1 == 1 ghufjslghfsdjk works just as well. just fix the asm file and resubmit it i'd say.

randomdude999 commented 6 months ago

closing this as this was never supposed to work.