sccd_to_xml_PY.py 28 KB

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