GslCore
GslCore copied to clipboard
FEA parameterless functions
This almost feels like a bug. The following code gives an error. Basically you can't have a function that just expands into code. Of course you can get around this with part definitions but it seems like an omission.
#refgenome cenpk
#platform stitch
let foo() =
uADH1 ; dADH1
end
foo()
syntax error; found ')', expected one of ['identifier'].
=================================================================
#platform stitch
let foo() =
^
uADH1 ; dADH1
end
foo()
Seems like this should be an "easy" fix to add to the parser; offhand altering the function declaration pattern to add another line should probably just fix it.
FunctionDeclaration:
| LET ID LPAREN FunctionDefArgs RPAREN EQUALS CodeSection END { createFunctionDeclaration $2 $4 $7 }
| LET ID LPAREN RPAREN EQUALS CodeSection END { createFunctionDeclaration $2 [] $6 }
Good point - I'll add this while I'm doing the function line number patch. I wrote a test for this case already and then discovered the base case didn't compile :(
Hopefully it works! Scare quotes around "easy" definitely necessary when the parser is involved...