Skip to content

sfeu/scxml

Repository files navigation

MINT Statemachine SCXML parser

DESCRIPTION:

This gem implements all core constucts of the state chart XML (SCXML) specification of the W3C. (www.w3.org/TR/scxml/)

Instead of implementing an interpreter, this gem implements a parser that create a ruby statemachine instance based on the MINT-statemachine gem (github.com/sfeu/statemachine).

FEATURES/PROBLEMS:

We currently do not support the definition of a data model. Instead the ruby class that contains the statemachine instance can be used to store data. Conditions can be defined using ruby inside the SCXML definition and member functionc can be called using SCXML script or invoke.

EXAMPLE:

Parses an SCXML string and creates a statemachine instance in @sm. The messenger object can be used to capture the SCXML log messenges (using the log statement).

   @messenger = mock("messenger" )

   parser = StatemachineParser.new(nil,@messenger)

   scxml = <<EOS
<scxml name="SCXML" xmlns="http://www.w3.org/2005/07/scxml">
 <state id="state1">
    <transition event="event1" target="state2"/>
    <transition event="event4" target="state2">
       <log expr="transition executing"/>
    </transition>
 </state>

 <state id="state2">
    <transition event="event2" target="state3"/>
 </state>

 <state id="state3">
    <transition event="event3" target="state1"/>
 </state>
 </scxml>
EOS

         @sm = parser.build_from_scxml_string scxml
         @sm.reset

 See tests

REQUIREMENTS:

INSTALL:

  • sudo gem install MINT-scxml

LICENSE:

Copyright © 2010-2013 Sebastian Feuerstack, Jessica H. Colnago

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

About

A state chart xml parser (SCXML) thate generates statemachines

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages