index.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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"><h1>CodeMirror</h1><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/codemirror/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. #unicode identifiers
  46. # a = x\ddot
  47. a⃗ = ẍ
  48. # a = v\dot
  49. a⃗ = v̇
  50. #F\vec = m \cdotp a\vec
  51. F⃗ = m·a⃗
  52. #literal identifier multiples
  53. 3x
  54. 4[1, 2, 3]
  55. #dicts and indexing
  56. x=[1, 2, 3]
  57. x[end-1]
  58. x={"julia"=>"language of technical computing"}
  59. #exception handling
  60. try
  61. f()
  62. catch
  63. @printf "Error"
  64. finally
  65. g()
  66. end
  67. #types
  68. immutable Color{T<:Number}
  69. r::T
  70. g::T
  71. b::T
  72. end
  73. #functions
  74. function change!(x::Vector{Float64})
  75. for i = 1:length(x)
  76. x[i] *= 2
  77. end
  78. end
  79. #function invocation
  80. f('b', (2, 3)...)
  81. #operators
  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. <<=
  120. <<<=
  121. .<=
  122. .>=
  123. .==
  124. ->
  125. //
  126. in
  127. ...
  128. //
  129. :=
  130. .//=
  131. .*=
  132. ./=
  133. .^=
  134. .%=
  135. .+=
  136. .-=
  137. \=
  138. \\=
  139. ||
  140. ===
  141. &&
  142. |=
  143. .|=
  144. <:
  145. >:
  146. |>
  147. <|
  148. ::
  149. x ? y : z
  150. #macros
  151. @spawnat 2 1+1
  152. @eval(:x)
  153. #keywords and operators
  154. if else elseif while for
  155. begin let end do
  156. try catch finally return break continue
  157. global local const
  158. export import importall using
  159. function macro module baremodule
  160. type immutable quote
  161. true false enumerate
  162. </textarea></div>
  163. <script>
  164. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  165. mode: {name: "julia",
  166. },
  167. lineNumbers: true,
  168. indentUnit: 4,
  169. matchBrackets: true
  170. });
  171. </script>
  172. <p><strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
  173. </article>