| 776 |
lars |
1 |
<!doctype html>
|
|
|
2 |
<title>CodeMirror: Haxe mode</title>
|
|
|
3 |
<meta charset="utf-8" />
|
|
|
4 |
<link rel=stylesheet href="../../doc/docs.css">
|
|
|
5 |
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
|
6 |
<script src="../../lib/codemirror.js"></script>
|
|
|
7 |
<script src="haxe.js"></script>
|
|
|
8 |
<style type="text/css">
|
|
|
9 |
.CodeMirror {
|
|
|
10 |
border-top: 1px solid black;
|
|
|
11 |
border-bottom: 1px solid black;
|
|
|
12 |
}
|
|
|
13 |
</style>
|
|
|
14 |
<div id=nav>
|
|
|
15 |
<a href="http://codemirror.net">
|
|
|
16 |
<h1>CodeMirror</h1>
|
|
|
17 |
<img id=logo src="../../doc/logo.png">
|
|
|
18 |
</a>
|
|
|
19 |
<ul>
|
|
|
20 |
<li>
|
|
|
21 |
<a href="../../index.html">Home</a>
|
|
|
22 |
<li>
|
|
|
23 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
24 |
<li>
|
|
|
25 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
26 |
</ul>
|
|
|
27 |
<ul>
|
|
|
28 |
<li>
|
|
|
29 |
<a href="../index.html">Language modes</a>
|
|
|
30 |
<li>
|
|
|
31 |
<a class=active href="#">Haxe</a>
|
|
|
32 |
</ul>
|
|
|
33 |
</div>
|
|
|
34 |
<article>
|
|
|
35 |
<h2>Haxe mode</h2>
|
|
|
36 |
<div>
|
|
|
37 |
<p>
|
|
|
38 |
<textarea id="code-haxe" name="code"> import one.two.Three; @attr("test") class Foo<T> extends Three { public function new() { noFoo = 12; } public static inline function doFoo(obj:{k:Int, l:Float}):Int { for(i in 0...10) { obj.k++; trace(i); var var1 = new Array(); if(var1.length
|
|
|
39 |
> 1) throw "Error"; } // The following line should not be colored, the variable is scoped out var1; /* Multi line * Comment test */ return obj.k; } private function bar():Void { #if flash var t1:String = "1.21"; #end try { doFoo({k:3,
|
|
|
40 |
l:1.2}); } catch (e : String) { trace(e); } var t2:Float = cast(3.2); var t3:haxe.Timer = new haxe.Timer(); var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)}; var t5 = ~/123+.*$/i; doFoo(t4); untyped t1 = 4; bob = new Foo<Int> } public
|
|
|
41 |
var okFoo(default, never):Float; var noFoo(getFoo, null):Int; function getFoo():Int { return noFoo; } public var three:Int; } enum Color { red; green; blue; grey( v : Int ); rgb (r:Int,g:Int,b:Int); } </textarea>
|
|
|
42 |
</p>
|
|
|
43 |
<p>Hxml mode:</p>
|
|
|
44 |
<p>
|
|
|
45 |
<textarea id="code-hxml"> -cp test -js path/to/file.js #-remap nme:flash --next -D source-map-content -cmd 'test' -lib lime </textarea>
|
|
|
46 |
</p>
|
|
|
47 |
</div>
|
|
|
48 |
<script>
|
|
|
49 |
var editor = CodeMirror.fromTextArea(document.getElementById("code-haxe"),
|
|
|
50 |
{
|
|
|
51 |
mode: "haxe",
|
|
|
52 |
lineNumbers: true,
|
|
|
53 |
indentUnit: 4,
|
|
|
54 |
indentWithTabs: true
|
|
|
55 |
});
|
|
|
56 |
editor = CodeMirror.fromTextArea(document.getElementById("code-hxml"),
|
|
|
57 |
{
|
|
|
58 |
mode: "hxml",
|
|
|
59 |
lineNumbers: true,
|
|
|
60 |
indentUnit: 4,
|
|
|
61 |
indentWithTabs: true
|
|
|
62 |
});
|
|
|
63 |
</script>
|
|
|
64 |
<p>
|
|
|
65 |
<strong>MIME types defined:</strong> <code>text/x-haxe, text/x-hxml</code>.</p>
|
|
|
66 |
</article>
|