-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSYNTAX.txt
71 lines (55 loc) · 1.59 KB
/
SYNTAX.txt
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
// Simple example
// define types
// OneofTypeName [...]
// MapTypeName {...}
PhoneType [
// enumerate Numbers, Strings, null
'MOBILE', // === 0
'WORK', // === 1
'HOME' // === 2
'NONE', // === 3
123, // simple number
0.123, // fract number
0x1234AF, // hex number
0b101001, // binary number
0o7245 // octo number
null,
true,
false
]
Book {
Uint id;
Utf8 title;
}
Pen {
Uint id;
Utf8 color;
}
Item [
// enumerate Few types and string. Each type should have minimum one unique property name
'EMPTY',
Book,
Pen
]
// define some object types
Phone {
// after "=" specify default value for optional property
// all Unknown ID names gets from compile options. For example DEFAULT_PHONE_TYPE
PhoneType type = DEFAULT_PHONE_TYPE;
Utf8[12] number; // 0-12 chars. required property
}
User {
Utf8 name; // unlimited chars ; required property
Utf8[2,20] surname = null; // 2-20 chars. optional property. require min 2 chars if set
Utf8[10,] address; // 10-unlimited chars. 10 chars min required
Phone phones[]; // unlimited list. required property
Phone phones2[2,] // 2-unlimited items. 2 Phone values required. required property
Phone phones3[1,5] = [ // 1-5 items. 1 Phone value required. optional property with default list
{
type: 'MOBILE',
number: '+23234234243'
}
]
Item items[];
Bin[1024] photo = DEFAULT_PHOTO; // optional property. 0-1024 bytes. DEFAULT_PHOTO takes from compile options
}