on master help sign in
Add a protobuf syntax sample.
commit2e985198c6e25456332d1f037c59b3bb3755e3ac authorDaniil Baturin <daniil@baturin.org> dateMon 5 Oct 2020, 01:29 (6 years ago) parent74a2ef8
2 files changed+316
tests/syntax-tests/highlighted/Protocol Buffer/vyconf.proto+158 tests/syntax-tests/source/Protocol Buffer/vyconf.proto+158
tests/syntax-tests/highlighted/Protocol Buffer/vyconf.protonew file+158
@@ -0,0 +1,158 @@
1+message Request {
2+ enum ConfigFormat {
3+ CURLY = 0;
4+ JSON = 1;
5+ }
6+
7+ enum OutputFormat {
8+ OutPlain = 0;
9+ OutJSON = 1;
10+ }
11+
12+ message Status {
13+ }
14+
15+ message SetupSession {
16+ optional string ClientApplication = 1;
17+ optional int32 OnBehalfOf = 2;
18+ }
19+
20+ message Set {
21+ repeated string Path = 1;
22+ optional bool Ephemeral = 3; 
23+ }
24+
25+ message Delete {
26+ repeated string Path = 1;
27+ }
28+
29+ message Rename {
30+ repeated string EditLevel = 1;
31+ required string From = 2;
32+ required string To = 3;
33+ }
34+
35+ message Copy {
36+ repeated string EditLevel = 1;
37+ required string From = 2;
38+ required string To = 3;
39+ }
40+
41+ message Comment {
42+ repeated string Path = 1;
43+ required string Comment = 2;
44+ }
45+
46+ message Commit {
47+ optional bool Confirm = 1;
48+ optional int32 ConfirmTimeout = 2;
49+ optional string Comment = 3;
50+ }
51+
52+ message Rollback {
53+ required int32 Revision = 1;
54+ }
55+
56+ message Load {
57+ required string Location = 1;
58+ optional ConfigFormat format = 2;
59+ }
60+
61+ message Merge {
62+ required string Location = 1;
63+ optional ConfigFormat format = 2;
64+ }
65+
66+ message Save {
67+ required string Location = 1;
68+ optional ConfigFormat format = 2;
69+ }
70+
71+ message ShowConfig {
72+ repeated string Path = 1;
73+ optional ConfigFormat format = 2;
74+ }
75+
76+ message Exists {
77+ repeated string Path = 1;
78+ }
79+
80+ message GetValue {
81+ repeated string Path = 1;
82+ optional OutputFormat output_format = 2;
83+ }
84+
85+ message GetValues {
86+ repeated string Path = 1;
87+ optional OutputFormat output_format = 2;
88+ }
89+
90+ message ListChildren {
91+ repeated string Path = 1;
92+ optional OutputFormat output_format = 2;
93+ }
94+
95+ message RunOpMode {
96+ repeated string Path = 1;
97+ optional OutputFormat output_format = 2;
98+ }
99+
100+ message Confirm {
101+ }
102+
103+ message EnterConfigurationMode {
104+ required bool Exclusive = 1;
105+ required bool OverrideExclusive = 2;
106+ }
107+
108+ message ExitConfigurationMode {
109+ }
110+
111+ oneof msg {
112+ Status status = 1;
113+ SetupSession setup_session = 2;
114+ Set set = 3;
115+ Delete delete = 4;
116+ Rename rename = 5;
117+ Copy copy = 6;
118+ Comment comment = 7;
119+ Commit commit = 8;
120+ Rollback rollback = 9;
121+ Merge merge = 10;
122+ Save save = 11;
123+ ShowConfig show_config = 12;
124+ Exists exists = 13;
125+ GetValue get_value = 14;
126+ GetValues get_values = 15;
127+ ListChildren list_children = 16;
128+ RunOpMode run_op_mode = 17;
129+ Confirm confirm = 18;
130+ EnterConfigurationMode configure = 19;
131+ ExitConfigurationMode exit_configure = 20;
132+ string teardown = 21;
133+ } 
134+}
135+
136+message RequestEnvelope {
137+ optional string token = 1;
138+ required Request request = 2;
139+}
140+
141+enum Status {
142+ SUCCESS = 0;
143+ FAIL = 1;
144+ INVALID_PATH = 2;
145+ INVALID_VALUE = 3;
146+ COMMIT_IN_PROGRESS = 4;
147+ CONFIGURATION_LOCKED = 5;
148+ INTERNAL_ERROR = 6;
149+ PERMISSION_DENIED = 7;
150+ PATH_ALREADY_EXISTS = 8;
151+}
152+
153+message Response {
154+ required Status status = 1;
155+ optional string output = 2;
156+ optional string error = 3;
157+ optional string warning = 4;
158+}
tests/syntax-tests/source/Protocol Buffer/vyconf.protonew file+158
@@ -0,0 +1,158 @@
1+message Request {
2+ enum ConfigFormat {
3+ CURLY = 0;
4+ JSON = 1;
5+ }
6+
7+ enum OutputFormat {
8+ OutPlain = 0;
9+ OutJSON = 1;
10+ }
11+
12+ message Status {
13+ }
14+
15+ message SetupSession {
16+ optional string ClientApplication = 1;
17+ optional int32 OnBehalfOf = 2;
18+ }
19+
20+ message Set {
21+ repeated string Path = 1;
22+ optional bool Ephemeral = 3;
23+ }
24+
25+ message Delete {
26+ repeated string Path = 1;
27+ }
28+
29+ message Rename {
30+ repeated string EditLevel = 1;
31+ required string From = 2;
32+ required string To = 3;
33+ }
34+
35+ message Copy {
36+ repeated string EditLevel = 1;
37+ required string From = 2;
38+ required string To = 3;
39+ }
40+
41+ message Comment {
42+ repeated string Path = 1;
43+ required string Comment = 2;
44+ }
45+
46+ message Commit {
47+ optional bool Confirm = 1;
48+ optional int32 ConfirmTimeout = 2;
49+ optional string Comment = 3;
50+ }
51+
52+ message Rollback {
53+ required int32 Revision = 1;
54+ }
55+
56+ message Load {
57+ required string Location = 1;
58+ optional ConfigFormat format = 2;
59+ }
60+
61+ message Merge {
62+ required string Location = 1;
63+ optional ConfigFormat format = 2;
64+ }
65+
66+ message Save {
67+ required string Location = 1;
68+ optional ConfigFormat format = 2;
69+ }
70+
71+ message ShowConfig {
72+ repeated string Path = 1;
73+ optional ConfigFormat format = 2;
74+ }
75+
76+ message Exists {
77+ repeated string Path = 1;
78+ }
79+
80+ message GetValue {
81+ repeated string Path = 1;
82+ optional OutputFormat output_format = 2;
83+ }
84+
85+ message GetValues {
86+ repeated string Path = 1;
87+ optional OutputFormat output_format = 2;
88+ }
89+
90+ message ListChildren {
91+ repeated string Path = 1;
92+ optional OutputFormat output_format = 2;
93+ }
94+
95+ message RunOpMode {
96+ repeated string Path = 1;
97+ optional OutputFormat output_format = 2;
98+ }
99+
100+ message Confirm {
101+ }
102+
103+ message EnterConfigurationMode {
104+ required bool Exclusive = 1;
105+ required bool OverrideExclusive = 2;
106+ }
107+
108+ message ExitConfigurationMode {
109+ }
110+
111+ oneof msg {
112+ Status status = 1;
113+ SetupSession setup_session = 2;
114+ Set set = 3;
115+ Delete delete = 4;
116+ Rename rename = 5;
117+ Copy copy = 6;
118+ Comment comment = 7;
119+ Commit commit = 8;
120+ Rollback rollback = 9;
121+ Merge merge = 10;
122+ Save save = 11;
123+ ShowConfig show_config = 12;
124+ Exists exists = 13;
125+ GetValue get_value = 14;
126+ GetValues get_values = 15;
127+ ListChildren list_children = 16;
128+ RunOpMode run_op_mode = 17;
129+ Confirm confirm = 18;
130+ EnterConfigurationMode configure = 19;
131+ ExitConfigurationMode exit_configure = 20;
132+ string teardown = 21;
133+ }
134+}
135+
136+message RequestEnvelope {
137+ optional string token = 1;
138+ required Request request = 2;
139+}
140+
141+enum Status {
142+ SUCCESS = 0;
143+ FAIL = 1;
144+ INVALID_PATH = 2;
145+ INVALID_VALUE = 3;
146+ COMMIT_IN_PROGRESS = 4;
147+ CONFIGURATION_LOCKED = 5;
148+ INTERNAL_ERROR = 6;
149+ PERMISSION_DENIED = 7;
150+ PATH_ALREADY_EXISTS = 8;
151+}
152+
153+message Response {
154+ required Status status = 1;
155+ optional string output = 2;
156+ optional string error = 3;
157+ optional string warning = 4;
158+}