Yuescript
Yuescript copied to clipboard
Incorrect syntax error when asserts have a message and a space after the call
If an assert has a message after it and a space between the call and the brackets it will throw a syntax error.
assert (1==1, "Oopsies!")
1: syntax error
assert (1==1, "Oopsies!")
^
These both run fine:
assert(1==1, "Oopsies!")
assert (1==1)
This is an intended behavior. Function call should be written as function name followed by whitespace then the arguments separated by commas, or function name followed by parentheses without any whitespace. So that assert (1==1) is actually seen as assert((1==1)), and assert (1==1, "Oopsies!") as assert((1==1, "Oopsies!")) is invalid code.
Maybe a more detailed error, surely the space is the issue here, not the comma?
The compiler should now give the detailed error by newest commit.
1: write invoke arguments in parentheses without leading spaces or leading spaces without parentheses
assert (1==1, "Oopsies!")
^