sccd_to_xml_PY.py 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  1. class XML2PythonRules(object):
  2. def __init__(self):
  3. self.rules = {
  4. 'SCCD': {
  5. 'type': 'Model',
  6. 'name': 'SCCD',
  7. 'package': 'protected.formalisms',
  8. 'pattern': ['<?xml version="1.0" ?>', '@newline',
  9. '<diagram name=\"','@SCCD.name','\"','@SCCDauthor', '>',
  10. '@newline',
  11. '@indent',
  12. '@SCCDdescription',
  13. '@SCCDInPort',
  14. '@SCCDTop',
  15. '@SCCDClass',
  16. '@SCCDBottom',
  17. '@dedent', '</diagram>'
  18. ]
  19. },
  20. 'SCCDauthor': {
  21. 'type': 'Attribute',
  22. 'pattern': [' author=\"','@SCCD.author','\"']
  23. },
  24. 'SCCDdescription': {
  25. 'type': 'Attribute',
  26. 'pattern': ['<description>', '@newline', '@indent',
  27. '@SCCD.description','@newline', '@dedent',
  28. '</description>', '@newline']
  29. },
  30. 'SCCDInPort': {
  31. 'type': 'Class',
  32. 'name': 'SCCD.InPort',
  33. 'pattern': ['<inport name="', '@Named.name','"/>', '@newline']
  34. },
  35. 'SCCDTop': {
  36. 'type': 'Class',
  37. 'name': 'SCCD.Top',
  38. 'pattern': ['<top>', '@newline', '@indent', '@@',
  39. 'from python_runtime.libs.ui import *', '@newline',
  40. 'from python_runtime.libs.utils import *', '@newline',
  41. '@ActionBlockStatement',
  42. '@dedent', '</top>', '@newline' ]
  43. },
  44. 'SCCDBottom': {
  45. 'type': 'Class',
  46. 'name': 'SCCD.Bottom',
  47. 'pattern': ['<bottom>', '@newline', '@indent',
  48. '@ActionBlockStatement',
  49. '@dedent', '</bottom>', '@newline' ]
  50. },
  51. 'SCCDActionBlock': {
  52. 'type': 'Class',
  53. 'name': 'SCCD.ActionBlock',
  54. 'pattern': ['@indent','@ActionBlockStatement', '@dedent']
  55. },
  56. 'ActionBlockStatement': {
  57. 'type': 'Association',
  58. 'name': 'SCCD.actionblock_statement',
  59. 'target': 'SCCD.Statement',
  60. 'pattern': ['@SCCDStatement']
  61. },
  62. 'SCCDStatement': {
  63. 'type': 'Class',
  64. 'name': 'SCCD.Statement',
  65. 'pattern': [
  66. '@StatementMethodCall',
  67. '@StatementImport',
  68. '@StatementAssignment',
  69. '@StatementWhile',
  70. '@StatementIfElse',
  71. '@StatementReturn',
  72. '@StatementContinue',
  73. '@StatementBreak',
  74. '@StatementDeclaration',
  75. '@NextStatement'
  76. ]
  77. },
  78. 'NextStatement': {
  79. 'type': 'Association',
  80. 'name': 'SCCD.statement_statement_next',
  81. 'target': 'SCCD.Statement',
  82. 'pattern': [
  83. '@SCCDStatement'
  84. ]
  85. },
  86. 'StatementDeclaration': {
  87. 'type': 'Class',
  88. 'name': 'SCCD.Declaration',
  89. 'pattern': [ #'@DeclarationType', not used in python nor javascript
  90. '@Declaration.name',
  91. '@DeclarationInit', '@newline'
  92. ]
  93. },
  94. 'DeclarationType': {
  95. 'type': 'Association',
  96. 'name': 'SCCD.declaration_navigationexpression_type',
  97. 'target': 'SCCD.NavigationExpression',
  98. 'pattern': [ '@SCCDNavExpr', ' ' ]
  99. },
  100. 'DeclarationInit': {
  101. 'type': 'Association',
  102. 'name': 'SCCD.declaration_expression_init',
  103. 'target': 'SCCD.Expression',
  104. 'pattern': [ ' = ','@SCCDExpression' ]
  105. },
  106. 'StatementReturn': {
  107. 'type': 'Class',
  108. 'name': 'SCCD.Return',
  109. 'pattern': [ 'return', '@ReturnExpression', '@newline'
  110. ]
  111. },
  112. 'ReturnExpression': {
  113. 'type': 'Association',
  114. 'name': 'SCCD.return_expression',
  115. 'target': 'SCCD.Expression',
  116. 'pattern': [ ' ','@SCCDExpression' ]
  117. },
  118. 'StatementContinue': {
  119. 'type': 'Class',
  120. 'name': 'SCCD.Continue',
  121. 'pattern': [ 'continue', '@newline' ]
  122. },
  123. 'StatementBreak': {
  124. 'type': 'Class',
  125. 'name': 'SCCD.Break',
  126. 'pattern': [ 'break', '@newline' ]
  127. },
  128. 'StatementWhile': {
  129. 'type': 'Class',
  130. 'name': 'SCCD.While',
  131. 'pattern': [ 'while ', '@WhileCondition', ':', '@newline',
  132. '@WhileBody'
  133. ]
  134. },
  135. 'WhileCondition': {
  136. 'type': 'Association',
  137. 'name': 'SCCD.while_expression_condition',
  138. 'target': 'SCCD.Expression',
  139. 'pattern': [
  140. '@SCCDExpression'
  141. ]
  142. },
  143. 'WhileBody': {
  144. 'type': 'Association',
  145. 'name': 'SCCD.while_actionblock_body',
  146. 'target': 'SCCD.ActionBlock',
  147. 'pattern': ['@newline','@SCCDActionBlock','@newline']
  148. },
  149. 'StatementIfElse': {
  150. 'type': 'Class',
  151. 'name': 'SCCD.IfElse',
  152. 'pattern': [ 'if ', '@IfElseCondition', ':',
  153. '@IfBody','@ElseBody'
  154. ]
  155. },
  156. 'IfElseCondition': {
  157. 'type': 'Association',
  158. 'name': 'SCCD.ifelse_expression_condition',
  159. 'target': 'SCCD.Expression',
  160. 'pattern': [
  161. '@SCCDExpression'
  162. ]
  163. },
  164. 'IfBody': {
  165. 'type': 'Association',
  166. 'name': 'SCCD.ifelse_actionblock_ifbody',
  167. 'target': 'SCCD.ActionBlock',
  168. 'pattern': ['@newline','@SCCDActionBlock']
  169. },
  170. 'ElseBody': {
  171. 'type': 'Association',
  172. 'name': 'SCCD.ifelse_actionblock_elsebody',
  173. 'target': 'SCCD.ActionBlock',
  174. 'pattern': [
  175. 'else:',
  176. '@newline',
  177. '@SCCDActionBlock'
  178. ]
  179. },
  180. 'StatementAssignment': {
  181. 'type': 'Class',
  182. 'name': 'SCCD.Assignment',
  183. 'pattern': [
  184. '@AssignmentLeft',
  185. '@StatementPlainAssignment',
  186. '@StatementPlusAssignment',
  187. '@StatementMinusAssignment',
  188. '@AssignmentRight','@newline'
  189. ]
  190. },
  191. 'StatementPlainAssignment': {
  192. 'type': 'Class',
  193. 'name': 'SCCD.PlainAssignment',
  194. 'pattern': [ ' = ' ]
  195. },
  196. 'StatementPlusAssignment': {
  197. 'type': 'Class',
  198. 'name': 'SCCD.PlusAssignment',
  199. 'pattern': [ ' += ' ]
  200. },
  201. 'StatementMinusAssignment': {
  202. 'type': 'Class',
  203. 'name': 'SCCD.MinusAssignment',
  204. 'pattern': [ ' -= ' ]
  205. },
  206. 'AssignmentLeft': {
  207. 'type': 'Association',
  208. 'name': 'SCCD.assignment_expression_left',
  209. 'target': 'SCCD.Expression',
  210. 'pattern': [ '@SCCDExpression' ]
  211. },
  212. 'AssignmentRight': {
  213. 'type': 'Association',
  214. 'name': 'SCCD.assignment_expression_right',
  215. 'target': 'SCCD.Expression',
  216. 'pattern': [ '@SCCDExpression' ]
  217. },
  218. 'StatementMethodCall': {
  219. 'type': 'Class',
  220. 'name': 'SCCD.MethodCallStm',
  221. 'pattern': [
  222. '@Sender',
  223. '@AbsMethodCall.name','(',
  224. '@Arguments',
  225. ')','@newline'
  226. ]
  227. },
  228. 'Sender': {
  229. 'type': 'Association',
  230. 'name': 'SCCD.methodcall_sender',
  231. 'target': 'SCCD.Expression',
  232. 'pattern': [ '@SCCDExpression', '.' ]
  233. },
  234. 'SCCDNavExpr': {
  235. 'type': 'Class',
  236. 'name': 'SCCD.NavigationExpression',
  237. 'pattern': [ '@FirstNavigation' ]
  238. },
  239. 'FirstNavigation': {
  240. 'type': 'Association',
  241. 'name': 'SCCD.navigationexpression_absnavigationexpression',
  242. 'target': 'SCCD.AbsNavigationExpression',
  243. 'pattern': [ '@SCCDDotExpr', '@SCCDSelfExpr' ]
  244. },
  245. 'SCCDDotExpr': {
  246. 'type': 'Class',
  247. 'name': 'SCCD.DotExpression',
  248. 'pattern': [ '@DotExpression.path' ]
  249. },
  250. 'SCCDSelfExpr': {
  251. 'type': 'Class',
  252. 'name': 'SCCD.SelfExpression',
  253. 'pattern': [ 'self','@@','@NextDot' ]
  254. },
  255. 'NextDot': {
  256. 'type': 'Association',
  257. 'name': 'SCCD.selfexpression_dotexpression',
  258. 'target': 'SCCD.DotExpression',
  259. 'pattern': [ '.','@SCCDDotExpr' ]
  260. },
  261. 'SCCDMethodCall': {
  262. 'type': 'Class',
  263. 'name': 'SCCD.MethodCall',
  264. 'pattern': [
  265. '@Sender',
  266. '@AbsMethodCall.name','(',
  267. '@Arguments',
  268. ')'
  269. ]
  270. },
  271. 'SCCDUnop': {
  272. 'type': 'Class',
  273. 'name': 'SCCD.Unop',
  274. 'pattern': [
  275. '@SCCDNot',
  276. '@SCCDMinus',
  277. '@SCCDParenthesis'
  278. ]
  279. },
  280. 'SCCDNot': {
  281. 'type': 'Class',
  282. 'name': 'SCCD.Not',
  283. 'pattern': [ 'not ', '@UnopExpression' ]
  284. },
  285. 'SCCDMinus': {
  286. 'type': 'Class',
  287. 'name': 'SCCD.Minus',
  288. 'pattern': [ '-', '@UnopExpression' ]
  289. },
  290. 'SCCDParenthesis': {
  291. 'type': 'Class',
  292. 'name': 'SCCD.Parenthesis',
  293. 'pattern': [ '(', '@UnopExpression', ')' ]
  294. },
  295. 'UnopExpression': {
  296. 'type': 'Association',
  297. 'name': 'SCCD.unop_expression',
  298. 'target': 'SCCD.Expression',
  299. 'pattern': [ '@SCCDExpression' ]
  300. },
  301. 'SCCDBinop': {
  302. 'type': 'Class',
  303. 'name': 'SCCD.Binop',
  304. 'pattern': [
  305. '@SCCDAnd',
  306. '@SCCDOr',
  307. '@SCCDNEqual',
  308. '@SCCDEqual',
  309. '@SCCDLEThan',
  310. '@SCCDLThan',
  311. '@SCCDGEThan',
  312. '@SCCDGThan',
  313. '@SCCDMod',
  314. '@SCCDDiv',
  315. '@SCCDMult',
  316. '@SCCDAdd',
  317. '@SCCDSubtract',
  318. '@SCCDSelection'
  319. ]
  320. },
  321. 'BinopLeft': {
  322. 'type': 'Association',
  323. 'name': 'SCCD.binop_expression_left',
  324. 'target': 'SCCD.Expression',
  325. 'pattern': [ '@SCCDExpression' ]
  326. },
  327. 'BinopRight': {
  328. 'type': 'Association',
  329. 'name': 'SCCD.binop_expression_right',
  330. 'target': 'SCCD.Expression',
  331. 'pattern': [ '@SCCDExpression' ]
  332. },
  333. 'SCCDAnd': {
  334. 'type': 'Class',
  335. 'name': 'SCCD.And',
  336. 'pattern': [
  337. '@BinopLeft',
  338. ' and ',
  339. '@BinopRight'
  340. ]
  341. },
  342. 'SCCDOr': {
  343. 'type': 'Class',
  344. 'name': 'SCCD.Or',
  345. 'pattern': [
  346. '@BinopLeft',
  347. ' or ',
  348. '@BinopRight'
  349. ]
  350. },
  351. 'SCCDNEqual': {
  352. 'type': 'Class',
  353. 'name': 'SCCD.NEqual',
  354. 'pattern': [
  355. '@BinopLeft',
  356. ' != ',
  357. '@BinopRight'
  358. ]
  359. },
  360. 'SCCDEqual': {
  361. 'type': 'Class',
  362. 'name': 'SCCD.Equal',
  363. 'pattern': [
  364. '@BinopLeft',
  365. ' == ',
  366. '@BinopRight'
  367. ]
  368. },
  369. 'SCCDLEThan': {
  370. 'type': 'Class',
  371. 'name': 'SCCD.LEThan',
  372. 'pattern': [
  373. '@BinopLeft',
  374. ' <= ',
  375. '@BinopRight'
  376. ]
  377. },
  378. 'SCCDLThan': {
  379. 'type': 'Class',
  380. 'name': 'SCCD.LThan',
  381. 'pattern': [
  382. '@BinopLeft',
  383. ' < ',
  384. '@BinopRight'
  385. ]
  386. },
  387. 'SCCDGEThan': {
  388. 'type': 'Class',
  389. 'name': 'SCCD.GEThan',
  390. 'pattern': [
  391. '@BinopLeft',
  392. ' >= ',
  393. '@BinopRight'
  394. ]
  395. },
  396. 'SCCDGThan': {
  397. 'type': 'Class',
  398. 'name': 'SCCD.GThan',
  399. 'pattern': [
  400. '@BinopLeft',
  401. ' > ',
  402. '@BinopRight'
  403. ]
  404. },
  405. 'SCCDMod': {
  406. 'type': 'Class',
  407. 'name': 'SCCD.Mod',
  408. 'pattern': [
  409. '@BinopLeft',
  410. ' % ',
  411. '@BinopRight'
  412. ]
  413. },
  414. 'SCCDDiv': {
  415. 'type': 'Class',
  416. 'name': 'SCCD.Div',
  417. 'pattern': [
  418. '@BinopLeft',
  419. ' / ',
  420. '@BinopRight'
  421. ]
  422. },
  423. 'SCCDMult': {
  424. 'type': 'Class',
  425. 'name': 'SCCD.Mult',
  426. 'pattern': [
  427. '@BinopLeft',
  428. ' * ',
  429. '@BinopRight'
  430. ]
  431. },
  432. 'SCCDAdd': {
  433. 'type': 'Class',
  434. 'name': 'SCCD.Add',
  435. 'pattern': [
  436. '@BinopLeft',
  437. ' + ',
  438. '@BinopRight'
  439. ]
  440. },
  441. 'SCCDSubtract': {
  442. 'type': 'Class',
  443. 'name': 'SCCD.Subtract',
  444. 'pattern': [
  445. '@BinopLeft',
  446. ' - ',
  447. '@BinopRight'
  448. ]
  449. },
  450. 'SCCDSelection': {
  451. 'type': 'Class',
  452. 'name': 'SCCD.Selection',
  453. 'pattern': [
  454. '@BinopLeft',
  455. '[',
  456. '@BinopRight',
  457. ']'
  458. ]
  459. },
  460. 'SCCDComposite': {
  461. 'type': 'Class',
  462. 'name': 'SCCD.Composite',
  463. 'pattern': [ '@SCCDTuple', '@SCCDDict', '@SCCDArray' ]
  464. },
  465. 'SCCDTuple': {
  466. 'type': 'Class',
  467. 'name': 'SCCD.Tuple',
  468. 'pattern': [
  469. '(', '@CompositeArguments', ')'
  470. ]
  471. },
  472. 'SCCDArray': {
  473. 'type': 'Class',
  474. 'name': 'SCCD.Array',
  475. 'pattern': [
  476. '[', '@CompositeArguments', ']'
  477. ]
  478. },
  479. 'SCCDDict': {
  480. 'type': 'Class',
  481. 'name': 'SCCD.Dict',
  482. 'pattern': [
  483. '{', '@CompositeArguments', '}'
  484. ]
  485. },
  486. 'SCCDAtomValue': {
  487. 'type': 'Class',
  488. 'name': 'SCCD.AtomValue',
  489. 'pattern': [
  490. '@SCCDStringValue',
  491. '@SCCDIntegerValue',
  492. '@SCCDBooleanValue',
  493. '@SCCDFloatValue'
  494. ]
  495. },
  496. 'SCCDStringValue': {
  497. 'type': 'Class',
  498. 'name': 'SCCD.StringValue',
  499. 'pattern': [
  500. '\'',
  501. '@StringValue.value',
  502. '\''
  503. ]
  504. },
  505. 'SCCDIntegerValue': {
  506. 'type': 'Class',
  507. 'name': 'SCCD.IntegerValue',
  508. 'pattern': [
  509. '@IntegerValue.value',
  510. ]
  511. },
  512. 'SCCDFloatValue': {
  513. 'type': 'Class',
  514. 'name': 'SCCD.FloatValue',
  515. 'pattern': [
  516. '@FloatValue.value',
  517. ]
  518. },
  519. 'SCCDBooleanValue': {
  520. 'type': 'Class',
  521. 'name': 'SCCD.BooleanValue',
  522. 'pattern': [
  523. '@BooleanValue.value',
  524. ]
  525. },
  526. 'CompositeArguments': {
  527. 'type': 'Association',
  528. 'name': 'SCCD.composite_compositeargument',
  529. 'target': 'SCCD.CompositeArgument',
  530. 'pattern': [ '@CompositeArgument' ]
  531. },
  532. 'CompositeArgument': {
  533. 'type': 'Class',
  534. 'name': 'SCCD.CompositeArgument',
  535. 'pattern': [
  536. '@RegularArgument',
  537. '@DictArgument'
  538. ]
  539. },
  540. 'RegularArgument': {
  541. 'type': 'Class',
  542. 'name': 'SCCD.RegularArgument',
  543. 'pattern': [
  544. '@RegularArgumentValue',
  545. '@CompositeArgumentNext'
  546. ]
  547. },
  548. 'RegularArgumentValue': {
  549. 'type': 'Association',
  550. 'name': 'SCCD.regularargument_expression',
  551. 'target': 'SCCD.Expression',
  552. 'pattern': [ '@SCCDExpression' ]
  553. },
  554. 'DictArgument': {
  555. 'type': 'Class',
  556. 'name': 'SCCD.DictArgument',
  557. 'pattern': [
  558. '@DictArgumentLabel',':',
  559. '@DictArgumentValue',
  560. '@CompositeArgumentNext'
  561. ]
  562. },
  563. 'DictArgumentLabel': {
  564. 'type': 'Association',
  565. 'name': 'SCCD.dictargument_labelexpression',
  566. 'target': 'SCCD.Expression',
  567. 'pattern': [ '@SCCDExpression' ]
  568. },
  569. 'DictArgumentValue': {
  570. 'type': 'Association',
  571. 'name': 'SCCD.dictargument_expression',
  572. 'target': 'SCCD.Expression',
  573. 'pattern': [ '@SCCDExpression' ]
  574. },
  575. 'CompositeArgumentNext': {
  576. 'type': 'Association',
  577. 'name': 'SCCD.compositeargument_compositeargument_next',
  578. 'target': 'SCCD.CompositeArgument',
  579. 'pattern': [ ', ', '@CompositeArgument' ]
  580. },
  581. 'Arguments': {
  582. 'type': 'Association',
  583. 'name': 'SCCD.methodcall_argument',
  584. 'target': 'SCCD.Argument',
  585. 'pattern': [ '@SCCDArgument' ]
  586. },
  587. 'SCCDArgument': {
  588. 'type': 'Class',
  589. 'name': 'SCCD.Argument',
  590. 'pattern': [
  591. '@ArgumentName',
  592. '@ArgumentValue',
  593. '@ArgumentNext'
  594. ]
  595. },
  596. 'ArgumentName': {
  597. 'type': 'Attribute',
  598. 'pattern': [ '@Argument.name', '=']
  599. },
  600. 'ArgumentValue': {
  601. 'type': 'Association',
  602. 'name': 'SCCD.argument_value',
  603. 'target': 'SCCD.Expression',
  604. 'pattern': [ '@SCCDExpression' ]
  605. },
  606. 'ArgumentNext': {
  607. 'type': 'Association',
  608. 'name': 'SCCD.argument_argument_next',
  609. 'target': 'SCCD.Argument',
  610. 'pattern': [ ', ', '@SCCDArgument' ]
  611. },
  612. 'SCCDExpression': {
  613. 'type': 'Class',
  614. 'name': 'SCCD.Expression',
  615. 'pattern': [
  616. '@SCCDNavExpr',
  617. '@SCCDAtomValue',
  618. '@SCCDUnop',
  619. '@SCCDBinop',
  620. '@SCCDMethodCall',
  621. '@SCCDComposite'
  622. ]
  623. },
  624. 'StatementImport': {
  625. 'type': 'Class',
  626. 'name': 'SCCD.Import',
  627. 'pattern': [
  628. '@ImportFrom',
  629. 'import ', '@Import.location',
  630. '@ImportAs','@newline'
  631. ]
  632. },
  633. 'ImportFrom': {
  634. 'type': 'Attribute',
  635. 'pattern': ['from ', '@Import.from' ,' ']
  636. },
  637. 'ImportAs': {
  638. 'type': 'Attribute',
  639. 'pattern': [' as ', '@Import.as']
  640. },
  641. 'SCCDClass': {
  642. 'type': 'Class',
  643. 'name': 'SCCD.Class',
  644. 'pattern': ['<class name="', '@Named.name', '"',
  645. '@ClassDefault', '>',
  646. '@newline','@indent',
  647. '@ClassInports',
  648. '@ClassRelationships',
  649. '@ClassAttributes',
  650. '@ClassMethods',
  651. '@ClassStateMachine',
  652. '@dedent',
  653. '</class>','@newline'
  654. ]
  655. },
  656. 'ClassDefault': {
  657. 'type': 'Attribute',
  658. 'pattern': [' default="', '@Class.default' ,'"']
  659. },
  660. 'ClassStateMachine': {
  661. 'type': 'Association',
  662. 'name': 'SCCD.class_statemachine',
  663. 'target': 'SCCD.StateMachine',
  664. 'pattern': [
  665. '<scxml ', '@StateMachinePseudoStates','>', '@newline',
  666. '@indent',
  667. '@StateMachineStates',
  668. '@HistoryOnStateMachine',
  669. '@TransitionsOnStateMachine',
  670. '@dedent',
  671. '</scxml>', '@newline'
  672. ]
  673. },
  674. 'StateMachineStates': {
  675. 'type': 'Association',
  676. 'name': 'SCCD.statemachine_absstate',
  677. 'target': 'SCCD.AbsState',
  678. 'pattern': [
  679. '@SCCDState',
  680. '@SCCDOrthogonalComponent'
  681. ]
  682. },
  683. 'SCCDState': {
  684. 'type': 'Class',
  685. 'name': 'SCCD.State',
  686. 'pattern': [
  687. '<state id="', '@AbsState.name', '"', '@StatePseudoStates','>',
  688. '@newline',
  689. '@indent',
  690. '@OnEnter',
  691. '@OnExit',
  692. '@Transitions',
  693. '@HistoryOnPseudoStates',
  694. '@InnerStates',
  695. '@dedent',
  696. '</state>','@newline'
  697. ]
  698. },
  699. 'SCCDOrthogonalComponent': {
  700. 'type': 'Class',
  701. 'name': 'SCCD.OrthogonalComponent',
  702. 'pattern': [
  703. '<parallel id="', '@AbsState.name', '"', '@StatePseudoStates','>',
  704. '@newline',
  705. '@indent',
  706. '@OnEnter',
  707. '@OnExit',
  708. '@Transitions',
  709. '@HistoryOnPseudoStates',
  710. '@InnerStates',
  711. '@dedent',
  712. '</parallel>','@newline'
  713. ]
  714. },
  715. 'OnEnter': {
  716. 'type': 'Association',
  717. 'name': 'SCCD.absstate_onenter',
  718. 'target': 'SCCD.ActionBlock',
  719. 'pattern': [
  720. '<onentry>','@newline',
  721. '@indent',
  722. '<script>', '@newline',
  723. '<![CDATA[','@newline',
  724. '@SCCDActionBlock',
  725. ']]>',
  726. '@newline','</script>', '@newline',
  727. '@dedent','</onentry>', '@newline'
  728. ]
  729. },
  730. 'OnExit': {
  731. 'type': 'Association',
  732. 'name': 'SCCD.absstate_onexit',
  733. 'target': 'SCCD.ActionBlock',
  734. 'pattern': [
  735. '<onexit>','@newline',
  736. '@indent',
  737. '<script>', '@newline',
  738. '<![CDATA[','@newline',
  739. '@SCCDActionBlock',
  740. ']]>',
  741. '@newline','</script>', '@newline',
  742. '@dedent','</onexit>', '@newline'
  743. ]
  744. },
  745. 'TransitionsOnStateMachine': {
  746. 'type': 'Association',
  747. 'name': 'SCCD.statemachine_transition',
  748. 'target': 'SCCD.Transition',
  749. 'pattern': [
  750. '@SCCDTransition'
  751. ]
  752. },
  753. 'Transitions': {
  754. 'type': 'Association',
  755. 'name': 'SCCD.absstate_transition',
  756. 'target': 'SCCD.Transition',
  757. 'pattern': [
  758. '@SCCDTransition'
  759. ]
  760. },
  761. 'SCCDTransition': {
  762. 'type': 'Class',
  763. 'name': 'SCCD.Transition',
  764. 'pattern': [
  765. '<transition',
  766. '@TransitionAfter',
  767. '@TransitionPort',
  768. '@TransitionTarget',
  769. '@TransitionEventName',
  770. '@TransitionCondition',
  771. '>','@newline',
  772. '@EventParameters',
  773. '@RaiseEvents',
  774. '@TransitionActionBlock',
  775. '</transition>','@newline'
  776. ]
  777. },
  778. 'TransitionActionBlock': {
  779. 'type': 'Association',
  780. 'name': 'SCCD.transition_actionblock',
  781. 'target': 'SCCD.ActionBlock',
  782. 'pattern': ['@indent',
  783. '<script>', '@newline', '@indent',
  784. '<![CDATA[','@newline',
  785. '@SCCDActionBlock',
  786. ']]>',
  787. '@newline','@dedent','</script>',
  788. '@dedent', '@newline'
  789. ]
  790. },
  791. 'RaiseEvents': {
  792. 'type': 'Association',
  793. 'name': 'SCCD.transition_raise',
  794. 'target': 'SCCD.Raise',
  795. 'pattern': [ '@indent','@SCCDRaise','@dedent' ]
  796. },
  797. 'SCCDRaise': {
  798. 'type': 'Class',
  799. 'name': 'SCCD.Raise',
  800. 'pattern': [
  801. '<raise ',
  802. '@RaiseEventName',
  803. '@RaiseScope',
  804. '@RaiseTarget',
  805. '>', '@newline',
  806. '@RaiseEventParameters',
  807. '</raise>', '@newline',
  808. ]
  809. },
  810. 'RaiseEventParameters': {
  811. 'type': 'Association',
  812. 'name': 'SCCD.raise_methodcall',
  813. 'target': 'SCCD.MethodCall',
  814. 'pattern': [ '@SCCDMethodArgs' ]
  815. },
  816. 'SCCDMethodArgs': {
  817. 'type': 'Class',
  818. 'name': 'SCCD.MethodCall',
  819. 'pattern': ['@MethodArguments']
  820. },
  821. 'MethodArguments': {
  822. 'type': 'Association',
  823. 'name': 'SCCD.methodcall_argument',
  824. 'target': 'SCCD.Argument',
  825. 'pattern': [ '@SCCDRaiseArgument' ]
  826. },
  827. 'SCCDRaiseArgument': {
  828. 'type': 'Class',
  829. 'name': 'SCCD.Argument',
  830. 'pattern': [
  831. '@indent',
  832. '<parameter expr="',
  833. '@ArgumentValue', '"/>',
  834. '@dedent','@newline',
  835. '@RaiseArgumentNext',
  836. ]
  837. },
  838. 'RaiseArgumentNext': {
  839. 'type': 'Association',
  840. 'name': 'SCCD.argument_argument_next',
  841. 'target': 'SCCD.Argument',
  842. 'pattern': [ '@SCCDRaiseArgument' ]
  843. },
  844. 'RaiseEventName': {
  845. 'type': 'Association',
  846. 'name': 'SCCD.raise_methodcall',
  847. 'target': 'SCCD.MethodCall',
  848. 'pattern': [ '@SCCDMethodName' ]
  849. },
  850. 'SCCDMethodName': {
  851. 'type': 'Class',
  852. 'name': 'SCCD.MethodCall',
  853. 'pattern': [
  854. 'event="','@AbsMethodCall.name','"'
  855. ]
  856. },
  857. 'RaiseScope': {
  858. 'type': 'Association',
  859. 'name': 'SCCD.raise_scope',
  860. 'target': 'SCCD.Scope',
  861. 'pattern': [ '@SCCDScope' ]
  862. },
  863. 'SCCDScope': {
  864. 'type': 'Class',
  865. 'name': 'SCCD.Scope',
  866. 'pattern': [
  867. ' scope="','@ScopeExpression','"'
  868. ]
  869. },
  870. 'ScopeExpression': {
  871. 'type': 'Association',
  872. 'name': 'SCCD.scope_expression',
  873. 'target': 'SCCD.Expression',
  874. 'pattern': [ '@SCCDExpression' ]
  875. },
  876. 'RaiseTarget': {
  877. 'type': 'Association',
  878. 'name': 'SCCD.raise_target',
  879. 'target': 'SCCD.Target',
  880. 'pattern': [ '@SCCDTarget' ]
  881. },
  882. 'SCCDTarget': {
  883. 'type': 'Class',
  884. 'name': 'SCCD.Target',
  885. 'pattern': [
  886. ' target="','@TargetExpression','"'
  887. ]
  888. },
  889. 'TargetExpression': {
  890. 'type': 'Association',
  891. 'name': 'SCCD.target_expression',
  892. 'target': 'SCCD.Expression',
  893. 'pattern': [ '@SCCDExpression' ]
  894. },
  895. 'TransitionCondition': {
  896. 'type': 'Association',
  897. 'name': 'SCCD.transition_guard',
  898. 'target': 'SCCD.Guard',
  899. 'pattern': [ '@SCCDGuard' ]
  900. },
  901. 'SCCDGuard': {
  902. 'type': 'Class',
  903. 'name': 'SCCD.Guard',
  904. 'pattern': [' cond="', '@GuardExpression', '"']
  905. },
  906. 'GuardExpression': {
  907. 'type': 'Association',
  908. 'name': 'SCCD.guard_expression',
  909. 'target': 'SCCD.Expression',
  910. 'pattern': [ '@SCCDExpression' ]
  911. },
  912. 'TransitionAfter': {
  913. 'type': 'Attribute',
  914. 'pattern': [' after="', '@Transition.after' ,'"']
  915. },
  916. 'TransitionTarget': {
  917. 'type': 'Attribute',
  918. 'pattern': [' target="', '@Transition.target' ,'"']
  919. },
  920. 'EventParameters': {
  921. 'type': 'Association',
  922. 'name': 'SCCD.transition_event_trigger',
  923. 'target': 'SCCD.Event',
  924. 'pattern': [ '@SCCDTransitionEventParams' ]
  925. },
  926. 'SCCDTransitionEventParams': {
  927. 'type': 'Class',
  928. 'name': 'SCCD.Event',
  929. 'pattern': ['@FirstEventParameter']
  930. },
  931. 'FirstEventParameter': {
  932. 'type': 'Association',
  933. 'name': 'SCCD.event_parameter',
  934. 'target': 'SCCD.Parameter',
  935. 'pattern': [
  936. '@indent',
  937. '<parameter ',
  938. '@SCCDParameter', '/>',
  939. '@dedent','@newline',
  940. '@ParameterNext'
  941. ]
  942. },
  943. 'TransitionEventName': {
  944. 'type': 'Association',
  945. 'name': 'SCCD.transition_event_trigger',
  946. 'target': 'SCCD.Event',
  947. 'pattern': [ '@SCCDTransitionEventName' ]
  948. },
  949. 'SCCDTransitionEventName': {
  950. 'type': 'Class',
  951. 'name': 'SCCD.Event',
  952. 'pattern': [' event="', '@Event.name' ,'"']
  953. },
  954. 'TransitionPort': {
  955. 'type': 'Association',
  956. 'name': 'SCCD.transition_inport',
  957. 'target': 'SCCD.InPort',
  958. 'pattern': [
  959. '@SCCDTransitionInPort'
  960. ]
  961. },
  962. 'SCCDTransitionInPort': {
  963. 'type': 'Class',
  964. 'name': 'SCCD.InPort',
  965. 'pattern': [' port="', '@Named.name' ,'"']
  966. },
  967. 'InnerStates': {
  968. 'type': 'Association',
  969. 'name': 'SCCD.absstate_absstate_inner',
  970. 'target': 'SCCD.AbsState',
  971. 'pattern': [
  972. '@SCCDState',
  973. '@SCCDOrthogonalComponent'
  974. ]
  975. },
  976. 'StatePseudoStates': {
  977. 'type': 'Association',
  978. 'name': 'SCCD.absstate_pseudostate',
  979. 'target': 'SCCD.PseudoState',
  980. 'pattern': [
  981. '@SCCDInitialState',
  982. '@SCCDFinalState'
  983. ]
  984. },
  985. 'HistoryOnPseudoStates': {
  986. 'type': 'Association',
  987. 'name': 'SCCD.absstate_pseudostate',
  988. 'target': 'SCCD.PseudoState',
  989. 'pattern': [
  990. '@SCCDHistoryState'
  991. ]
  992. },
  993. 'HistoryOnStateMachine': {
  994. 'type': 'Association',
  995. 'name': 'SCCD.statemachine_pseudostate',
  996. 'target': 'SCCD.PseudoState',
  997. 'pattern': [
  998. '@SCCDHistoryState'
  999. ]
  1000. },
  1001. 'StateMachinePseudoStates': {
  1002. 'type': 'Association',
  1003. 'name': 'SCCD.statemachine_pseudostate',
  1004. 'target': 'SCCD.PseudoState',
  1005. 'pattern': [
  1006. '@SCCDInitialState',
  1007. '@SCCDFinalState'
  1008. ]
  1009. },
  1010. 'SCCDInitialState': {
  1011. 'type': 'Class',
  1012. 'name': 'SCCD.InitialState',
  1013. 'pattern': [' initial="', '@PseudoState.name', '"' ]
  1014. },
  1015. 'SCCDFinalState': {
  1016. 'type': 'Class',
  1017. 'name': 'SCCD.FinalState',
  1018. 'pattern': [' final="', '@PseudoState.name', '"' ]
  1019. },
  1020. 'SCCDHistoryState': {
  1021. 'type': 'Class',
  1022. 'name': 'SCCD.HistoryState',
  1023. 'pattern': ['<history id="', '@PseudoState.name', '"/>', '@newline' ]
  1024. },
  1025. 'ClassInports': {
  1026. 'type': 'Association',
  1027. 'name': 'SCCD.class_inport',
  1028. 'target': 'SCCD.InPort',
  1029. 'pattern': ['@SCCDInPort']
  1030. },
  1031. 'ClassRelationships': {
  1032. 'type': 'Association',
  1033. 'name': 'SCCD.class_relationship',
  1034. 'target': 'SCCD.Relationship',
  1035. 'pattern': [
  1036. '<relationships>', '@newline',
  1037. '@indent',
  1038. '@ClassAssociation',
  1039. '@ClassInheritance',
  1040. '@dedent',
  1041. '</relationships>', '@newline'
  1042. ]
  1043. },
  1044. 'ClassAssociation': {
  1045. 'type': 'Class',
  1046. 'name': 'SCCD.Association',
  1047. 'pattern': ['<association name="',
  1048. '@Association.name', '"',
  1049. '@RelationshipClass',
  1050. '@RelationshipMin',
  1051. '@RelationshipMax',
  1052. '/>',
  1053. '@newline'
  1054. ]
  1055. },
  1056. 'ClassInheritance': {
  1057. 'type': 'Class',
  1058. 'name': 'SCCD.Inheritance',
  1059. 'pattern': ['<inheritance',
  1060. '@RelationshipClass',
  1061. ' priority="','@Inheritance.priority','"',
  1062. '/>',
  1063. '@newline'
  1064. ]
  1065. },
  1066. 'RelationshipClass': {
  1067. 'type': 'Attribute',
  1068. 'pattern': [' class="','@Relationship.class', '"']
  1069. },
  1070. 'RelationshipMin': {
  1071. 'type': 'Attribute',
  1072. 'pattern': [' min="','@Relationship.min', '"']
  1073. },
  1074. 'RelationshipMax': {
  1075. 'type': 'Attribute',
  1076. 'pattern': [' max="','@Relationship.max', '"']
  1077. },
  1078. 'ClassAttributes': {
  1079. 'type': 'Association',
  1080. 'name': 'SCCD.class_attribute',
  1081. 'target': 'SCCD.Attribute',
  1082. 'pattern': [ '@ClassAttribute' ]
  1083. },
  1084. 'ClassAttribute': {
  1085. 'type': 'Class',
  1086. 'name': 'SCCD.Attribute',
  1087. 'pattern': [
  1088. '<attribute name="', '@Named.name', '"',
  1089. '@AttributeType', '@AttributeDefault',
  1090. '/>',
  1091. '@newline'
  1092. ]
  1093. },
  1094. 'AttributeType': {
  1095. 'type': 'Attribute',
  1096. 'pattern': [' type="','@Attribute.type', '"']
  1097. },
  1098. 'AttributeDefault': {
  1099. 'type': 'Attribute',
  1100. 'pattern': [' type="','@Attribute.default', '"']
  1101. },
  1102. 'ClassMethods': {
  1103. 'type': 'Association',
  1104. 'name': 'SCCD.class_method',
  1105. 'target': 'SCCD.AbsMethod',
  1106. 'pattern': [
  1107. '@ClassConstructor',
  1108. '@ClassDestructor',
  1109. '@ClassMethod'
  1110. ]
  1111. },
  1112. 'ClassConstructor': {
  1113. 'type': 'Class',
  1114. 'name': 'SCCD.Constructor',
  1115. 'pattern': [
  1116. '<method name="', '@-(SCCD.class_method).Named.name', '"', '>',
  1117. '@newline',
  1118. '@AbsMethodParameters',
  1119. '@AbsMethodBody',
  1120. '</method>', '@newline'
  1121. ]
  1122. },
  1123. 'ClassDestructor': {
  1124. 'type': 'Class',
  1125. 'name': 'SCCD.Destructor',
  1126. 'pattern': [
  1127. '<method name="~', '@-(SCCD.class_method).Named.name', '"', '>',
  1128. '@newline',
  1129. '@AbsMethodBody',
  1130. '</method>', '@newline'
  1131. ]
  1132. },
  1133. 'ClassMethod': {
  1134. 'type': 'Class',
  1135. 'name': 'SCCD.Method',
  1136. 'pattern': [
  1137. '<method name="', '@Method.name', '"', '>',
  1138. '@newline',
  1139. '@AbsMethodParameters',
  1140. '@AbsMethodBody',
  1141. '</method>', '@newline'
  1142. ]
  1143. },
  1144. 'AbsMethodParameters': {
  1145. 'type': 'Association',
  1146. 'name': 'SCCD.absmethod_parameter',
  1147. 'target': 'SCCD.Parameter',
  1148. 'pattern': [
  1149. '@indent',
  1150. '<parameter ',
  1151. '@SCCDParameter', '/>',
  1152. '@dedent', '@newline',
  1153. '@ParameterNext'
  1154. ]
  1155. },
  1156. 'ParameterNext': {
  1157. 'type': 'Association',
  1158. 'name': 'SCCD.parameter_parameter_next',
  1159. 'target': 'SCCD.Parameter',
  1160. 'pattern': [
  1161. '@indent',
  1162. '<parameter ',
  1163. '@SCCDParameter', '/>',
  1164. '@dedent', '@newline',
  1165. '@ParameterNext'
  1166. ]
  1167. },
  1168. 'SCCDParameter': {
  1169. 'type': 'Class',
  1170. 'name': 'SCCD.Parameter',
  1171. 'pattern': [
  1172. 'name="','@Parameter.name','"',
  1173. '@ParameterType',
  1174. '@ParameterDefault'
  1175. ]
  1176. },
  1177. 'ParameterType': {
  1178. 'type': 'Association',
  1179. 'name': 'SCCD.parameter_type_expression',
  1180. 'target': 'SCCD.NavigationExpression',
  1181. 'pattern': [ ' type="','@SCCDNavExpr', '"']
  1182. },
  1183. 'ParameterDefault': {
  1184. 'type': 'Attribute',
  1185. 'pattern': [ ' default="','@Parameter.default','"' ]
  1186. },
  1187. 'AbsMethodBody': {
  1188. 'type': 'Association',
  1189. 'name': 'SCCD.absmethod_actionblock_body',
  1190. 'target': 'SCCD.ActionBlock',
  1191. 'pattern': ['@indent',
  1192. '<body>', '@newline',
  1193. '<![CDATA[','@newline',
  1194. '@SCCDActionBlock',
  1195. ']]>','@newline',
  1196. '</body>',
  1197. '@dedent', '@newline'
  1198. ]
  1199. }
  1200. }