Stevertus / mcscript

A programming language for Minecraft Vanilla
https://mcscript.stevertus.com
MIT License
233 stars 16 forks source link

compiler inserts semicolons before newlines when using .repl() #21

Closed deli73 closed 3 years ago

deli73 commented 4 years ago

when given this text in a .mcscript file:

const TEST_CONST = 'this is a demonstration
of the issue with constants in MCScript'
/say $(TEST_CONST).repl(" the ", " an ")

the following is output in the mcfunction by the compiler:

say this is a demonstration;
of an issue with constants in MCScript

note the erroneous semicolon. it appears that the replace feature was created without multi-line constants in mind, but those are really useful for certain things so it'd be cool if this was fixed. thanks!

deli73 commented 4 years ago

also this may warrant another issue but: a much stranger issue occurs when you have more than one .repl() in a single mcscript file:

TypeError: Cannot read property '0' of undefined
    at con.forEach ([...]\node_modules\mcscript\lib\generator.js:92:30)
Stevertus commented 3 years ago

This might be pretty long ago, but for me the provided example works fine. You may want to update to the newest version. I can also see no issues with multiple repls. If you still encounter this issue, dont bother writing another message.