I am generating a Message Sequence Chart (MSC) to my model. I have the following code in the transition and it is working:
input (p_id, p_cert, v_id, v_cert);
action
MSC.addEvent(msc, p, i, func_to_concat(p_id, p_cert));
if v_cred(p_id, p_cert, v_id, v_cert) then
MSC.addEvent(msc, i, p, "Some message here.")
else
MSC.addEvent(msc, i, p, "Some other message.")
I tested this code and it worked fine. Then, I decided to put it into a function, that is coded as follows:
fun a(msc, e, i, id, cert, v_id, v_cert) =
MSC.addEvent(msc, i, e, func_to_concat(id, cert));
if v_cred(id, cert, v_id, v_cert) then
MSC.addEvent(msc, i, e, "Some message here.")
else
MSC.addEvent(msc, i, e, "Some other message.")
But I am receiving this error message:
Error: Error: exception Compile is raised with Aborted parsing
Can anyone suggest something to solve this problem?
Problem solved. In order to specify a command block in ML language, we have to put the code inside parentheses:
fun a(msc, e, i, id, cert, v_id, v_cert) = (
MSC.addEvent(msc, e, i, func_to_concat(id, cert));
if v_cred(id, cert, v_id, v_cert) then
MSC.addEvent(msc, i, e, "Some message here.")
else
MSC.addEvent(msc, i, e, "Some other message.")
)