miniscript icon indicating copy to clipboard operation
miniscript copied to clipboard

[C++] command-line MiniScript aborts on extra "end function"

Open JoeStrout opened this issue 2 years ago • 3 comments

In command-line MiniScript, if you type end function at the prompt without first starting a function, it aborts (exit code 134). It should instead just print an error and continue.

Note that end if and end while work correctly; only end function shows this problem.

JoeStrout avatar Oct 23 '23 14:10 JoeStrout

Note that this might be fixed incidentally if we implement suggestion #100.

JoeStrout avatar Oct 23 '23 14:10 JoeStrout

I came across this issue when testing how accurately Miniscript can tell me which line an error occurred on. I expected an error for "unknown function fution" or similar on line 1 of the code below, but instead it crashes the interpreter (presumably because the end function is now "extra")

bread = fution(x) b = "butter" + x end function

Armen138 avatar Jul 26 '24 14:07 Armen138

So it does! (In the C++ implementation; not in the C# one.) Good catch.

JoeStrout avatar Jul 26 '24 15:07 JoeStrout