scripts/CodeMirror/mode/julia/index.html (view raw)
1<!doctype html>
2
3<title>CodeMirror: Julia 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="../../addon/edit/matchbrackets.js"></script>
10<script src="julia.js"></script>
11<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
12<div id=nav>
13 <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
14
15 <ul>
16 <li><a href="../../index.html">Home</a>
17 <li><a href="../../doc/manual.html">Manual</a>
18 <li><a href="https://github.com/codemirror/codemirror">Code</a>
19 </ul>
20 <ul>
21 <li><a href="../index.html">Language modes</a>
22 <li><a class=active href="#">Julia</a>
23 </ul>
24</div>
25
26<article>
27<h2>Julia mode</h2>
28
29 <div><textarea id="code" name="code">
30#numbers
311234
321234im
33.234
34.234im
352.23im
362.3f3
3723e2
380x234
39
40#strings
41'a'
42"asdf"
43r"regex"
44b"bytestring"
45
46"""
47multiline string
48"""
49
50#identifiers
51a
52as123
53function_name!
54
55#unicode identifiers
56# a = x\ddot
57a⃗ = ẍ
58# a = v\dot
59a⃗ = v̇
60#F\vec = m \cdotp a\vec
61F⃗ = m·a⃗
62
63#literal identifier multiples
643x
654[1, 2, 3]
66
67#dicts and indexing
68x=[1, 2, 3]
69x[end-1]
70x={"julia"=>"language of technical computing"}
71
72
73#exception handling
74try
75 f()
76catch
77 @printf "Error"
78finally
79 g()
80end
81
82#types
83immutable Color{T<:Number}
84 r::T
85 g::T
86 b::T
87end
88
89#functions
90function change!(x::Vector{Float64})
91 for i = 1:length(x)
92 x[i] *= 2
93 end
94end
95
96#function invocation
97f('b', (2, 3)...)
98
99#operators
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$
128<:
129.<
130.>
131<<
132<<=
133>>
134>>>>
135>>=
136>>>=
137<<=
138<<<=
139.<=
140.>=
141.==
142->
143//
144in
145...
146//
147:=
148.//=
149.*=
150./=
151.^=
152.%=
153.+=
154.-=
155\=
156\\=
157||
158===
159&&
160|=
161.|=
162<:
163>:
164|>
165<|
166::
167x ? y : z
168
169#macros
170@spawnat 2 1+1
171@eval(:x)
172
173#keywords and operators
174if else elseif while for
175 begin let end do
176try catch finally return break continue
177global local const
178export import importall using
179function macro module baremodule
180type immutable quote
181true false enumerate
182
183
184 </textarea></div>
185 <script>
186 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
187 mode: {name: "julia",
188 },
189 lineNumbers: true,
190 indentUnit: 4,
191 matchBrackets: true
192 });
193 </script>
194
195 <p><strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
196</article>