jbeard4 / SCION

SCXML/Statecharts in JavaScript, moved to gitlab: https://gitlab.com/scion-scxml/scion
https://scion.scxml.io
Apache License 2.0
149 stars 29 forks source link

send without event or eventexpr should result in parse error #355

Open mattoshry opened 9 years ago

mattoshry commented 9 years ago

[1] is not crystal clear for all cases, but for type[expr] === 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor' the spec does state the following about event and eventexpr:

"If the type is http://www.w3.org/TR/scxml/#SCXMLEventProcessor, either this attribute or 'event[expr]' must be present."

And after the table:

"A conformant SCXML document must specify exactly one of 'event', 'eventexpr' and ."

For #_internal (repro below) scion doesn't protest. For other sends which are delegated to the send manager, the manager can raise an error event into the internal event queue, but this can be detected partially at pre-exection / parse time. An @eventexpr that evaluates to empty/null/undefined could be detected at runtime.

[1] http://www.w3.org/TR/scxml/#send

<scxml xmlns="http://www.w3.org/2005/07/scxml"
  version="1.0">

<transition event="*">
  <log expr="'Ignoring unhandled input ' + _event.name" label="TEST"/>
</transition>

<state id="s1">
  <onentry>
    <send target="#_internal" />
  </onentry>
</state>

</scxml>