-
Notifications
You must be signed in to change notification settings - Fork 28
/
foo.nrm
120 lines (102 loc) · 2.3 KB
/
foo.nrm
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import fixture.foo.bar (path-unbox, point, int-unbox);
import fixture.qux (path, name);
unboxed float-unbox (float64);
# Unboxed type docs.
unboxed imported-type-unbox (path-unbox);
unboxed way (path);
type irum = name;
# Type alias docs.
enum gender
# Enum docs.
= female/yeoseong
| male
;
enum eva-char = soryu-asuka-langley
| ayanami-rei
| ikari-shinji
| katsuragi-misato
| nagisa-kaworu
;
enum reserved-keyword-enum = mro | no-mro;
union reserved-keyword-union = mro | no-mro;
record point1 (
# Record docs.
bigint left/x,
# Record field docs.
bigint top,
);
record point2 (
int-unbox left,
# Record field docs.
int-unbox top,
);
record point3d (
point xy,
int64 z,
);
record line (
bigint length,
);
record import-typing (
// see also: https://github.com/spoqa/nirum/issues/93
bigint? an-optional-field,
);
union mixed-name = western-name ( text first-name
, text middle-name
, text last-name
)
| east-asian-name ( text family-name
, text given-name
)
| culture-agnostic-name (text fullname)
;
union music
# Union docs.
= pop ( text country
# Tag field docs.
)
# Tag docs.
| rnb/rhythm-and-ballad (text country)
;
union status = run
| stop
;
record song (
text name,
);
record album (
text name,
[song] tracks,
);
service null-service ();
@error
union rpc-error = connection-lose-error
| not-found-error (text message,)
;
service ping-service (
# Service docs.
@http-resource(method="GET", path="/ping")
@quote(single="'", triple="'''")
@unicode(unicode="유니코드")
bool ping (
# Method docs.
text nonce,
# Parameter docs.
) throws rpc-error,
);
record person (
irum first-name,
irum last-name,
);
record people (
{person} people
);
record product (
text name,
int64? price,
bool sale,
uri? url,
);
union animal = cat
| dog (text name, text? kind, int64 age, int64? weight)
;