sccd_to_xml_JS.py 28 KB

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