Closed Firestar99 closed 2 years ago
Well, thats not really a bug, but a "works as intended". The reason is a little difficult to explain, but let me try:
The $ is a feature of a Statement-Line (a line containing just pure statements). Your macro is of type block. Block-macros can contain nearly anything. Because of this, using such a macro is not considered a statement. This means the line is not considered a Statement-Line, which in turn means, you can't use $ there.
(Tl;dr: $ means "do not attach anything to this line", but "myfancyfunction(:export, 0)" is not a line, its a block)
I know this is confusing, but trust me, there are reasons for this.
What you could do is either: a) If your macro consists of a single line:
macro myfancyfunction(param, value) line
param = value; you=can; add=more; statements=here
end
(The macro-type "line" exists exactly to make something like this possible)
b) Move the $ into the macro
macro myfancyfunction(param, value) block
param = value $
end
Ah ok thanks I understand
I didn't fully read the nolol doc about macros and didn't notice there are different types of macro so just used block everywhere :)
Describe the bug Having a line with a macro and timing control $ symbol does not compile and causes parser errors.
To Reproduce Compile nolol source code:
Error for post $:
Parser error at Line: 5, Coloumn: 1 (up to Line: 5, Coloumn: 28): Macro myfancyfunction has type 'block', but type 'line' would be required here
Error for pre $:
Parser error at Line: 7, Coloumn: 3 (up to Line: 7, Coloumn: 30): Macro myfancyfunction has type 'block', but type 'line' would be required here
Platform: