JoeStrout/miniscript

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

JoeStrout opened this issue · 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.

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

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

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