katsaii / catspeak-lang

A cross-platform modding language for GameMaker games.
https://www.katsaii.com/catspeak-lang/
MIT License
81 stars 4 forks source link

`or` and `and` operators not working #74

Closed tabularelf closed 10 months ago

tabularelf commented 10 months ago

What is the bug? How did it happen?

Seems that or and and do not work in Catspeak currently. Upon compiling a function, the following error is returned.

Variable CatspeakParser.op(100050, -2147483648) not set before reading it.
at gml_Script_anon_CatspeakParser_gml_GlobalScript_scr_catspeak_parser_8905_CatspeakParser_gml_GlobalScript_scr_catspeak_parser (line 260) -                 result = asg.createOr(op, lhs, rhs, lexer.getLocation());

Upon further investigation, seems that op wasn't meant to be there. And neither or nor and were defined under __productionLookup.

What was the expected behaviour?

This code here

foo = "bar";

if (foo == "boot" or foo == "bar") {
    show_debug_message("Tada!!");
}

Should compile and compare whether foo is boot or bar. Note: show_debug_message() was added in as a function via .addFunction

Version

3.0.0-beta3