all repos — NoPaste @ 29b774f090102303e43cf939b38ac2083e62d9f1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/modelica/index.html (view raw)

 1<!doctype html>
 2
 3<title>CodeMirror: Modelica 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="../../addon/edit/matchbrackets.js"></script>
10<link rel="stylesheet" href="../../addon/hint/show-hint.css">
11<script src="../../addon/hint/show-hint.js"></script>
12<script src="modelica.js"></script>
13<style>.CodeMirror {border: 2px inset #dee;}</style>
14<div id=nav>
15  <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
16
17  <ul>
18    <li><a href="../../index.html">Home</a>
19    <li><a href="../../doc/manual.html">Manual</a>
20    <li><a href="https://github.com/codemirror/codemirror">Code</a>
21  </ul>
22  <ul>
23    <li><a href="../index.html">Language modes</a>
24    <li><a class=active href="#">Modelica</a>
25  </ul>
26</div>
27
28<article>
29<h2>Modelica mode</h2>
30
31<div><textarea id="modelica">
32model BouncingBall
33  parameter Real e = 0.7;
34  parameter Real g = 9.81;
35  Real h(start=1);
36  Real v;
37  Boolean flying(start=true);
38  Boolean impact;
39  Real v_new;
40equation
41  impact = h <= 0.0;
42  der(v) = if flying then -g else 0;
43  der(h) = v;
44  when {h <= 0.0 and v <= 0.0, impact} then
45    v_new = if edge(impact) then -e*pre(v) else 0;
46    flying = v_new > 0;
47    reinit(v, v_new);
48  end when;
49  annotation (uses(Modelica(version="3.2")));
50end BouncingBall;
51</textarea></div>
52
53    <script>
54      var modelicaEditor = CodeMirror.fromTextArea(document.getElementById("modelica"), {
55        lineNumbers: true,
56        matchBrackets: true,
57        mode: "text/x-modelica"
58      });
59      var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
60      CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
61    </script>
62
63    <p>Simple mode that tries to handle Modelica as well as it can.</p>
64
65    <p><strong>MIME types defined:</strong> <code>text/x-modelica</code>
66    (Modlica code).</p>
67</article>