Open Firestar99 opened 1 year ago
Not really a bug, but rather a consequence of how nolol is structured. A nolol-ast consist of differen things. There are mainly Elements (include, define etc.), NestableElements (if, for) and StatementLines. StatementLines are effectively the plain-old yolol. Just a list of 0 or more statements (with some optional modifiers). Things like \$, jumplabels and comments are features of StatementLines. MultiLine-Ifs are no StatementLines and can therefore not have these.
A line that only contains a $ results in an empty line, by design.
The correct way to do what you are trying to is to add the $ either at the end of the last line inside the if-block, or at the beginning of the first (non empty) line after the if-block.
If one of that does not work, then it definitely a bug.
I cant test this myself right now, but does one of this work for you?
if c=="-" then
:a=1
:b=42 $
end
:a=0
if c=="-" then
:a=1
:b=42
end
$ :a=0
if c=="-" then
:a=1
:b=42 $
end
:a=0
As already described in the opening comment the dollar here does nothing.
if c=="-" then
:a=1
:b=42
end
$ :a=0
This version however works! I was not aware that prepending a $ is allowed.
Ok, then the first one is a bug. I will have to see when I find the time to look into this. But I am glad that there is a working workaround
Feel free to take your time, this is just something I've noticed and don't even have a usecase for it currently :D
Describe the bug Nolol multiline if's do not allow $ after end erroring out with
Expected newline. Found Token: '$'(Symbol)
, although it works just fine with single line ifs. This makes it hard to describe behaviour where after a multiline if a line break ($) is required followed by time sensitive code which should execute exactly 1 tick later later. Inserting the $ into a new line after the if inserts an empty line and thus 2 ticks of latency.I my use-case (well known number parser ported to nolol) I can use the workaround described below: a useless statement followed by a $.
Example Code/Screenshots
Platform: