| 1 | <!doctype html> |
| 2 | |
| 3 | <title>CodeMirror: Oz 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="oz.js"></script> |
| 10 | <script src="../../addon/runmode/runmode.js"></script> |
| 11 | <style> |
| 12 | .CodeMirror {border: 1px solid #aaa;} |
| 13 | </style> |
| 14 | <div id=nav> |
| 15 | <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 16 | <ul> |
| 17 | <li><a href="../../index.html">Home</a> |
| 18 | <li><a href="../../doc/manual.html">Manual</a> |
| 19 | <li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 20 | </ul> |
| 21 | <ul> |
| 22 | <li><a href="../index.html">Language modes</a> |
| 23 | <li><a class=active href="#">Oz</a> |
| 24 | </ul> |
| 25 | </div> |
| 26 | |
| 27 | <article> |
| 28 | <h2>Oz mode</h2> |
| 29 | <textarea id="code" name="code"> |
| 30 | declare |
| 31 | fun {Ints N Max} |
| 32 | if N == Max then nil |
| 33 | else |
| 34 | {Delay 1000} |
| 35 | N|{Ints N+1 Max} |
| 36 | end |
| 37 | end |
| 38 | |
| 39 | fun {Sum S Stream} |
| 40 | case Stream of nil then S |
| 41 | [] H|T then S|{Sum H+S T} end |
| 42 | end |
| 43 | |
| 44 | local X Y in |
| 45 | thread X = {Ints 0 1000} end |
| 46 | thread Y = {Sum 0 X} end |
| 47 | {Browse Y} |
| 48 | end |
| 49 | </textarea> |
| 50 | <p>MIME type defined: <code>text/x-oz</code>.</p> |
| 51 | |
| 52 | <script> |
| 53 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 54 | lineNumbers: true, |
| 55 | mode: "text/x-oz", |
| 56 | readOnly: false |
| 57 | }); |
| 58 | </script> |
| 59 | </article> |