| 776 |
lars |
1 |
<!doctype html>
|
|
|
2 |
<title>CodeMirror: Forth mode</title>
|
|
|
3 |
<meta charset="utf-8" />
|
|
|
4 |
<link rel=stylesheet href="../../doc/docs.css">
|
|
|
5 |
<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
|
|
|
6 |
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
|
7 |
<link rel=stylesheet href="../../theme/colorforth.css">
|
|
|
8 |
<script src="../../lib/codemirror.js"></script>
|
|
|
9 |
<script src="forth.js"></script>
|
|
|
10 |
<style>
|
|
|
11 |
.CodeMirror {
|
|
|
12 |
font-family: 'Droid Sans Mono', monospace;
|
|
|
13 |
font-size: 14px;
|
|
|
14 |
}
|
|
|
15 |
</style>
|
|
|
16 |
<div id=nav>
|
|
|
17 |
<a href="http://codemirror.net">
|
|
|
18 |
<h1>CodeMirror</h1>
|
|
|
19 |
<img id=logo src="../../doc/logo.png">
|
|
|
20 |
</a>
|
|
|
21 |
<ul>
|
|
|
22 |
<li>
|
|
|
23 |
<a href="../../index.html">Home</a>
|
|
|
24 |
<li>
|
|
|
25 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
26 |
<li>
|
|
|
27 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
28 |
</ul>
|
|
|
29 |
<ul>
|
|
|
30 |
<li>
|
|
|
31 |
<a href="../index.html">Language modes</a>
|
|
|
32 |
<li>
|
|
|
33 |
<a class=active href="#">Forth</a>
|
|
|
34 |
</ul>
|
|
|
35 |
</div>
|
|
|
36 |
<article>
|
|
|
37 |
<h2>Forth mode</h2>
|
|
|
38 |
<form>
|
|
|
39 |
<textarea id="code" name="code"> \ Insertion sort : cell- 1 cells - ; : insert ( start end -- start ) dup @ >r ( r: v ) begin 2dup
|
|
|
40 |
< while r@ over cell- @ < while cell- dup @ over cell+ ! repeat then r> swap ! ; : sort ( array len -- ) 1 ?do dup i cells + insert loop drop ;</textarea>
|
|
|
41 |
</form>
|
|
|
42 |
<script>
|
|
|
43 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"),
|
|
|
44 |
{
|
|
|
45 |
lineNumbers: true,
|
|
|
46 |
lineWrapping: true,
|
|
|
47 |
indentUnit: 2,
|
|
|
48 |
tabSize: 2,
|
|
|
49 |
autofocus: true,
|
|
|
50 |
theme: "colorforth",
|
|
|
51 |
mode: "text/x-forth"
|
|
|
52 |
});
|
|
|
53 |
</script>
|
|
|
54 |
<p>Simple mode that handle Forth-Syntax (
|
|
|
55 |
<a href="http://en.wikipedia.org/wiki/Forth_%28programming_language%29">Forth on WikiPedia</a>).</p>
|
|
|
56 |
<p>
|
|
|
57 |
<strong>MIME types defined:</strong> <code>text/x-forth</code>.</p>
|
|
|
58 |
</article>
|