source: spip-zone/_plugins_/skeleditor/trunk/codemirror/mode/mscgen/index.html @ 111862

Last change on this file since 111862 was 111862, checked in by arnaud.berard@…, 14 months ago

avec svn add c'est mieux

  • addons
  • demo
  • mode

-theme

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