openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (2577B)


      1 <!doctype html>
      2 
      3 <title>CodeMirror: Haxe 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="haxe.js"></script>
     10 <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
     11 <div id=nav>
     12   <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
     13 
     14   <ul>
     15     <li><a href="../../index.html">Home</a>
     16     <li><a href="../../doc/manual.html">Manual</a>
     17     <li><a href="https://github.com/codemirror/codemirror">Code</a>
     18   </ul>
     19   <ul>
     20     <li><a href="../index.html">Language modes</a>
     21     <li><a class=active href="#">Haxe</a>
     22   </ul>
     23 </div>
     24 
     25 <article>
     26 <h2>Haxe mode</h2>
     27 
     28 
     29 <div><p><textarea id="code-haxe" name="code">
     30 import one.two.Three;
     31 
     32 @attr("test")
     33 class Foo&lt;T&gt; extends Three
     34 {
     35 	public function new()
     36 	{
     37 		noFoo = 12;
     38 	}
     39 	
     40 	public static inline function doFoo(obj:{k:Int, l:Float}):Int
     41 	{
     42 		for(i in 0...10)
     43 		{
     44 			obj.k++;
     45 			trace(i);
     46 			var var1 = new Array();
     47 			if(var1.length > 1)
     48 				throw "Error";
     49 		}
     50 		// The following line should not be colored, the variable is scoped out
     51 		var1;
     52 		/* Multi line
     53 		 * Comment test
     54 		 */
     55 		return obj.k;
     56 	}
     57 	private function bar():Void
     58 	{
     59 		#if flash
     60 		var t1:String = "1.21";
     61 		#end
     62 		try {
     63 			doFoo({k:3, l:1.2});
     64 		}
     65 		catch (e : String) {
     66 			trace(e);
     67 		}
     68 		var t2:Float = cast(3.2);
     69 		var t3:haxe.Timer = new haxe.Timer();
     70 		var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
     71 		var t5 = ~/123+.*$/i;
     72 		doFoo(t4);
     73 		untyped t1 = 4;
     74 		bob = new Foo&lt;Int&gt;
     75 	}
     76 	public var okFoo(default, never):Float;
     77 	var noFoo(getFoo, null):Int;
     78 	function getFoo():Int {
     79 		return noFoo;
     80 	}
     81 	
     82 	public var three:Int;
     83 }
     84 enum Color
     85 {
     86 	red;
     87 	green;
     88 	blue;
     89 	grey( v : Int );
     90 	rgb (r:Int,g:Int,b:Int);
     91 }
     92 </textarea></p>
     93 
     94 <p>Hxml mode:</p>
     95 
     96 <p><textarea id="code-hxml">
     97 -cp test
     98 -js path/to/file.js
     99 #-remap nme:flash
    100 --next
    101 -D source-map-content
    102 -cmd 'test'
    103 -lib lime
    104 </textarea></p>
    105 </div>
    106 
    107     <script>
    108       var editor = CodeMirror.fromTextArea(document.getElementById("code-haxe"), {
    109       	mode: "haxe",
    110         lineNumbers: true,
    111         indentUnit: 4,
    112         indentWithTabs: true
    113       });
    114       
    115       editor = CodeMirror.fromTextArea(document.getElementById("code-hxml"), {
    116       	mode: "hxml",
    117         lineNumbers: true,
    118         indentUnit: 4,
    119         indentWithTabs: true
    120       });
    121     </script>
    122 
    123     <p><strong>MIME types defined:</strong> <code>text/x-haxe, text/x-hxml</code>.</p>
    124   </article>