Permalink
Browse files

add support for <script> in <scxml>

  • Loading branch information...
sstiller committed Nov 3, 2018
1 parent 59b62c4 commit 8a6bd297929f70b8c04fb9d5db488fca15569aec
Showing with 12 additions and 0 deletions.
  1. +10 −0 src/cpp_output.cpp
  2. +1 −0 src/scxml_parser.cpp
  3. +1 −0 src/scxml_parser.h
@@ -1251,6 +1251,16 @@ void cpp_output::gen()
}
out << endl;
if(! sc.sc().scripts.empty()) {
out << "// user initialisations" << endl;
for(const auto script : sc.sc().scripts) {
// this would work, but ugly indention:
// gen_action_part(*script);
out << script->attr["expr"] << endl;
}
out << endl;
}
if(!opt.ns.empty()) {
out << "namespace " << opt.ns << " {" << endl;
}
@@ -47,6 +47,7 @@ void scxml_parser::parse_scxml(const ptree &pt)
else if (it->first == "parallel") parse_parallel(it->second, boost::shared_ptr<state>());
else if (it->first == "initial") m_scxml.initial = parse_initial(it->second);
else if (it->first == "datamodel") m_scxml.datamodel = parse_datamodel(it->second);
else if (it->first == "script") m_scxml.scripts.push_back(parse_script(it->second));
else if (std::regex_match(it->first, ignore_elements_re)) ; // ignore
else cerr << "warning: unknown item '" << it->first << "' in <scxml>" << endl;
}
@@ -78,6 +78,7 @@ class scxml_parser
transition initial;
state_list states;
data_list datamodel;
plist<action> scripts;
};
scxml_parser(const char *name, const std::string& ignore_unknown, const boost::property_tree::ptree &pt);

0 comments on commit 8a6bd29

Please sign in to comment.