index.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Haxe mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="haxe.js"></script>
  9. <link rel="stylesheet" href="../../doc/docs.css">
  10. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  11. </head>
  12. <body>
  13. <h1>CodeMirror: Haxe mode</h1>
  14. <div><textarea id="code" name="code">
  15. import one.two.Three;
  16. @attr("test")
  17. class Foo&lt;T&gt; extends Three
  18. {
  19. public function new()
  20. {
  21. noFoo = 12;
  22. }
  23. public static inline function doFoo(obj:{k:Int, l:Float}):Int
  24. {
  25. for(i in 0...10)
  26. {
  27. obj.k++;
  28. trace(i);
  29. var var1 = new Array();
  30. if(var1.length > 1)
  31. throw "Error";
  32. }
  33. // The following line should not be colored, the variable is scoped out
  34. var1;
  35. /* Multi line
  36. * Comment test
  37. */
  38. return obj.k;
  39. }
  40. private function bar():Void
  41. {
  42. #if flash
  43. var t1:String = "1.21";
  44. #end
  45. try {
  46. doFoo({k:3, l:1.2});
  47. }
  48. catch (e : String) {
  49. trace(e);
  50. }
  51. var t2:Float = cast(3.2);
  52. var t3:haxe.Timer = new haxe.Timer();
  53. var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
  54. var t5 = ~/123+.*$/i;
  55. doFoo(t4);
  56. untyped t1 = 4;
  57. bob = new Foo&lt;Int&gt;
  58. }
  59. public var okFoo(default, never):Float;
  60. var noFoo(getFoo, null):Int;
  61. function getFoo():Int {
  62. return noFoo;
  63. }
  64. public var three:Int;
  65. }
  66. enum Color
  67. {
  68. red;
  69. green;
  70. blue;
  71. grey( v : Int );
  72. rgb (r:Int,g:Int,b:Int);
  73. }
  74. </textarea></div>
  75. <script>
  76. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  77. lineNumbers: true,
  78. indentUnit: 4,
  79. indentWithTabs: true
  80. });
  81. </script>
  82. <p><strong>MIME types defined:</strong> <code>text/x-haxe</code>.</p>
  83. </body>
  84. </html>