-
Notifications
You must be signed in to change notification settings - Fork 4
/
embedded_code.jl
71 lines (54 loc) · 1.18 KB
/
embedded_code.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#= Embedded code
Provides syntax cases of macro-embedded code in julia.
=#
using Cxx
using PyCall
using RCall
using Markdown
# Expected: the contents of the strings should look like R code.
R"x <- 3"
R"""
y <- fit(x, q)
"""
# Expected: the contents should look like markdown. Embedded code blocks
# should look like blocks in their respective languages.
md"""
# This is a header
Here is some markdown text
- This is a list item
- This is another item
This should look like a block of julia code:
```julia
x = x + y
```
And this should look like a block of C++:
```c++
auto x = 42;
```
"""
# Expected: the string delimiters should look like strings, and the string
# contents should look like C++
cxx"""
#include <cxx>
"""
# Expected: this should look like an ordinary julia expression
q = 42
# Expected: the macro captures should be highlighted specially
icxx"f(($x));"
icxx"""
auto x = $y;
auto z = q($x);
return x;
"""
str = "the sky is $(g)"
# Expected: should look like javascript inside
js"""
alert("Hello")
"""
# Expected: should look like python inside
py"""
import numpy as np
print 'Hello, world!'
"""
# Expected: should look like an ordinary julia expression
x = 2 + 2