You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
2.4 KiB

2 months ago
  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="../../addon/edit/matchbrackets.js"></script>
  8. <script src="julia.js"></script>
  9. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  10. <div id=nav>
  11. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
  12. <ul>
  13. <li><a href="../../index.html">Home</a>
  14. <li><a href="../../doc/manual.html">Manual</a>
  15. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  16. </ul>
  17. <ul>
  18. <li><a href="../index.html">Language modes</a>
  19. <li><a class=active href="#">Julia</a>
  20. </ul>
  21. </div>
  22. <article>
  23. <h2>Julia mode</h2>
  24. <div><textarea id="code" name="code">
  25. #numbers
  26. 1234
  27. 1234im
  28. .234
  29. .234im
  30. 2.23im
  31. 2.3f3
  32. 23e2
  33. 0x234
  34. #strings
  35. 'a'
  36. "asdf"
  37. r"regex"
  38. b"bytestring"
  39. """
  40. multiline string
  41. """
  42. #identifiers
  43. a
  44. as123
  45. function_name!
  46. #unicode identifiers
  47. # a = x\ddot
  48. a⃗ = ẍ
  49. # a = v\dot
  50. a⃗ = v̇
  51. #F\vec = m \cdotp a\vec
  52. F⃗ = m·a⃗
  53. #literal identifier multiples
  54. 3x
  55. 4[1, 2, 3]
  56. #dicts and indexing
  57. x=[1, 2, 3]
  58. x[end-1]
  59. x={"julia"=>"language of technical computing"}
  60. #exception handling
  61. try
  62. f()
  63. catch
  64. @printf "Error"
  65. finally
  66. g()
  67. end
  68. #types
  69. immutable Color{T<:Number}
  70. r::T
  71. g::T
  72. b::T
  73. end
  74. #functions
  75. function change!(x::Vector{Float64})
  76. for i = 1:length(x)
  77. x[i] *= 2
  78. end
  79. end
  80. #function invocation
  81. f('b', (2, 3)...)
  82. #operators
  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. //
  127. in
  128. ...
  129. //
  130. :=
  131. .//=
  132. .*=
  133. ./=
  134. .^=
  135. .%=
  136. .+=
  137. .-=
  138. \=
  139. \\=
  140. ||
  141. ===
  142. &&
  143. |=
  144. .|=
  145. <:
  146. >:
  147. |>
  148. <|
  149. ::
  150. x ? y : z
  151. #macros
  152. @spawnat 2 1+1
  153. @eval(:x)
  154. #keywords and operators
  155. if else elseif while for
  156. begin let end do
  157. try catch finally return break continue
  158. global local const
  159. export import importall using
  160. function macro module baremodule
  161. type immutable quote
  162. true false enumerate
  163. </textarea></div>
  164. <script>
  165. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  166. mode: {name: "julia",
  167. },
  168. lineNumbers: true,
  169. indentUnit: 4,
  170. matchBrackets: true
  171. });
  172. </script>
  173. <p><strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
  174. </article>