| 776 |
lars |
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">
|
|
|
9 |
.CodeMirror {
|
|
|
10 |
border-top: 1px solid black;
|
|
|
11 |
border-bottom: 1px solid black;
|
|
|
12 |
}
|
|
|
13 |
</style>
|
|
|
14 |
<div id=nav>
|
|
|
15 |
<a href="http://codemirror.net">
|
|
|
16 |
<h1>CodeMirror</h1>
|
|
|
17 |
<img id=logo src="../../doc/logo.png">
|
|
|
18 |
</a>
|
|
|
19 |
<ul>
|
|
|
20 |
<li>
|
|
|
21 |
<a href="../../index.html">Home</a>
|
|
|
22 |
<li>
|
|
|
23 |
<a href="../../doc/manual.html">Manual</a>
|
|
|
24 |
<li>
|
|
|
25 |
<a href="https://github.com/codemirror/codemirror">Code</a>
|
|
|
26 |
</ul>
|
|
|
27 |
<ul>
|
|
|
28 |
<li>
|
|
|
29 |
<a href="../index.html">Language modes</a>
|
|
|
30 |
<li>
|
|
|
31 |
<a class=active href="#">Julia</a>
|
|
|
32 |
</ul>
|
|
|
33 |
</div>
|
|
|
34 |
<article>
|
|
|
35 |
<h2>Julia mode</h2>
|
|
|
36 |
<div>
|
|
|
37 |
<textarea id="code" name="code"> #numbers 1234 1234im .234 .234im 2.23im 2.3f3 23e2 0x234 #strings 'a' "asdf" r"regex" b"bytestring" """ multiline string """ #identifiers a as123 function_name! #unicode identifiers # a = x\ddot a⃗ = ẍ # a = v\dot a⃗ = v̇ #F\vec = m \cdotp a\vec
|
|
|
38 |
F⃗ = m·a⃗ #literal identifier multiples 3x 4[1, 2, 3] #dicts and indexing x=[1, 2, 3] x[end-1] x={"julia"=>"language of technical computing"} #exception handling try f() catch @printf "Error" finally g() end #types immutable Color{T
|
|
|
39 |
<:Number}
|
|
|
40 |
r::T g::T b::T end #functions function change!(x::Vector{Float64}) for i=1 :length(x) x[i] *=2 end end #function invocation f( 'b', (2, 3)...) #operators |=&=^=\ - %=*=+=-=<=>= != == % * + -
|
|
|
41 |
<> ! = | & ^ \ ? ~ : $
|
|
|
42 |
<: .< .>
|
|
|
43 |
<< <<=>> >>>> >>= >>>=
|
|
|
44 |
<<=< <<=. <=.>= .== -> // in ... // := .//= .*= ./= .^= .%= .+= .-= \= \\= || === && |= .|=
|
|
|
45 |
<:>: |>
|
|
|
46 |
<| :: x ? y : z #macros @spawnat 2 1+1 @eval(:x) #keywords and operators if else elseif while for begin let end do try catch finally return break continue global local const export import importall using function macro
|
|
|
47 |
module baremodule type immutable quote true false enumerate </textarea>
|
|
|
48 |
</div>
|
|
|
49 |
<script>
|
|
|
50 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"),
|
|
|
51 |
{
|
|
|
52 |
mode:
|
|
|
53 |
{
|
|
|
54 |
name: "julia",
|
|
|
55 |
},
|
|
|
56 |
lineNumbers: true,
|
|
|
57 |
indentUnit: 4,
|
|
|
58 |
matchBrackets: true
|
|
|
59 |
});
|
|
|
60 |
</script>
|
|
|
61 |
<p>
|
|
|
62 |
<strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
|
|
|
63 |
</article>
|