-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.inko
96 lines (76 loc) · 1.34 KB
/
test.inko
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import std.stdio (Stdout)
type pub Person {
let @name: String
let @age: Int
}
type enum Result[T, E] {
case Ok(T)
case Err(E)
fn ok? -> Bool {
match self {
case Ok(_) -> true
case _ -> false
}
}
}
type pub async Testing {
let @values: Array[uni Thing]
}
trait ToFoo {
fn to_foo -> String
fn to_bla(arg: Int) -> Int {
arg * 2
}
}
impl Thing for AnotherThing {
}
impl Thing {
}
fn pub inline example {}
type pub inline InlineType {
fn pub inline foo {}
fn pub inline mut bar {}
fn pub inline move baz {}
}
type pub inline enum InlineEnum {}
type pub copy enum CopyEnum {}
type pub copy CopyType {}
type async Main {
fn async main {
10.2
10.2e5
100
100_000
0xdeadbeef
"double quoted string"
"string with \u{fff} escape sequences \n\r\t"
"string with {10 + 5} interpolation"
"string with a #comment in it"
'single qouted string'
"string that spans
multiple
lines"
10 / 20
10.5 + 1.2
1 << 3
# A comment
identifier
@field_reference
method()
self
self.foo(10, 20)
self.bar(number: 20, bla, 30)
Stdout.new.print('hello')
(10, 20)
[10, 20, 30]
{
# ...
}
return 42
throw 42
try foo
# A closure
fn (number) -> Int { return number * 2 }
fn (a: Int) -> Int { a * a }
}
}