all repos — NoPaste @ 5c12c8a8f515faa64a6cd1d3f04d9aa60561322d

Resurrected - The PussTheCat.org fork of NoPaste

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

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