index.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!doctype html>
  2. <title>CodeMirror: MscGen mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="mscgen.js"></script>
  8. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">MscGen</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>MscGen mode</h2>
  23. <div><textarea id="mscgen-code">
  24. # Sample mscgen program
  25. # See http://www.mcternan.me.uk/mscgen or
  26. # https://sverweij.github.io/mscgen_js for more samples
  27. msc {
  28. # options
  29. hscale="1.2";
  30. # entities/ lifelines
  31. a [label="Entity A"],
  32. b [label="Entity B", linecolor="red", arclinecolor="red", textbgcolor="pink"],
  33. c [label="Entity C"];
  34. # arcs/ messages
  35. a => c [label="doSomething(args)"];
  36. b => c [label="doSomething(args)"];
  37. c >> * [label="everyone asked me", arcskip="1"];
  38. c =>> c [label="doing something"];
  39. c -x * [label="report back", arcskip="1"];
  40. |||;
  41. --- [label="shows's over, however ..."];
  42. b => a [label="did you see c doing something?"];
  43. a -> b [label="nope"];
  44. b :> a [label="shall we ask again?"];
  45. a => b [label="naah"];
  46. ...;
  47. }
  48. </textarea></div>
  49. <h2>Xù mode</h2>
  50. <div><textarea id="xu-code">
  51. # Xù - expansions to MscGen to support inline expressions
  52. # https://github.com/sverweij/mscgen_js/blob/master/wikum/xu.md
  53. # More samples: https://sverweij.github.io/mscgen_js
  54. msc {
  55. hscale="0.8",
  56. width="700";
  57. a,
  58. b [label="change store"],
  59. c,
  60. d [label="necro queue"],
  61. e [label="natalis queue"],
  62. f;
  63. a =>> b [label="get change list()"];
  64. a alt f [label="changes found"] { /* alt is a xu specific keyword*/
  65. b >> a [label="list of changes"];
  66. a =>> c [label="cull old stuff (list of changes)"];
  67. b loop e [label="for each change"] { // loop is xu specific as well...
  68. /*
  69. * Interesting stuff happens.
  70. */
  71. c =>> b [label="get change()"];
  72. b >> c [label="change"];
  73. c alt e [label="change too old"] {
  74. c =>> d [label="queue(change)"];
  75. --- [label="change newer than latest run"];
  76. c =>> e [label="queue(change)"];
  77. --- [label="all other cases"];
  78. ||| [label="leave well alone"];
  79. };
  80. };
  81. c >> a [label="done
  82. processing"];
  83. /* shucks! nothing found ...*/
  84. --- [label="nothing found"];
  85. b >> a [label="nothing"];
  86. a note a [label="silent exit"];
  87. };
  88. }
  89. </textarea></div>
  90. <h2>MsGenny mode</h2>
  91. <div><textarea id="msgenny-code">
  92. # MsGenny - simplified version of MscGen / Xù
  93. # https://github.com/sverweij/mscgen_js/blob/master/wikum/msgenny.md
  94. # More samples: https://sverweij.github.io/mscgen_js
  95. a -> b : a -> b (signal);
  96. a => b : a => b (method);
  97. b >> a : b >> a (return value);
  98. a =>> b : a =>> b (callback);
  99. a -x b : a -x b (lost);
  100. a :> b : a :> b (emphasis);
  101. a .. b : a .. b (dotted);
  102. a -- b : "a -- b straight line";
  103. a note a : a note a\n(note),
  104. b box b : b box b\n(action);
  105. a rbox a : a rbox a\n(reference),
  106. b abox b : b abox b\n(state/ condition);
  107. ||| : ||| (empty row);
  108. ... : ... (omitted row);
  109. --- : --- (comment);
  110. </textarea></div>
  111. <p>
  112. Simple mode for highlighting MscGen and two derived sequence
  113. chart languages.
  114. </p>
  115. <script>
  116. var mscgenEditor = CodeMirror.fromTextArea(document.getElementById("mscgen-code"), {
  117. lineNumbers: true,
  118. mode: "text/x-mscgen",
  119. });
  120. var xuEditor = CodeMirror.fromTextArea(document.getElementById("xu-code"), {
  121. lineNumbers: true,
  122. mode: "text/x-xu",
  123. });
  124. var msgennyEditor = CodeMirror.fromTextArea(document.getElementById("msgenny-code"), {
  125. lineNumbers: true,
  126. mode: "text/x-msgenny",
  127. });
  128. </script>
  129. <p><strong>MIME types defined:</strong>
  130. <code>text/x-mscgen</code>
  131. <code>text/x-xu</code>
  132. <code>text/x-msgenny</code>
  133. </p>
  134. </article>