puml.hpp 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. // Copyright 2024 Christophe Henry
  2. // henry UNDERSCORE christophe AT hotmail DOT com
  3. // This is an extended version of the state machine available in the boost::mpl library
  4. // Distributed under the same license as the original.
  5. // Copyright for the original version:
  6. // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
  7. // under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_MSM_FRONT_PUML_COMMON_H
  11. #define BOOST_MSM_FRONT_PUML_COMMON_H
  12. #include <cstdint>
  13. #include <string>
  14. #include <string_view>
  15. #include <vector>
  16. #include <boost/any.hpp>
  17. #include <boost/fusion/mpl.hpp>
  18. #include <boost/fusion/include/as_vector.hpp>
  19. #include <boost/fusion/container/vector.hpp>
  20. #include <boost/fusion/include/insert_range.hpp>
  21. #include <boost/fusion/include/at_c.hpp>
  22. #include <boost/fusion/include/for_each.hpp>
  23. #include <boost/fusion/include/make_vector.hpp>
  24. #include <boost/mpl/size.hpp>
  25. #include <boost/msm/front/states.hpp>
  26. // functors
  27. #include <boost/msm/front/functor_row.hpp>
  28. #include <boost/msm/front/operator.hpp>
  29. namespace boost::msm::front::puml
  30. {
  31. namespace detail {
  32. template <class T1, class T2>
  33. struct pair_type
  34. {
  35. using first = T1;
  36. using second = T2;
  37. };
  38. }
  39. template<typename T>
  40. struct convert_to_msm_names
  41. {
  42. using type = T;
  43. };
  44. template <std::uint32_t hash,
  45. class Flags = boost::fusion::vector0<>,
  46. class Entries = boost::fusion::vector0<>,
  47. class Exits = boost::fusion::vector0<>>
  48. struct State
  49. {
  50. using generated_type = State<hash>;
  51. using flag_list = boost::fusion::vector0<>;
  52. using entries = Entries;
  53. using exits = Exits;
  54. using internal_flag_list = Flags;
  55. template <class Event, class FSM>
  56. void on_entry(Event& evt, FSM& fsm)
  57. {
  58. boost::fusion::for_each(Entries{},
  59. [&](auto action_guard_pair)
  60. {
  61. if constexpr (
  62. std::is_same_v<typename decltype(action_guard_pair)::second,boost::msm::front::none>)
  63. {
  64. typename decltype(action_guard_pair)::first{}(evt, fsm, *this, *this);
  65. }
  66. else
  67. {
  68. if (typename decltype(action_guard_pair)::second{}(evt, fsm, *this, *this))
  69. {
  70. typename decltype(action_guard_pair)::first{}(evt, fsm, *this, *this);
  71. }
  72. }
  73. });
  74. }
  75. template <class Event, class FSM>
  76. void on_exit(Event& evt, FSM& fsm)
  77. {
  78. boost::fusion::for_each(Exits{},
  79. [&](auto action_guard_pair)
  80. {
  81. if constexpr (
  82. std::is_same_v<typename decltype(action_guard_pair)::second, boost::msm::front::none>)
  83. {
  84. typename decltype(action_guard_pair)::first{}(evt, fsm, *this, *this);
  85. }
  86. else
  87. {
  88. if (typename decltype(action_guard_pair)::second{}(evt, fsm, *this, *this))
  89. {
  90. typename decltype(action_guard_pair)::first{}(evt, fsm, *this, *this);
  91. }
  92. }
  93. });
  94. }
  95. // typedefs added for front::state compatibility
  96. typedef ::boost::mpl::vector<> internal_transition_table;
  97. typedef ::boost::fusion::vector<> internal_transition_table11;
  98. typedef ::boost::fusion::vector<> transition_table;
  99. typedef ::boost::fusion::vector0<> deferred_events;
  100. };
  101. template <std::uint32_t hash>
  102. struct Event
  103. {
  104. };
  105. template <std::uint32_t hash>
  106. struct Action
  107. {
  108. };
  109. template <std::uint32_t hash>
  110. struct Guard
  111. {
  112. };
  113. template <std::uint32_t hash>
  114. struct Flag
  115. {
  116. };
  117. namespace detail {
  118. // CRC32 Table (zlib polynomial)
  119. static constexpr std::uint32_t crc_table[256] =
  120. {
  121. 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
  122. 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
  123. 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
  124. 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
  125. 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
  126. 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
  127. 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
  128. 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
  129. 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
  130. 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
  131. 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
  132. 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
  133. 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
  134. 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
  135. 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
  136. 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
  137. 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
  138. 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
  139. 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
  140. 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
  141. 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
  142. 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
  143. 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
  144. 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
  145. 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
  146. 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
  147. 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
  148. 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
  149. 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
  150. 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
  151. 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
  152. 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
  153. 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
  154. 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
  155. 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
  156. 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
  157. 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
  158. 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
  159. 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
  160. 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
  161. 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
  162. 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
  163. 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
  164. 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
  165. 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
  166. 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
  167. 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
  168. 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
  169. 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
  170. 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
  171. 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
  172. 0x2d02ef8dL
  173. };
  174. constexpr std::uint32_t crc32(std::string_view str)
  175. {
  176. std::uint32_t crc = 0xffffffff;
  177. for (auto c : str)
  178. crc = (crc >> 8) ^ boost::msm::front::puml::detail::crc_table[(crc ^ c) & 0xff];
  179. return crc ^ 0xffffffff;
  180. }
  181. // removes training spaces or -
  182. constexpr std::string_view cleanup_token(const std::string_view& str)
  183. {
  184. auto first_not_whitespace = str.find_first_not_of("- \t");
  185. auto last_not_whitespace = str.find_last_not_of("- \t");
  186. if (first_not_whitespace != std::string::npos && last_not_whitespace != std::string::npos)
  187. {
  188. //return std::string(str, first_not_whitespace, last_not_whitespace - first_not_whitespace + 1);
  189. return str.substr(first_not_whitespace, last_not_whitespace - first_not_whitespace + 1);
  190. }
  191. else
  192. {
  193. return std::string_view{};
  194. }
  195. }
  196. struct Transition
  197. {
  198. std::string_view source;
  199. std::string_view target;
  200. std::string_view event;
  201. std::string_view guard;
  202. std::string_view action;
  203. };
  204. // finds guards [Guard]
  205. // requires all blanks to have been removed
  206. constexpr boost::msm::front::puml::detail::Transition
  207. parse_guards(std::string_view part)
  208. {
  209. boost::msm::front::puml::detail::Transition res;
  210. auto start_pos = part.find("[");
  211. auto end_pos = part.find("]");
  212. if (start_pos != std::string::npos && end_pos != std::string::npos)
  213. {
  214. ++start_pos;
  215. res.guard = boost::msm::front::puml::detail::cleanup_token(part.substr(start_pos, end_pos - start_pos));
  216. }
  217. return res;
  218. }
  219. // requires all blanks to have been removed
  220. constexpr boost::msm::front::puml::detail::Transition parse_row_right(std::string_view part)
  221. {
  222. auto action_pos = part.find("/");
  223. auto guard_pos = part.find("[");
  224. auto evt_pos = part.find(":");
  225. auto internal_pos = part.find("-");
  226. bool is_internal_transition =
  227. internal_pos != std::string::npos && internal_pos > evt_pos && internal_pos <= action_pos && internal_pos <= guard_pos;
  228. auto start_event_name_pos = (internal_pos == std::string::npos) ? evt_pos : internal_pos;
  229. boost::msm::front::puml::detail::Transition res;
  230. // target is until : or end of string if not provided
  231. if (evt_pos != std::string::npos && !is_internal_transition)
  232. {
  233. res.target = boost::msm::front::puml::detail::cleanup_token(part.substr(0, evt_pos));
  234. }
  235. else if (!is_internal_transition)
  236. {
  237. res.target = boost::msm::front::puml::detail::cleanup_token(part);
  238. }
  239. // event is between : and / or [, whatever comes first
  240. if (action_pos == std::string::npos && guard_pos == std::string::npos)
  241. {
  242. res.event = boost::msm::front::puml::detail::cleanup_token(part.substr(start_event_name_pos + 1));
  243. }
  244. else
  245. {
  246. auto length = std::min(action_pos, guard_pos) > 1 + start_event_name_pos ?
  247. std::min(action_pos, guard_pos) - 1 - start_event_name_pos
  248. : 0;
  249. res.event = boost::msm::front::puml::detail::cleanup_token(part.substr(start_event_name_pos + 1, length));
  250. }
  251. // handle different guard / action cases
  252. if (action_pos != std::string::npos && guard_pos != std::string::npos)
  253. {
  254. res.action = boost::msm::front::puml::detail::cleanup_token(part.substr(action_pos + 1, guard_pos - 1 - action_pos));
  255. }
  256. else if (action_pos != std::string::npos)
  257. {
  258. // we have an action => target until /
  259. res.action = boost::msm::front::puml::detail::cleanup_token(part.substr(action_pos + 1));
  260. }
  261. // handle guards
  262. res.guard = boost::msm::front::puml::detail::parse_guards(
  263. boost::msm::front::puml::detail::cleanup_token(part)).guard;
  264. return res;
  265. }
  266. constexpr boost::msm::front::puml::detail::Transition parse_row(std::string_view row)
  267. {
  268. auto arrow_pos = row.find("->");
  269. auto puml_event_pos = row.find(":");
  270. auto left = row.substr(0, arrow_pos);
  271. auto right = row.substr(arrow_pos + 2);
  272. if (puml_event_pos != std::string::npos)
  273. {
  274. return boost::msm::front::puml::detail::Transition{
  275. boost::msm::front::puml::detail::cleanup_token(left),
  276. boost::msm::front::puml::detail::parse_row_right(right).target,
  277. boost::msm::front::puml::detail::parse_row_right(right).event,
  278. boost::msm::front::puml::detail::parse_row_right(right).guard,
  279. boost::msm::front::puml::detail::parse_row_right(right).action };
  280. }
  281. else if (arrow_pos != std::string::npos)
  282. {
  283. // simple source -> target form
  284. return boost::msm::front::puml::detail::Transition{
  285. boost::msm::front::puml::detail::cleanup_token(left),
  286. boost::msm::front::puml::detail::cleanup_token(right),
  287. std::string_view{},
  288. std::string_view{},
  289. std::string_view{}
  290. };
  291. }
  292. return boost::msm::front::puml::detail::Transition{};
  293. }
  294. constexpr int count_transitions(std::string_view s)
  295. {
  296. //s = reduce(s, "");
  297. int occurrences = 0;
  298. std::string::size_type pos = 0;
  299. auto target = "->";
  300. while ((pos = s.find(target, pos)) != std::string::npos)
  301. {
  302. ++occurrences;
  303. pos += 2;
  304. }
  305. return occurrences;
  306. };
  307. constexpr int count_inits(std::string_view s, std::size_t occurrences=0)
  308. {
  309. auto target = "[*]";
  310. auto star_pos = s.find(target);
  311. auto endl_after_pos = s.find("\n", star_pos);
  312. auto arrow_after_pos = s.find("->", star_pos);
  313. if (star_pos != std::string::npos &&
  314. star_pos < arrow_after_pos &&
  315. arrow_after_pos < endl_after_pos)
  316. {
  317. return count_inits(s.substr(endl_after_pos), occurrences + 1);
  318. }
  319. return occurrences;
  320. };
  321. constexpr int count_actions(std::string_view s)
  322. {
  323. int occurrences = 0;
  324. if (!s.empty())
  325. {
  326. occurrences = 1;
  327. }
  328. std::string::size_type pos = 0;
  329. auto target = ",";
  330. while ((pos = s.find(target, pos)) != std::string::npos)
  331. {
  332. ++occurrences;
  333. pos += 1;
  334. }
  335. return occurrences;
  336. };
  337. template <int t>
  338. constexpr
  339. auto parse_stt(std::string_view stt)
  340. {
  341. auto prev_pos = std::string::size_type(0);
  342. auto pos = std::string::size_type(0);
  343. auto trans_cpt = 0;
  344. do
  345. {
  346. pos = stt.find("\n", prev_pos);
  347. auto transition_symbol = stt.find("->", prev_pos);
  348. auto init_symbol = stt.find("[*]", prev_pos);
  349. if (init_symbol < pos || transition_symbol >= pos)
  350. {
  351. prev_pos = pos + 1;
  352. }
  353. else
  354. {
  355. if (trans_cpt == t)
  356. {
  357. return boost::msm::front::puml::detail::parse_row(stt.substr(prev_pos, pos - prev_pos));
  358. }
  359. prev_pos = pos + 1;
  360. ++trans_cpt;
  361. }
  362. } while (pos != std::string::npos);
  363. // should not happen
  364. return boost::msm::front::puml::detail::Transition{};
  365. }
  366. template <int a>
  367. constexpr auto parse_action(std::string_view actions)
  368. {
  369. //actions = reduce(actions, "");
  370. auto prev_pos = std::string::size_type(0);
  371. auto pos = std::string::size_type(0);
  372. auto action_cpt = 0;
  373. do
  374. {
  375. pos = actions.find(",", prev_pos);
  376. if (action_cpt == a)
  377. {
  378. return boost::msm::front::puml::detail::cleanup_token(actions.substr(prev_pos, pos - prev_pos));
  379. }
  380. ++action_cpt;
  381. prev_pos = pos + 1;
  382. } while (pos != std::string::npos);
  383. // should not happen
  384. return std::string_view{};
  385. }
  386. template <int t>
  387. constexpr
  388. auto parse_inits(std::string_view stt)
  389. {
  390. //stt = reduce(stt, "");
  391. auto prev_pos = std::string::size_type(0);
  392. auto pos = std::string::size_type(0);
  393. auto trans_cpt = 0;
  394. do
  395. {
  396. pos = stt.find("\n", prev_pos);
  397. auto init_symbol = stt.find("[*]", prev_pos);
  398. if (pos > init_symbol)
  399. {
  400. auto init_symbol2 = stt.find("->", init_symbol);
  401. if (pos > init_symbol2)
  402. {
  403. if (trans_cpt == t)
  404. {
  405. return cleanup_token(stt.substr(init_symbol2 + 2, pos - init_symbol2 - 2));
  406. }
  407. ++trans_cpt;
  408. }
  409. }
  410. prev_pos = pos + 1;
  411. } while (pos != std::string::npos);
  412. // should not happen
  413. return std::string_view{};
  414. }
  415. } //namespace detail
  416. constexpr std::uint32_t by_name(std::string_view str)
  417. {
  418. return boost::msm::front::puml::detail::crc32(str) ^ 0xFFFFFFFF;
  419. }
  420. // specializations
  421. template<>
  422. struct convert_to_msm_names<State<by_name("")>>
  423. {
  424. using type = boost::msm::front::none;
  425. };
  426. template<>
  427. struct convert_to_msm_names<Event< by_name("")>>
  428. {
  429. using type = boost::msm::front::none;
  430. };
  431. template<>
  432. struct convert_to_msm_names<Action< by_name("")>>
  433. {
  434. using type = boost::msm::front::none;
  435. };
  436. template<>
  437. struct convert_to_msm_names<Guard< by_name("")>>
  438. {
  439. using type = boost::msm::front::none;
  440. };
  441. template<>
  442. struct convert_to_msm_names<Action< by_name("defer")>>
  443. {
  444. using type = boost::msm::front::Defer;
  445. };
  446. template<>
  447. struct convert_to_msm_names<Event< by_name("*")>>
  448. {
  449. using type = boost::any;
  450. };
  451. namespace detail
  452. {
  453. template <class Func>
  454. constexpr auto parse_guard_simple(Func guard_func)
  455. {
  456. constexpr auto and_pos = guard_func().find("&&");
  457. constexpr auto or_pos = guard_func().find("||");
  458. constexpr auto not_pos = guard_func().find("!");
  459. constexpr auto parens_begin_pos = guard_func().find("(");
  460. constexpr auto parens_end_pos = guard_func().find(")");
  461. constexpr auto last_and_pos = guard_func().find("&&", parens_end_pos);
  462. constexpr auto last_or_pos = guard_func().find("||", parens_end_pos);
  463. // check for operator of the lesser precedence after end parens
  464. if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos &&
  465. last_or_pos != std::string::npos && parens_end_pos < last_or_pos)
  466. {
  467. return boost::msm::front::Or_<
  468. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  469. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, last_or_pos)); })),
  470. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  471. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(last_or_pos + 2)); })) > {};
  472. }
  473. else if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos &&
  474. last_and_pos != std::string::npos && parens_end_pos < last_and_pos)
  475. {
  476. return boost::msm::front::And_<
  477. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  478. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, last_and_pos)); })),
  479. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  480. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(last_and_pos + 2)); })) > {};
  481. }
  482. else if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos &&
  483. or_pos != std::string::npos && or_pos < and_pos && or_pos < parens_begin_pos)
  484. {
  485. return boost::msm::front::Or_<
  486. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  487. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, or_pos)); })),
  488. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  489. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(or_pos + 2)); })) > {};
  490. }
  491. else if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos &&
  492. and_pos != std::string::npos && and_pos < or_pos && and_pos < parens_begin_pos)
  493. {
  494. return boost::msm::front::And_<
  495. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  496. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, and_pos)); })),
  497. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  498. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(and_pos + 2)); })) > {};
  499. }
  500. else if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos &&
  501. not_pos != std::string::npos && not_pos < parens_begin_pos)
  502. {
  503. return boost::msm::front::Not_<decltype(boost::msm::front::puml::detail::parse_guard_simple(
  504. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(not_pos + 1)); })) > {};
  505. }
  506. else if constexpr (parens_begin_pos != std::string::npos && parens_end_pos != std::string::npos)
  507. {
  508. return boost::msm::front::puml::detail::parse_guard_simple(
  509. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(parens_begin_pos + 1, parens_end_pos - (parens_begin_pos + 1))); });
  510. }
  511. else if constexpr (and_pos == std::string::npos && or_pos == std::string::npos && not_pos == std::string::npos)
  512. {
  513. return typename boost::msm::front::puml::convert_to_msm_names < Guard <by_name(guard_func())> >::type{};
  514. }
  515. // at least one operator, break at pos of the lesser precedence
  516. else if constexpr (or_pos != std::string::npos)
  517. {
  518. return boost::msm::front::Or_<
  519. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  520. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, or_pos)); })),
  521. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  522. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(or_pos + 2)); })) > {};
  523. }
  524. else if constexpr (and_pos != std::string::npos)
  525. {
  526. return boost::msm::front::And_<
  527. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  528. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(0, and_pos)); })),
  529. decltype(boost::msm::front::puml::detail::parse_guard_simple(
  530. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(and_pos + 2)); })) > {};
  531. }
  532. else
  533. {
  534. return boost::msm::front::Not_<decltype(boost::msm::front::puml::detail::parse_guard_simple(
  535. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(not_pos + 1)); })) > {};
  536. }
  537. }
  538. template <class Func>
  539. constexpr auto parse_guard_advanced(Func guard_func)
  540. {
  541. constexpr auto and_pos = guard_func().find("And(");
  542. constexpr auto or_pos = guard_func().find("Or(");
  543. constexpr auto not_pos = guard_func().find("Not(");
  544. if constexpr (and_pos == std::string::npos && or_pos == std::string::npos && not_pos == std::string::npos)
  545. {
  546. return typename boost::msm::front::puml::convert_to_msm_names < Guard <by_name(guard_func())> >::type{};
  547. }
  548. // at least one operator, break at pos of the lesser precedence
  549. else if constexpr (or_pos != std::string::npos)
  550. {
  551. constexpr auto comma_pos = guard_func().find(",", or_pos);
  552. constexpr auto endparens_pos = guard_func().find(")", or_pos);
  553. return boost::msm::front::Or_<
  554. decltype(boost::msm::front::puml::detail::parse_guard_advanced(
  555. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(or_pos + 3, comma_pos - (or_pos + 3))); })),
  556. decltype(boost::msm::front::puml::detail::parse_guard_advanced(
  557. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(comma_pos + 1, endparens_pos - (comma_pos + 1))); }))
  558. > {};
  559. }
  560. else if constexpr (and_pos != std::string::npos)
  561. {
  562. constexpr auto comma_pos = guard_func().find(",", and_pos);
  563. constexpr auto endparens_pos = guard_func().find(")", and_pos);
  564. return boost::msm::front::And_<
  565. decltype(boost::msm::front::puml::detail::parse_guard_advanced(
  566. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(and_pos + 4, comma_pos - (and_pos + 4))); })),
  567. decltype(boost::msm::front::puml::detail::parse_guard_advanced(
  568. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(comma_pos + 1, endparens_pos - (comma_pos + 1))); }))
  569. > {};
  570. }
  571. else
  572. {
  573. constexpr auto endparens_pos = guard_func().find(")", not_pos);
  574. return boost::msm::front::Not_<
  575. decltype(boost::msm::front::puml::detail::parse_guard_advanced(
  576. [=]() {return boost::msm::front::puml::detail::cleanup_token(guard_func().substr(not_pos + 4, endparens_pos - (not_pos + 4))); }))
  577. > {};
  578. }
  579. }
  580. template <class Func>
  581. constexpr auto parse_guard(Func guard_func)
  582. {
  583. if constexpr (guard_func().find("And(") != std::string::npos ||
  584. guard_func().find("Or(") != std::string::npos ||
  585. guard_func().find("Not(") != std::string::npos)
  586. {
  587. return boost::msm::front::puml::detail::parse_guard_advanced(guard_func);
  588. }
  589. else
  590. {
  591. return boost::msm::front::puml::detail::parse_guard_simple(guard_func);
  592. }
  593. }
  594. constexpr int count_terminates(std::string_view s, std::size_t occurrences = 0)
  595. {
  596. if (s.empty())
  597. return occurrences;
  598. auto star_pos = s.find("[*]");
  599. auto arrow_pos = s.rfind("->", star_pos);
  600. auto endl_before_pos = s.rfind("\n", star_pos);
  601. if (star_pos != std::string::npos &&
  602. arrow_pos != std::string::npos &&
  603. arrow_pos > endl_before_pos )
  604. {
  605. return count_terminates(s.substr(star_pos + 3), occurrences + 1);
  606. }
  607. else if(star_pos != std::string::npos)
  608. {
  609. return count_terminates(s.substr(star_pos + 3), occurrences);
  610. }
  611. return occurrences;
  612. };
  613. template <class Func, class T>
  614. constexpr auto parse_terminate(Func stt, auto state_name, T vec = T{})
  615. {
  616. if constexpr (stt().empty())
  617. {
  618. return vec;
  619. }
  620. else
  621. {
  622. constexpr auto star_pos = stt().find("[*]");
  623. constexpr auto arrow_pos = stt().rfind("->", star_pos);
  624. constexpr auto endl_before_pos = stt().rfind("\n", star_pos);
  625. constexpr auto state_pos = stt().rfind(state_name(), arrow_pos);
  626. if constexpr (
  627. star_pos != std::string::npos &&
  628. arrow_pos != std::string::npos &&
  629. arrow_pos > endl_before_pos &&
  630. state_pos != std::string::npos &&
  631. state_pos > endl_before_pos &&
  632. cleanup_token(stt().substr(state_pos, arrow_pos - state_pos)) == state_name())
  633. {
  634. return
  635. typename ::boost::mpl::push_back<
  636. T,
  637. boost::msm::TerminateFlag
  638. >::type{};
  639. }
  640. else if constexpr (star_pos != std::string::npos)
  641. {
  642. return parse_terminate(
  643. [=]() {return stt().substr(star_pos + 3); },
  644. state_name,
  645. vec);
  646. }
  647. else
  648. {
  649. return vec;
  650. }
  651. }
  652. };
  653. template <class Func, class T = boost::fusion::vector0<>>
  654. constexpr auto parse_flags(Func stt, auto state_name, T vec = T{})
  655. {
  656. constexpr auto flag_pos = stt().find("flag");
  657. if constexpr (flag_pos != std::string::npos)
  658. {
  659. // we need to handle a flag
  660. constexpr auto endl_after_flag_pos = stt().find("\n", flag_pos);
  661. constexpr auto col_pos = stt().rfind(":",flag_pos);
  662. constexpr auto endl_before_flag_pos = stt().rfind("\n", flag_pos);
  663. if constexpr (endl_after_flag_pos != std::string::npos)
  664. {
  665. // the name start from end of prev line+1 to :
  666. if constexpr (cleanup_token(stt().substr(endl_before_flag_pos+1,col_pos- (endl_before_flag_pos+1))) == state_name())
  667. {
  668. // flag name is from flag tag until endline
  669. return parse_flags(
  670. [=]() {return stt().substr(endl_after_flag_pos + 1); },
  671. state_name,
  672. typename ::boost::mpl::push_back<
  673. T,
  674. typename boost::msm::front::puml::convert_to_msm_names<
  675. boost::msm::front::puml::Flag< by_name(cleanup_token(stt().substr(flag_pos + 4, endl_after_flag_pos - (flag_pos + 4))))>>::type
  676. >::type{});
  677. }
  678. else
  679. {
  680. // check starting from next line
  681. return parse_flags(
  682. [=]() {return stt().substr(endl_after_flag_pos + 1); },
  683. state_name,
  684. vec);
  685. }
  686. }
  687. else
  688. {
  689. // the flag line is the last line of the string so we will end recursion wether we found a flag or not
  690. if constexpr (cleanup_token(stt().substr(endl_before_flag_pos + 1, col_pos - (endl_before_flag_pos + 1))) == state_name())
  691. {
  692. return typename ::boost::mpl::push_back<
  693. T,
  694. typename boost::msm::front::puml::convert_to_msm_names<
  695. boost::msm::front::puml::Flag< by_name(cleanup_token(stt().substr(flag_pos + 4, endl_after_flag_pos - (flag_pos + 4))))>>::type
  696. >::type{};
  697. }
  698. else
  699. {
  700. return vec;
  701. }
  702. }
  703. }
  704. else
  705. {
  706. // no flag left, end recursion
  707. return vec;
  708. }
  709. }
  710. template <class Func, int actions_count, int anum, class T = boost::fusion::vector<>>
  711. constexpr auto create_action_sequence_helper(Func action_func, T vec = T{})
  712. {
  713. // stop condition
  714. if constexpr (anum >= actions_count)
  715. {
  716. return vec;
  717. }
  718. else
  719. {
  720. return boost::msm::front::puml::detail::create_action_sequence_helper<Func, actions_count, anum + 1>(
  721. action_func,
  722. typename ::boost::mpl::push_back<
  723. T,
  724. typename boost::msm::front::puml::convert_to_msm_names<
  725. Action<by_name(boost::msm::front::puml::detail::parse_action<anum>(action_func()))>>::type >::type{});
  726. }
  727. }
  728. template <class Func>
  729. constexpr auto create_action_sequence(Func action_func)
  730. {
  731. return boost::msm::front::puml::detail::create_action_sequence_helper<
  732. Func, boost::msm::front::puml::detail::count_actions(action_func()), 0>(action_func);
  733. }
  734. template <class Func, class T = boost::fusion::vector0<>>
  735. constexpr auto parse_state_actions(Func stt, auto state_name, auto tag_text, T vec = T{})
  736. {
  737. constexpr auto entry_pos = stt().find(std::string_view(tag_text()));
  738. constexpr auto tag_size = std::string_view(tag_text()).length();
  739. if constexpr (entry_pos != std::string::npos)
  740. {
  741. // we need to handle an entry
  742. constexpr auto endl_after_entry_pos = stt().find("\n", entry_pos);
  743. constexpr auto bracket_beg_after_entry_pos = stt().find("[", entry_pos);
  744. constexpr auto col_pos = stt().rfind(":", entry_pos);
  745. constexpr auto endl_before_entry_pos = stt().rfind("\n", entry_pos);
  746. auto make_action_sequence = [](auto actions)
  747. {
  748. if constexpr (boost::mpl::size<decltype(actions)>::value == 1)
  749. return boost::fusion::at_c<0>(actions);
  750. else if constexpr (boost::mpl::size<decltype(actions)>::value == 0)
  751. return boost::msm::front::none{};
  752. else
  753. return boost::msm::front::ActionSequence_<decltype(actions)>{};
  754. };
  755. if constexpr (endl_after_entry_pos != std::string::npos)
  756. {
  757. // the name start from end of prev line+1 to :
  758. if constexpr (by_name(cleanup_token(stt().substr(endl_before_entry_pos + 1, col_pos - (endl_before_entry_pos + 1)))) == by_name(state_name()))
  759. {
  760. if constexpr (bracket_beg_after_entry_pos != std::string::npos && bracket_beg_after_entry_pos < endl_after_entry_pos)
  761. {
  762. constexpr auto bracket_end_after_entry_pos = stt().find("]", entry_pos);
  763. auto guard_l = [=]() {return stt().substr(bracket_beg_after_entry_pos +1, bracket_end_after_entry_pos - (bracket_beg_after_entry_pos +1)) ; };
  764. auto action_l = [=]() {return stt().substr(entry_pos + tag_size, bracket_beg_after_entry_pos - (entry_pos + tag_size)); };
  765. // action name is from entry tag until [
  766. return parse_state_actions(
  767. [=]() {return stt().substr(endl_after_entry_pos + 1); },
  768. state_name,
  769. tag_text,
  770. typename ::boost::mpl::push_back<
  771. T,
  772. boost::msm::front::puml::detail::pair_type<
  773. decltype(make_action_sequence(boost::msm::front::puml::detail::create_action_sequence(action_l))),
  774. typename boost::msm::front::puml::convert_to_msm_names<
  775. decltype(boost::msm::front::puml::detail::parse_guard(guard_l))>::type
  776. >
  777. >::type{});
  778. }
  779. else
  780. {
  781. // action name is from entry tag until endline
  782. auto action_l = [=]() {return stt().substr(entry_pos + tag_size, endl_after_entry_pos - (entry_pos + tag_size)); };
  783. return parse_state_actions(
  784. [=]() {return stt().substr(endl_after_entry_pos + 1); },
  785. state_name,
  786. tag_text,
  787. typename ::boost::mpl::push_back<
  788. T,
  789. boost::msm::front::puml::detail::pair_type<
  790. decltype(make_action_sequence(boost::msm::front::puml::detail::create_action_sequence(action_l))),
  791. typename boost::msm::front::puml::convert_to_msm_names<
  792. boost::msm::front::puml::Guard<by_name("")>>::type
  793. >
  794. >::type{});
  795. }
  796. }
  797. else
  798. {
  799. // check starting from next line
  800. return parse_state_actions(
  801. [=]() {return stt().substr(endl_after_entry_pos + 1); },
  802. state_name,
  803. tag_text,
  804. vec);
  805. }
  806. }
  807. // last line of string
  808. else
  809. {
  810. // the entry line is the last line of the string so we will end recursion wether we found an entry or not
  811. if constexpr (by_name(cleanup_token(stt().substr(endl_before_entry_pos + 1, col_pos - (endl_before_entry_pos + 1)))) == by_name(state_name()))
  812. {
  813. if constexpr (bracket_beg_after_entry_pos != std::string::npos && bracket_beg_after_entry_pos < endl_after_entry_pos)
  814. {
  815. constexpr auto bracket_end_after_entry_pos = stt().find("]", entry_pos);
  816. auto guard_l = [stt]() {return stt().substr(bracket_beg_after_entry_pos +1, bracket_end_after_entry_pos - (bracket_beg_after_entry_pos +1)) ; };
  817. // action name is from entry tag until [
  818. auto action_l = [stt]() {return stt().substr(entry_pos + tag_size, bracket_beg_after_entry_pos - (entry_pos + tag_size)); };
  819. return
  820. typename ::boost::mpl::push_back<
  821. T,
  822. boost::msm::front::puml::detail::pair_type<
  823. decltype(make_action_sequence(boost::msm::front::puml::detail::create_action_sequence(action_l))),
  824. decltype(boost::msm::front::puml::detail::parse_guard(guard_l))
  825. >
  826. >::type{};
  827. }
  828. else
  829. {
  830. auto action_l = [stt]() {return stt().substr(entry_pos + tag_size, endl_after_entry_pos - (entry_pos + tag_size)); };
  831. return
  832. typename ::boost::mpl::push_back<
  833. T,
  834. boost::msm::front::puml::detail::pair_type <
  835. decltype(make_action_sequence(boost::msm::front::puml::detail::create_action_sequence(action_l))),
  836. boost::msm::front::puml::Guard<by_name("")>
  837. >
  838. >::type{};
  839. }
  840. }
  841. else
  842. {
  843. return vec;
  844. }
  845. }
  846. }
  847. else
  848. {
  849. // no entry left, end recursion
  850. return vec;
  851. }
  852. }
  853. // recursively fills fusion vector with transition (making a tansition_table)
  854. template <class Func, int transitions, int tnum, class T = boost::fusion::vector<>>
  855. constexpr auto create_transition_table_helper(Func stt, T vec = T{})
  856. {
  857. // stop condition
  858. if constexpr (tnum >= transitions)
  859. {
  860. return vec;
  861. }
  862. else
  863. {
  864. auto guard_l = [stt]() {return boost::msm::front::puml::detail::parse_stt<tnum>(stt()).guard; };
  865. auto action_l = [stt]() {return boost::msm::front::puml::detail::parse_stt<tnum>(stt()).action; };
  866. auto source_l = [stt]() {return boost::msm::front::puml::detail::parse_stt<tnum>(stt()).source; };
  867. auto target_l = [stt]() {return boost::msm::front::puml::detail::parse_stt<tnum>(stt()).target; };
  868. auto stt_l = [stt]() {return std::string_view(stt()); };
  869. auto entry_l = []() {return "entry"; };
  870. auto exit_l = []() {return "exit"; };
  871. auto make_action_sequence = [](auto actions)
  872. {
  873. if constexpr (boost::mpl::size<decltype(actions)>::value == 1)
  874. return boost::fusion::at_c<0>(actions);
  875. else if constexpr (boost::mpl::size<decltype(actions)>::value == 0)
  876. return boost::msm::front::none{};
  877. else
  878. return boost::msm::front::ActionSequence_<decltype(actions)>{};
  879. };
  880. using one_row =
  881. boost::msm::front::Row <
  882. State < by_name(boost::msm::front::puml::detail::parse_stt<tnum>(stt()).source),
  883. decltype(boost::msm::front::puml::detail::parse_terminate(
  884. stt_l, source_l, boost::msm::front::puml::detail::parse_flags(stt_l,source_l))),
  885. decltype(parse_state_actions(stt_l,source_l, entry_l)),
  886. decltype(parse_state_actions(stt_l,source_l, exit_l))
  887. >,
  888. typename boost::msm::front::puml::convert_to_msm_names<
  889. Event< by_name(boost::msm::front::puml::detail::parse_stt<tnum>(stt()).event)>>::type,
  890. typename boost::msm::front::puml::convert_to_msm_names<
  891. State< by_name(boost::msm::front::puml::detail::parse_stt<tnum>(stt()).target),
  892. decltype(boost::msm::front::puml::detail::parse_terminate(
  893. stt_l, target_l, boost::msm::front::puml::detail::parse_flags(stt_l,target_l))),
  894. decltype(parse_state_actions(stt_l, target_l, entry_l)),
  895. decltype(parse_state_actions(stt_l, target_l, exit_l))
  896. >>::type,
  897. decltype(make_action_sequence(boost::msm::front::puml::detail::create_action_sequence(action_l))),
  898. decltype(boost::msm::front::puml::detail::parse_guard(guard_l))
  899. >;
  900. return boost::msm::front::puml::detail::create_transition_table_helper<Func, transitions, tnum + 1>(
  901. stt, typename ::boost::mpl::push_back< T, one_row>::type{});
  902. }
  903. }
  904. template <class Func, int regions, int rnum, class T = boost::fusion::vector<>>
  905. constexpr auto create_inits_helper(Func stt, T vec = T{})
  906. {
  907. // stop condition
  908. if constexpr (rnum >= regions)
  909. {
  910. return vec;
  911. }
  912. else
  913. {
  914. return boost::msm::front::puml::detail::create_inits_helper<Func, regions, rnum + 1>(
  915. stt, typename ::boost::mpl::push_back< T, State<by_name(boost::msm::front::puml::detail::parse_inits<rnum>(stt()))> >::type{});
  916. }
  917. }
  918. }//namespace detail
  919. template <class Func>
  920. constexpr auto create_transition_table(Func stt_func)
  921. {
  922. return boost::msm::front::puml::detail::create_transition_table_helper<
  923. Func,
  924. boost::msm::front::puml::detail::count_transitions(
  925. stt_func()) -
  926. boost::msm::front::puml::detail::count_inits(stt_func()) -
  927. boost::msm::front::puml::detail::count_terminates(stt_func())
  928. , 0>(stt_func);
  929. }
  930. template <class Func>
  931. constexpr auto create_initial_states(Func stt_func)
  932. {
  933. return boost::msm::front::puml::detail::create_inits_helper<
  934. Func,
  935. boost::msm::front::puml::detail::count_inits(stt_func()), 0>(stt_func);
  936. }
  937. template <class Func>
  938. constexpr auto create_fsm_table(Func stt_func)
  939. {
  940. return boost::msm::front::puml::detail::pair_type <
  941. decltype(
  942. boost::msm::front::puml::detail::create_transition_table_helper<
  943. Func,
  944. boost::msm::front::puml::detail::count_transitions(
  945. stt_func()) -
  946. boost::msm::front::puml::detail::count_inits(stt_func()) -
  947. boost::msm::front::puml::detail::count_terminates(stt_func())
  948. , 0>(stt_func)),
  949. decltype(
  950. boost::msm::front::puml::detail::create_inits_helper<
  951. Func,
  952. boost::msm::front::puml::detail::count_inits(stt_func()), 0>(stt_func))>{};
  953. }
  954. }//boost::msm::front::puml
  955. // helper macro to hide declarations
  956. #define BOOST_MSM_PUML_DECLARE_TABLE(stt) \
  957. using Stt = decltype(create_fsm_table([]() {return stt;})); \
  958. using transition_table = typename Stt::first; \
  959. using initial_state = typename Stt::second;
  960. #endif // BOOST_MSM_FRONT_PUML_COMMON_H