katsaii / catspeak-lang

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

Customisable language keywords #20

Closed katsaii closed 1 year ago

katsaii commented 2 years ago

This is a bit of an esoteric feature, but exposing a method of modifying the compiler internals in a stable way, such as which identifiers correspond to keywords. Maybe the catspeak_config function can be utilised for this:

catspeak_config({
  "keywords": { "func" : CatspeakToken.FUN },
});
katsaii commented 1 year ago

Added a similar behaviour to this in version 2.2.0. The syntax will be:

var config = catspeak_config();
config.keywords[$ "func"] = CatspeakToken.FUN;