index.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <!doctype html>
  2. <title>CodeMirror: Julia 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="julia.js"></script>
  8. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/marijnh/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">Julia</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Julia mode</h2>
  23. <div><textarea id="code" name="code">
  24. #numbers
  25. 1234
  26. 1234im
  27. .234
  28. .234im
  29. 2.23im
  30. 2.3f3
  31. 23e2
  32. 0x234
  33. #strings
  34. 'a'
  35. "asdf"
  36. r"regex"
  37. b"bytestring"
  38. """
  39. multiline string
  40. """
  41. #identifiers
  42. a
  43. as123
  44. function_name!
  45. #literal identifier multiples
  46. 3x
  47. 4[1, 2, 3]
  48. #dicts and indexing
  49. x=[1, 2, 3]
  50. x[end-1]
  51. x={"julia"=>"language of technical computing"}
  52. #exception handling
  53. try
  54. f()
  55. catch
  56. @printf "Error"
  57. finally
  58. g()
  59. end
  60. #types
  61. immutable Color{T<:Number}
  62. r::T
  63. g::T
  64. b::T
  65. end
  66. #functions
  67. function change!(x::Vector{Float64})
  68. for i = 1:length(x)
  69. x[i] *= 2
  70. end
  71. end
  72. #function invocation
  73. f('b', (2, 3)...)
  74. #operators
  75. |=
  76. &=
  77. ^=
  78. \-
  79. %=
  80. *=
  81. +=
  82. -=
  83. <=
  84. >=
  85. !=
  86. ==
  87. %
  88. *
  89. +
  90. -
  91. <
  92. >
  93. !
  94. =
  95. |
  96. &
  97. ^
  98. \
  99. ?
  100. ~
  101. :
  102. $
  103. <:
  104. .<
  105. .>
  106. <<
  107. <<=
  108. >>
  109. >>>>
  110. >>=
  111. >>>=
  112. <<=
  113. <<<=
  114. .<=
  115. .>=
  116. .==
  117. ->
  118. //
  119. in
  120. ...
  121. //
  122. :=
  123. .//=
  124. .*=
  125. ./=
  126. .^=
  127. .%=
  128. .+=
  129. .-=
  130. \=
  131. \\=
  132. ||
  133. ===
  134. &&
  135. |=
  136. .|=
  137. <:
  138. >:
  139. |>
  140. <|
  141. ::
  142. x ? y : z
  143. #macros
  144. @spawnat 2 1+1
  145. @eval(:x)
  146. #keywords and operators
  147. if else elseif while for
  148. begin let end do
  149. try catch finally return break continue
  150. global local const
  151. export import importall using
  152. function macro module baremodule
  153. type immutable quote
  154. true false enumerate
  155. </textarea></div>
  156. <script>
  157. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  158. mode: {name: "julia",
  159. },
  160. lineNumbers: true,
  161. indentUnit: 4,
  162. matchBrackets: true
  163. });
  164. </script>
  165. <p><strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
  166. </article>