W3C home > Mailing lists > Public > www-voice@w3.org > January to March 2013

Fallback for LCCA when <scxml> is included

From: Gavin Kistner <phrogz@me.com>
Date: Tue, 12 Feb 2013 21:39:02 +0000 (GMT)
To: www-voice@w3.org, www-voice@w3.org
Message-id: <f6521b7d-7c0f-418b-8ad2-85690e172f21@me.com>
The prose for findLCCA() says "Note that there is guaranteed to be such an element since the <scxml> wrapper element is a common ancestor of all states." This makes sense; of course findLCCA() should always return something, the <scxml> if nothing else.

Then the prose says "Note also that since we are speaking of proper ancestor (parent or parent of a parent, etc.) the LCCA is never a member of stateList.". This is also true from the implementation.

However, if the <scxml> element itself is in stateList, then the current implementation causes the second statement to win over the first, and findLCCA() has a Null return value. Consider this document:

    <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
      <transition cond="In('a')" target="pass"/>
      <parallel id="p"><state id="a"/></parallel>
      <final id="pass"/>
    </scxml>

When processing the states to enter in enterStates() findLCCA() is passed t.source, which is the <scxml>. Consequently findLCCA() returns Null, which causes the call to getProperAncestors(s,ancestor) to include the <scxml> element (since there is no stop node). This adds <scxml> to the configuration, and consequently my runtime gets cranky when it hits an active 'state' with no id.

The proposed fix is to add a final fallback line to findLCCA() as follows:

    function findLCCA(stateList):
      for anc in getProperAncestors(stateList.head(),null).filter(isCompoundState):
        if stateList.tail().every(lambda s: isDescendant(s,anc)):
          return anc
      return findScxml() # returns the root 'doc' <scxml> element
Received on Tuesday, 12 February 2013 21:39:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 12 February 2013 21:39:35 GMT