all repos — NoPaste @ 29b774f090102303e43cf939b38ac2083e62d9f1

Resurrected - The PussTheCat.org fork of NoPaste

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

 1<!DOCTYPE html>
 2
 3<title>CodeMirror: Rust 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/mode/simple.js"></script>
10<script src="wast.js"></script>
11<style>
12  .CodeMirror {
13    border-top: 1px solid black;
14    border-bottom: 1px solid black;
15  }
16</style>
17<div id=nav>
18  <a href="https://codemirror.net">
19    <h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt="">
20  </a>
21
22  <ul>
23    <li><a href="../../index.html">Home</a>
24    <li><a href="../../doc/manual.html">Manual</a>
25    <li><a href="https://github.com/codemirror/codemirror">Code</a>
26  </ul>
27  <ul>
28    <li><a href="../index.html">Language modes</a>
29    <li><a class=active href="#">WebAssembly</a>
30  </ul>
31</div>
32
33<article>
34  <h2>WebAssembly mode</h2>
35
36
37  <div><textarea id="code" name="code">
38/* Example WebAssembly */
39(module $foo
40 (export "fac" (func $fac))
41 (export "plus" (func $plus))
42
43 (func $fac (type $t0) (param $p0 i64) (result i64)
44    (if $I0 (result i64)
45      (i64.lt_s
46        (local.get $p0)
47        (i64.const 1))
48      (then
49        (i64.const 1))
50      (else
51        (i64.mul
52          (local.get $p0)
53          (call $fac
54            (i64.sub
55              (local.get $p0)
56              (i64.const 1)))))))
57
58 (func $plus (param $x i32) (param $y i32) (result i32)
59  (i32.add
60   (local.get $x)
61   (local.get $y))))</textarea></div>
62
63  <script>
64    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
65      lineNumbers: true,
66      lineWrapping: true,
67      indentUnit: 4,
68      mode: "wast"
69    });
70  </script>
71
72  <p><strong>MIME types defined:</strong> <code>text/webassembly</code>.</p>
73</article>