sccd_to_xml_PY.py 28 KB

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