Open alexanderkoller opened 6 years ago
PS: The stack trace of the error is as follows.
Error at node
Set variable
in switchtest.dos
com.clt.script.exp.EvaluationException: Unknown function or wrong type of arguments: switchtest(number)
at com.clt.script.parser.Parser$UnknownFunction.eval(Parser.java:1758)
at com.clt.script.exp.expressions.Function.eval(Function.java:54)
at com.clt.script.exp.Expression.evaluate(Expression.java:34)
at com.clt.diamant.graph.nodes.SetVariableNode.execute(SetVariableNode.java:447)
at com.clt.diamant.graph.Graph.execute(Graph.java:340)
at com.clt.diamant.SingleDocument.execute(SingleDocument.java:476)
at com.clt.diamant.SingleDocument.run(SingleDocument.java:403)
at com.clt.diamant.gui.SingleDocumentWindow$11.run(SingleDocumentWindow.java:839)
at java.lang.Thread.run(Thread.java:748)
fix would be to try parsing the function not only at runtime but immediately (see #200).
The error reporting of user-defined functions with syntax errors is currently confusing. For instance, when executing the attached dialog, DialogOS does not complain that the closing bracket of the switch statement is missing. Instead, it simply says "Unknown function or type of arguments: switchtest(number)" when attempting to execute the set-variable node in which this function is called.
Secondarily, the "Show Node" button in this popup does not focus the node when it is clicked.
We should check thoroughly whether this problem occurs with other control structures too and find a way to improve error reporting in case of syntax errors.
switchtest.dos.zip