forked from eleme/thrift-parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
format.txt
53 lines (24 loc) · 1.47 KB
/
format.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
<Thrift> := <Space>* <Subject>*
<Space> := 0x10 | 0x13 | 0x20 | <Comment>
<Comment> "/*" ... "*/" | "#" ... "\r\n"
<Name> := \w+
<Type> := <Name> | <Name> "<" <Type> ">" | <Name> "<" <Type> "," </Type> ">"
<Value> := JSON
<Id> := \d+
<Subject> := <Const> | <Typedef> | <Enum> | <Struct> | <Exception> | <Service>
<Const> := "const" <Space>* <Type> <Space>* <Name> <Space>* "=" <Space>* <Value> <Space>*
<Typedef> := "typedef" <Space>* <Type> <Space>* <Name> <Space>*
<Enum> := "enum" <Space>* <Name> <Space>* <Enum-Block> <Space>*
<Struct> := "struct" <Space>* <Name> <Space>* <Struct-Block> <Space>*
<Exception> := "exception" <Space>* <Name> <Space>* <Exception-Block> <Space>*
<Service> := "service" <Space>* <Name> <Space>* <Service-Block> <Space>*
<Enum-Block> := "{" <Space>* <Enum-Item>* "}"
<Enum-Item> := <Name> <Space>* "=" <Space>* <Value> <Space>* "," <Space>*
<Struct-Block> := "{" <Space>* <Struct-Item>* "}"
<Struct-Item> := <Id> <Space>* ":" <Space>* <Struct-Option> <Space>* <Type> <Space>* <Name> <Space>* "," <Space>*
<Struct-Option> := "required" | "optional"
<Exception-Block> := "{" <Space>* <Struct-Item>* "}"
<Service-Block> := "{" <Space>* <Service-Item>* "}"
<Service-Item> := <Type> <Space>* <Name> <Space>* "(" <Space>* <Service-Args>* ")" <Space>* <Service-Throw> <Space>* "," <Space>*
<Service-Arg> := <Id> <Space>* ":" <Space>* <Type> <Space>* <Name> <Space>* "," <Space>*
<Service-Throw> := "throws" <Space>* "(" <Space>* <Service-Args>* ")"