Closed VinnyVicious closed 3 months ago
Well, you can use a token mapper to remap these tokens into let
and fn
... or remap let
into a parse error...
The tokenizer is closed, the syntax is closed, but you can do certain manipulation within the gaps...
https://rhai.rs/book/engine/token-mapper.html
You can, of course, disable certain keywords altogether and they'll parse as errors. That's standard feature. Check out https://rhai.rs/book/engine/disable-keywords.html
Removing let
though would not allow variables to be declared, though. I just want it to be foo = 5
instead of let foo = 5
. Or maybe $foo = 5
Removing let though would not allow variables to be declared, though. I just want it to be foo = 5 instead of let foo = 5. Or maybe $foo = 5
As I mentioned, it is not possible to alter Rhai's syntax, meaning that you can't do these.
For $foo
you may try a custom syntax... but it really is not recommended for you to alter Rhai's syntax to accommodate another language. Perhaps you should fork Rhai and directly modify its syntax to suit yours...
Thank you for the clarification, that does make sense.
With Rhai, is it possible to rename the keyword
fn
to something likedef
? What about thelet
keyword? Would it be possible to remove it all together and have no keyword for variable definition? How flexible is the parsing of Rhai?