sccd_to_xml_JS.py 28 KB

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