blob: c5dcf26a8d84ceb8b7b1c437dcba0b40993fca51 [file] [log] [blame]
Vidyashree Ramada621502016-02-05 22:32:34 +05301/*
2 * Copyright 2016 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * This is a YANG grammar for parser based on which ANTLR will generate YANG parser.
19 */
20
21grammar GeneratedYang;
22import YangLexer;
23
24@header {
25package org.onosproject.yangutils.parser.antlrgencode;
26}
27
28 yangfile : module_stmt
29 | submodule_stmt;
30
31 /**
32 * module-stmt = optsep module-keyword sep identifier-arg-str
33 * optsep
34 * "{" stmtsep
35 * module-header-stmts
36 * linkage-stmts
37 * meta-stmts
38 * revision-stmts
39 * body-stmts
40 * "}" optsep
41 */
42
43 module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
44
45 module_body : module_header_statement linkage_stmts meta_stmts revision_stmts body_stmts;
46
47 /**
48 * module-header-stmts = ;; these stmts can appear in any order
49 * [yang-version-stmt stmtsep]
50 * namespace-stmt stmtsep
51 * prefix-stmt stmtsep
52 */
53
54 module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
55 | yang_version_stmt? prefix_stmt namespace_stmt
56 | namespace_stmt yang_version_stmt? prefix_stmt
57 | namespace_stmt prefix_stmt yang_version_stmt?
58 | prefix_stmt namespace_stmt yang_version_stmt?
59 | prefix_stmt yang_version_stmt? namespace_stmt?
60 ;
61
62 /**
63 * linkage-stmts = ;; these stmts can appear in any order
64 * *(import-stmt stmtsep)
65 * *(include-stmt stmtsep)
66 */
67
68 linkage_stmts : (import_stmt
69 | include_stmt)*;
70
71 /**
72 * meta-stmts = ;; these stmts can appear in any order
73 * [organization-stmt stmtsep]
74 * [contact-stmt stmtsep]
75 * [description-stmt stmtsep]
76 * [reference-stmt stmtsep]
77 */
78
79 meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt?
80 | organization_stmt? contact_stmt? reference_stmt? description_stmt?
81 | organization_stmt? description_stmt? contact_stmt? reference_stmt?
82 | organization_stmt? description_stmt? reference_stmt? contact_stmt?
83 | organization_stmt? reference_stmt? contact_stmt? description_stmt?
84 | organization_stmt? reference_stmt? description_stmt? contact_stmt?
85 | contact_stmt? organization_stmt? description_stmt? reference_stmt?
86 | contact_stmt? organization_stmt? reference_stmt? description_stmt?
87 | contact_stmt? reference_stmt? organization_stmt? description_stmt?
88 | contact_stmt? reference_stmt? description_stmt? organization_stmt?
89 | contact_stmt? description_stmt? reference_stmt? organization_stmt?
90 | contact_stmt? description_stmt? organization_stmt? reference_stmt?
91 | reference_stmt? contact_stmt? organization_stmt? description_stmt?
92 | reference_stmt? contact_stmt? description_stmt? organization_stmt?
93 | reference_stmt? organization_stmt? contact_stmt? description_stmt?
94 | reference_stmt? organization_stmt? description_stmt? contact_stmt?
95 | reference_stmt? description_stmt? organization_stmt? contact_stmt?
96 | reference_stmt? description_stmt? contact_stmt? organization_stmt?
97 | description_stmt? reference_stmt? contact_stmt? organization_stmt?
98 | description_stmt? reference_stmt? organization_stmt? contact_stmt?
99 | description_stmt? contact_stmt? reference_stmt? organization_stmt?
100 | description_stmt? contact_stmt? organization_stmt? reference_stmt?
101 | description_stmt? organization_stmt? contact_stmt? reference_stmt?
102 | description_stmt? organization_stmt? reference_stmt? contact_stmt?
103 ;
104
105 // revision-stmts = *(revision-stmt stmtsep)
106 revision_stmts : revision_stmt*;
107
108 /**
109 * body-stmts = *((extension-stmt /
110 * feature-stmt /
111 * identity-stmt /
112 * typedef-stmt /
113 * grouping-stmt /
114 * data-def-stmt /
115 * augment-stmt /
116 * rpc-stmt /
117 * notification-stmt /
118 * deviation-stmt) stmtsep)
119 */
120
121 body_stmts : (extension_stmt
122 | feature_stmt
123 | identity_stmt
124 | typedef_stmt
125 | grouping_stmt
126 | data_def_stmt
127 | augment_stmt
128 | rpc_stmt
129 | notification_stmt
130 | deviation_stmt)*
131 ;
132
133 /**
134 * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
135 * optsep stmtend
136 */
137
138 yang_version_stmt : YANG_VERSION_KEYWORD INTEGER STMTEND;
139
140
141 /**
142 * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
143 * For namespace validation TODO in Listener
144 */
145 namespace_stmt : NAMESPACE_KEYWORD string STMTEND;
146
147 /**
148 * prefix-stmt = prefix-keyword sep prefix-arg-str
149 * optsep stmtend
150 */
151 prefix_stmt : PREFIX_KEYWORD IDENTIFIER STMTEND;
152
153 /**
154 * import-stmt = import-keyword sep identifier-arg-str optsep
155 * "{" stmtsep
156 * prefix-stmt stmtsep
157 * [revision-date-stmt stmtsep]
158 * "}"
159 */
160 import_stmt : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE import_stmt_body RIGHT_CURLY_BRACE;
161
162 import_stmt_body : prefix_stmt revision_date_stmt?;
163
164 // revision-date-stmt = revision-date-keyword sep revision-date stmtend
165 revision_date_stmt : REVISION_DATE_KEYWORD DATE_ARG STMTEND;
166
167 revision_date_stmt_body : revision_date_stmt;
168
169 /**
170 * include-stmt = include-keyword sep identifier-arg-str optsep
171 * (";" /
172 * "{" stmtsep
173 * [revision-date-stmt stmtsep]
174 * "}")
175 */
176 include_stmt : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE revision_date_stmt_body? RIGHT_CURLY_BRACE);
177
178 /**
179 * organization-stmt = organization-keyword sep string
180 * optsep stmtend
181 */
182 organization_stmt : ORGANIZATION_KEYWORD string STMTEND;
183
184 // contact-stmt = contact-keyword sep string optsep stmtend
185 contact_stmt : CONTACT_KEYWORD string STMTEND;
186
187 // description-stmt = description-keyword sep string optsep stmtend
188 description_stmt : DESCRIPTION_KEYWORD string STMTEND;
189
190 // reference-stmt = reference-keyword sep string optsep stmtend
191 reference_stmt : REFERENCE_KEYWORD string STMTEND;
192
193 /**
194 * revision-stmt = revision-keyword sep revision-date optsep
195 * (";" /
196 * "{" stmtsep
197 * [description-stmt stmtsep]
198 * [reference-stmt stmtsep]
199 * "}")
200 */
201 revision_stmt : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revision_stmt_body RIGHT_CURLY_BRACE);
202 revision_stmt_body : description_stmt? reference_stmt?;
203
204 /**
205 * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
206 * optsep
207 * "{" stmtsep
208 * submodule-header-stmts
209 * linkage-stmts
210 * meta-stmts
211 * revision-stmts
212 * body-stmts
213 * "}" optsep
214 */
215 submodule_stmt : SUBMODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE submodule_body* RIGHT_CURLY_BRACE;
216 submodule_body : submodule_header_statement linkage_stmts meta_stmts revision_stmts body_stmts;
217
218 /** submodule-header-stmts =
219 * ;; these stmts can appear in any order
220 * [yang-version-stmt stmtsep]
221 * belongs-to-stmt stmtsep
222 */
223 submodule_header_statement : yang_version_stmt? belongs_to_stmt
224 | belongs_to_stmt yang_version_stmt?
225 ;
226
227 /**
228 * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
229 * optsep
230 * "{" stmtsep
231 * prefix-stmt stmtsep
232 * "}"
233 */
234 belongs_to_stmt : BELONGS_TO_KEYWORD IDENTIFIER LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
235 belongs_to_stmt_body : prefix_stmt;
236
237 /**
238 * extension-stmt = extension-keyword sep identifier-arg-str optsep
239 * (";" /
240 * "{" stmtsep
241 * ;; these stmts can appear in any order
242 * [argument-stmt stmtsep]
243 * [status-stmt stmtsep]
244 * [description-stmt stmtsep]
245 * [reference-stmt stmtsep]
246 * "}")
247 */
248 extension_stmt : EXTENSION_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE extension_body RIGHT_CURLY_BRACE);
249 extension_body : argument_stmt? status_stmt? description_stmt? reference_stmt?
250 | argument_stmt? status_stmt? reference_stmt? description_stmt?
251 | argument_stmt? description_stmt? status_stmt? reference_stmt?
252 | argument_stmt? description_stmt? reference_stmt? status_stmt?
253 | argument_stmt? reference_stmt? description_stmt? status_stmt?
254 | argument_stmt? reference_stmt? status_stmt? description_stmt?
255 | status_stmt? reference_stmt? argument_stmt? description_stmt?
256 | status_stmt? reference_stmt? description_stmt? argument_stmt?
257 | status_stmt? description_stmt? reference_stmt? argument_stmt?
258 | status_stmt? description_stmt? argument_stmt? reference_stmt?
259 | status_stmt? argument_stmt? reference_stmt? description_stmt?
260 | status_stmt? argument_stmt? description_stmt? reference_stmt?
261 | description_stmt? argument_stmt? status_stmt? reference_stmt?
262 | description_stmt? argument_stmt? reference_stmt? status_stmt?
263 | description_stmt? status_stmt? argument_stmt? reference_stmt?
264 | description_stmt? status_stmt? reference_stmt? argument_stmt?
265 | description_stmt? reference_stmt? status_stmt? argument_stmt?
266 | description_stmt? reference_stmt? argument_stmt? status_stmt?
267 | reference_stmt? description_stmt? argument_stmt? status_stmt?
268 | reference_stmt? description_stmt? status_stmt? argument_stmt?
269 | reference_stmt? status_stmt? argument_stmt? description_stmt?
270 | reference_stmt? status_stmt? description_stmt? argument_stmt?
271 | reference_stmt? argument_stmt? description_stmt? status_stmt?
272 | reference_stmt? argument_stmt? status_stmt? description_stmt?
273 ;
274
275 /**
276 * argument-stmt = argument-keyword sep identifier-arg-str optsep
277 * (";" /
278 * "{" stmtsep
279 * [yin-element-stmt stmtsep]
280 * "}")
281 */
282 argument_stmt : ARGUMENT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE argument_body RIGHT_CURLY_BRACE);
283 argument_body : yin_element_stmt?;
284
285 /**
286 * yin-element-stmt = yin-element-keyword sep yin-element-arg-str
287 * stmtend
288 */
289 yin_element_stmt : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
290
291 /**
292 * identity-stmt = identity-keyword sep identifier-arg-str optsep
293 * (";" /
294 * "{" stmtsep
295 * ;; these stmts can appear in any order
296 * [base-stmt stmtsep]
297 * [status-stmt stmtsep]
298 * [description-stmt stmtsep]
299 * [reference-stmt stmtsep]
300 * "}")
301 */
302 identity_stmt : IDENTITY_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE identity_body RIGHT_CURLY_BRACE);
303 identity_body : base_stmt? status_stmt? description_stmt? reference_stmt?
304 | base_stmt? status_stmt? reference_stmt? description_stmt?
305 | base_stmt? description_stmt? status_stmt? reference_stmt?
306 | base_stmt? description_stmt? reference_stmt? status_stmt?
307 | base_stmt? reference_stmt? description_stmt? status_stmt?
308 | base_stmt? reference_stmt? status_stmt? description_stmt?
309 | reference_stmt? base_stmt? status_stmt? description_stmt?
310 | reference_stmt? base_stmt? description_stmt? status_stmt?
311 | reference_stmt? status_stmt? base_stmt? description_stmt?
312 | reference_stmt? status_stmt? description_stmt? base_stmt?
313 | reference_stmt? description_stmt? status_stmt? base_stmt?
314 | reference_stmt? description_stmt? base_stmt? status_stmt?
315 | description_stmt? reference_stmt? status_stmt? base_stmt?
316 | description_stmt? reference_stmt? status_stmt? base_stmt?
317 | description_stmt? reference_stmt? base_stmt? status_stmt?
318 | description_stmt? status_stmt? base_stmt? reference_stmt?
319 | description_stmt? status_stmt? reference_stmt? base_stmt?
320 | description_stmt? base_stmt? reference_stmt? status_stmt?
321 | description_stmt? base_stmt? status_stmt? reference_stmt?
322 | status_stmt? base_stmt? description_stmt? reference_stmt?
323 | status_stmt? base_stmt? reference_stmt? description_stmt?
324 | status_stmt? description_stmt? base_stmt? reference_stmt?
325 | status_stmt? description_stmt? reference_stmt? base_stmt?
326 | status_stmt? reference_stmt? description_stmt? base_stmt?
327 | status_stmt? reference_stmt? base_stmt? description_stmt?
328 ;
329
330 /**
331 * base-stmt = base-keyword sep identifier-ref-arg-str
332 * optsep stmtend*
333 * identifier-ref-arg = [prefix ":"] identifier
334 */
335 base_stmt : BASE_KEYWORD string STMTEND;
336
337 /**
338 * feature-stmt = feature-keyword sep identifier-arg-str optsep
339 * (";" /
340 * "{" stmtsep
341 * ;; these stmts can appear in any order
342 * *(if-feature-stmt stmtsep)
343 * [status-stmt stmtsep]
344 * [description-stmt stmtsep]
345 * [reference-stmt stmtsep]
346 * "}")
347 */
348 feature_stmt : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE feature_body RIGHT_CURLY_BRACE);
349 feature_body : if_feature_stmt* status_stmt? description_stmt? reference_stmt?
350 | if_feature_stmt* status_stmt? reference_stmt? description_stmt?
351 | if_feature_stmt* description_stmt? status_stmt? reference_stmt?
352 | if_feature_stmt* description_stmt? reference_stmt? status_stmt?
353 | if_feature_stmt* reference_stmt? status_stmt? description_stmt?
354 | if_feature_stmt* reference_stmt? description_stmt? status_stmt?
355 | status_stmt? if_feature_stmt* description_stmt? reference_stmt?
356 | status_stmt? if_feature_stmt* reference_stmt? description_stmt?
357 | status_stmt? description_stmt? if_feature_stmt* reference_stmt?
358 | status_stmt? description_stmt? reference_stmt? if_feature_stmt*
359 | status_stmt? reference_stmt? if_feature_stmt* description_stmt?
360 | status_stmt? reference_stmt? description_stmt? if_feature_stmt*
361 | description_stmt? if_feature_stmt* status_stmt? reference_stmt?
362 | description_stmt? if_feature_stmt* reference_stmt? status_stmt?
363 | description_stmt? status_stmt? if_feature_stmt* reference_stmt?
364 | description_stmt? status_stmt? reference_stmt? if_feature_stmt*
365 | description_stmt? reference_stmt* status_stmt? if_feature_stmt*
366 | description_stmt? reference_stmt* if_feature_stmt? status_stmt?
367 | reference_stmt? if_feature_stmt* status_stmt? description_stmt?
368 | reference_stmt? if_feature_stmt* description_stmt? status_stmt?
369 | reference_stmt? description_stmt? status_stmt? if_feature_stmt*
370 | reference_stmt? description_stmt? if_feature_stmt* status_stmt?
371 | reference_stmt? status_stmt? description_stmt? if_feature_stmt*
372 | reference_stmt? status_stmt? if_feature_stmt* description_stmt?
373 ;
374
375 /**
376 * data-def-stmt = container-stmt /
377 * leaf-stmt /
378 * leaf-list-stmt /
379 * list-stmt /
380 * choice-stmt /
381 * anyxml-stmt /
382 * uses-stmt
383 */
384 data_def_stmt : container_stmt
385 | leaf_stmt
386 | leaf_list_stmt
387 | list_stmt
388 | choice_stmt
389 | uses_stmt;
390
391 /**
392 * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
393 * optsep stmtend
394 */
395 if_feature_stmt : IF_FEATURE_KEYWORD string STMTEND;
396
397 /**
398 * units-stmt = units-keyword sep string optsep stmtend
399 */
400 units_stmt : UNITS_KEYWORD string STMTEND;
401
402 /**
403 * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
404 * "{" stmtsep
405 * ;; these stmts can appear in any order
406 * type-stmt stmtsep
407 * [units-stmt stmtsep]
408 * [default-stmt stmtsep]
409 * [status-stmt stmtsep]
410 * [description-stmt stmtsep]
411 * [reference-stmt stmtsep]
412 * "}"
413 * TODO : 0..1 occurance to be validated in listener
414 */
415 typedef_stmt : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
416 (type_stmt | units_stmt | default_stmt | status_stmt | description_stmt | reference_stmt)*
417 RIGHT_CURLY_BRACE;
418
419 /**
420 * type-stmt = type-keyword sep identifier-ref-arg-str optsep
421 * (";" /
422 * "{" stmtsep
423 * type-body-stmts
424 * "}")
425 */
426 type_stmt : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE type_body_stmts RIGHT_CURLY_BRACE);
427
428 /**
429 * type-body-stmts = numerical-restrictions /
430 * decimal64-specification /
431 * string-restrictions /
432 * enum-specification /
433 * leafref-specification /
434 * identityref-specification /
435 * instance-identifier-specification /
436 * bits-specification /
437 * union-specification
438 * TODO : decimal64-specification to be added
439 */
440 type_body_stmts : numerical_restrictions | string_restrictions | enum_specification
441 | leafref_specification | identityref_specification | instance_identifier_specification
442 | bits_specification | union_specification;
443
444 /**
445 * numerical-restrictions = range-stmt stmtsep
446 */
447 numerical_restrictions : range_stmt;
448
449 /**
450 * range-stmt = range-keyword sep range-arg-str optsep
451 * (";" /
452 * "{" stmtsep
453 * ;; these stmts can appear in any order
454 * [error-message-stmt stmtsep]
455 * [error-app-tag-stmt stmtsep]
456 * [description-stmt stmtsep]
457 * [reference-stmt stmtsep]
458 * "}")
459 */
460 range_stmt : RANGE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE common_stmts RIGHT_CURLY_BRACE);
461
462 common_stmts : error_message_stmt? error_app_tag_stmt? description_stmt? reference_stmt?
463 | error_message_stmt? error_app_tag_stmt? reference_stmt? description_stmt?
464 | error_message_stmt? description_stmt? error_app_tag_stmt? reference_stmt?
465 | error_message_stmt? description_stmt? reference_stmt? error_app_tag_stmt?
466 | error_message_stmt? reference_stmt? error_app_tag_stmt? description_stmt?
467 | error_message_stmt? reference_stmt? description_stmt? error_app_tag_stmt?
468 | error_app_tag_stmt? error_message_stmt? description_stmt? reference_stmt?
469 | error_app_tag_stmt? error_message_stmt? reference_stmt? description_stmt?
470 | error_app_tag_stmt? description_stmt? description_stmt? error_message_stmt?
471 | error_app_tag_stmt? description_stmt? error_message_stmt? description_stmt?
472 | error_app_tag_stmt? reference_stmt? error_message_stmt? description_stmt?
473 | error_app_tag_stmt? reference_stmt? description_stmt? error_message_stmt?
474 | description_stmt? error_message_stmt? error_app_tag_stmt? reference_stmt?
475 | description_stmt? error_message_stmt? reference_stmt? error_app_tag_stmt?
476 | description_stmt? error_app_tag_stmt? error_message_stmt? reference_stmt?
477 | description_stmt? error_app_tag_stmt? reference_stmt? error_message_stmt?
478 | description_stmt? reference_stmt? error_message_stmt? error_app_tag_stmt?
479 | description_stmt? reference_stmt? error_app_tag_stmt? error_message_stmt?
480 | reference_stmt? error_message_stmt? description_stmt? error_app_tag_stmt?
481 | reference_stmt? error_message_stmt? error_app_tag_stmt? description_stmt?
482 | reference_stmt? error_app_tag_stmt? description_stmt? error_message_stmt?
483 | reference_stmt? error_app_tag_stmt? error_message_stmt? description_stmt?
484 | reference_stmt? description_stmt? error_message_stmt? error_app_tag_stmt?
485 | reference_stmt? description_stmt? error_app_tag_stmt? error_message_stmt?
486 ;
487
488 /**
489 * string-restrictions = ;; these stmts can appear in any order
490 * [length-stmt stmtsep]
491 * *(pattern-stmt stmtsep)
492 */
493 string_restrictions : ((length_stmt)? (pattern_stmt)*) | ((pattern_stmt)* (length_stmt)?);
494
495 /**
496 * length-stmt = length-keyword sep length-arg-str optsep
497 * (";" /
498 * "{" stmtsep
499 * ;; these stmts can appear in any order
500 * [error-message-stmt stmtsep]
501 * [error-app-tag-stmt stmtsep]
502 * [description-stmt stmtsep]
503 * [reference-stmt stmtsep]
504 * "}")
505 */
506 length_stmt : LENGTH_KEYWORD string
507 (STMTEND | LEFT_CURLY_BRACE common_stmts RIGHT_CURLY_BRACE);
508
509 /**
510 * pattern-stmt = pattern-keyword sep string optsep
511 * (";" /
512 * "{" stmtsep
513 * ;; these stmts can appear in any order
514 * [error-message-stmt stmtsep]
515 * [error-app-tag-stmt stmtsep]
516 * [description-stmt stmtsep]
517 * [reference-stmt stmtsep]
518 * "}")
519 */
520 pattern_stmt : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE common_stmts RIGHT_CURLY_BRACE);
521
522 /**
523 * default-stmt = default-keyword sep string stmtend
524 */
525 default_stmt : DEFAULT_KEYWORD string STMTEND;
526
527 /**
528 * enum-specification = 1*(enum-stmt stmtsep)
529 */
530 enum_specification : enum_stmt+;
531
532 /**
533 * enum-stmt = enum-keyword sep string optsep
534 * (";" /
535 * "{" stmtsep
536 * ;; these stmts can appear in any order
537 * [value-stmt stmtsep]
538 * [status-stmt stmtsep]
539 * [description-stmt stmtsep]
540 * [reference-stmt stmtsep]
541 * "}")
542 */
543 enum_stmt : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enum_stmt_body RIGHT_CURLY_BRACE);
544
545 enum_stmt_body : value_stmt? status_stmt? description_stmt? reference_stmt?
546 | value_stmt? status_stmt? reference_stmt? description_stmt?
547 | value_stmt? description_stmt? status_stmt? reference_stmt?
548 | value_stmt? description_stmt? reference_stmt? status_stmt?
549 | value_stmt? reference_stmt? status_stmt? description_stmt?
550 | value_stmt? reference_stmt? description_stmt? status_stmt?
551 | status_stmt? value_stmt? description_stmt? reference_stmt?
552 | status_stmt? value_stmt? reference_stmt? description_stmt?
553 | status_stmt? description_stmt? description_stmt? value_stmt?
554 | status_stmt? description_stmt? value_stmt? description_stmt?
555 | status_stmt? reference_stmt? value_stmt? description_stmt?
556 | status_stmt? reference_stmt? description_stmt? value_stmt?
557 | description_stmt? value_stmt? status_stmt? reference_stmt?
558 | description_stmt? value_stmt? reference_stmt? status_stmt?
559 | description_stmt? status_stmt? value_stmt? reference_stmt?
560 | description_stmt? status_stmt? reference_stmt? value_stmt?
561 | description_stmt? reference_stmt? value_stmt? status_stmt?
562 | description_stmt? reference_stmt? status_stmt? value_stmt?
563 | reference_stmt? value_stmt? description_stmt? status_stmt?
564 | reference_stmt? value_stmt? status_stmt? description_stmt?
565 | reference_stmt? status_stmt? description_stmt? value_stmt?
566 | reference_stmt? status_stmt? value_stmt? description_stmt?
567 | reference_stmt? description_stmt? value_stmt? status_stmt?
568 | reference_stmt? description_stmt? status_stmt? value_stmt?
569 ;
570
571 /**
572 * leafref-specification =
573 * ;; these stmts can appear in any order
574 * path-stmt stmtsep
575 * [require-instance-stmt stmtsep]
576 */
577 leafref_specification : (path_stmt (require_instance_stmt)?) | ((require_instance_stmt)? path_stmt);
578
579 /**
580 * path-stmt = path-keyword sep path-arg-str stmtend
581 */
582 path_stmt : PATH_KEYWORD string STMTEND;
583
584 /**
585 * require-instance-stmt = require-instance-keyword sep
586 * require-instance-arg-str stmtend
587 * require-instance-arg-str = < a string that matches the rule
588 * require-instance-arg >
589 * require-instance-arg = true-keyword / false-keyword
590 */
591 require_instance_stmt : REQUIRE_INSTANCE_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
592
593 /**
594 * instance-identifier-specification =
595 * [require-instance-stmt stmtsep]
596 */
597 instance_identifier_specification : require_instance_stmt?;
598
599 /**
600 * identityref-specification =
601 * base-stmt stmtsep
602 */
603 identityref_specification : base_stmt;
604
605 /**
606 * union-specification = 1*(type-stmt stmtsep)
607 */
608 union_specification : type_stmt+;
609
610 /**
611 * bits-specification = 1*(bit-stmt stmtsep)
612 */
613 bits_specification : bit_stmt+;
614
615 /**
616 * bit-stmt = bit-keyword sep identifier-arg-str optsep
617 * (";" /
618 * "{" stmtsep
619 * ;; these stmts can appear in any order
620 * [position-stmt stmtsep]
621 * [status-stmt stmtsep]
622 * [description-stmt stmtsep]
623 * [reference-stmt stmtsep]
624 * "}"
625 * "}")
626 */
627 bit_stmt : BIT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE bit_body_stmt RIGHT_CURLY_BRACE);
628
629 bit_body_stmt : position_stmt? status_stmt? description_stmt? reference_stmt?
630 | position_stmt? status_stmt? reference_stmt? description_stmt?
631 | position_stmt? description_stmt? status_stmt? reference_stmt?
632 | position_stmt? description_stmt? reference_stmt? status_stmt?
633 | position_stmt? reference_stmt? status_stmt? description_stmt?
634 | position_stmt? reference_stmt? description_stmt? status_stmt?
635 | status_stmt? position_stmt? description_stmt? reference_stmt?
636 | status_stmt? position_stmt? reference_stmt? description_stmt?
637 | status_stmt? description_stmt? description_stmt? position_stmt?
638 | status_stmt? description_stmt? position_stmt? description_stmt?
639 | status_stmt? reference_stmt? position_stmt? description_stmt?
640 | status_stmt? reference_stmt? description_stmt? position_stmt?
641 | description_stmt? position_stmt? status_stmt? reference_stmt?
642 | description_stmt? position_stmt? reference_stmt? status_stmt?
643 | description_stmt? status_stmt? position_stmt? reference_stmt?
644 | description_stmt? status_stmt? reference_stmt? position_stmt?
645 | description_stmt? reference_stmt? position_stmt? status_stmt?
646 | description_stmt? reference_stmt? status_stmt? position_stmt?
647 | reference_stmt? position_stmt? description_stmt? status_stmt?
648 | reference_stmt? position_stmt? status_stmt? description_stmt?
649 | reference_stmt? status_stmt? description_stmt? position_stmt?
650 | reference_stmt? status_stmt? position_stmt? description_stmt?
651 | reference_stmt? description_stmt? position_stmt? status_stmt?
652 | reference_stmt? description_stmt? status_stmt? position_stmt?
653 ;
654
655 /**
656 * position-stmt = position-keyword sep
657 * position-value-arg-str stmtend
658 * position-value-arg-str = < a string that matches the rule
659 * position-value-arg >
660 * position-value-arg = non-negative-integer-value
661 */
662 position_stmt : POSITION_KEYWORD INTEGER STMTEND;
663
664 /**
665 * status-stmt = status-keyword sep status-arg-str stmtend
666 * status-arg-str = < a string that matches the rule
667 * status-arg >
668 * status-arg = current-keyword /
669 * obsolete-keyword /
670 * deprecated-keyword
671 */
672 status_stmt : STATUS_KEYWORD (CURRENT_KEYWORD | OBSOLETE_KEYWORD | DEPRECATED_KEYWORD) STMTEND;
673
674 /**
675 * config-stmt = config-keyword sep
676 * config-arg-str stmtend
677 * config-arg-str = < a string that matches the rule
678 * config-arg >
679 * config-arg = true-keyword / false-keyword
680 */
681 config_stmt : CONFIG_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
682
683 /**
684 * mandatory-stmt = mandatory-keyword sep
685 * mandatory-arg-str stmtend
686 *
687 * mandatory-arg-str = < a string that matches the rule
688 * mandatory-arg >
689 *
690 * mandatory-arg = true-keyword / false-keyword
691 */
692 mandatory_stmt : MANDATORY_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
693
694 /**
695 * presence-stmt = presence-keyword sep string stmtend
696 */
697 presence_stmt : PRESENCE_KEYWORD string STMTEND;
698
699 /**
700 * ordered-by-stmt = ordered-by-keyword sep
701 * ordered-by-arg-str stmtend
702 *
703 * ordered-by-arg-str = < a string that matches the rule
704 * ordered-by-arg >
705 *
706 * ordered-by-arg = user-keyword / system-keyword
707 */
708 ordered_by_stmt : ORDERED_BY_KEYWORD (USER_KEYWORD | SYSTEM_KEYWORD) STMTEND;
709
710 /**
711 * must-stmt = must-keyword sep string optsep
712 * (";" /
713 * "{" stmtsep
714 * ;; these stmts can appear in any order
715 * [error-message-stmt stmtsep]
716 * [error-app-tag-stmt stmtsep]
717 * [description-stmt stmtsep]
718 * [reference-stmt stmtsep]
719 * "}")
720 */
721 must_stmt : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE common_stmts RIGHT_CURLY_BRACE);
722
723 /**
724 * error-message-stmt = error-message-keyword sep string stmtend
725 */
726 error_message_stmt : ERROR_MESSAGE_KEYWORD string STMTEND;
727
728 /**
729 * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
730 */
731 error_app_tag_stmt : ERROR_APP_TAG_KEYWORD string STMTEND;
732
733 /**
734 * min-elements-stmt = min-elements-keyword sep
735 * min-value-arg-str stmtend
736 * min-value-arg-str = < a string that matches the rule
737 * min-value-arg >
738 * min-value-arg = non-negative-integer-value
739 */
740 min_elements_stmt : MIN_ELEMENTS_KEYWORD INTEGER STMTEND;
741
742 /**
743 * max-elements-stmt = max-elements-keyword sep
744 * max-value-arg-str stmtend
745 * max-value-arg-str = < a string that matches the rule
746 * max-value-arg >
747
748 */
749 max_elements_stmt : MAX_ELEMENTS_KEYWORD max_value_arg STMTEND;
750
751 /**
752 * max-value-arg = unbounded-keyword /
753 * positive-integer-value
754 */
755 max_value_arg : UNBOUNDED_KEYWORD | INTEGER;
756
757 /**
758 * value-stmt = value-keyword sep integer-value stmtend
759 */
760 value_stmt : VALUE_KEYWORD ((MINUS INTEGER) | INTEGER) STMTEND;
761
762 /**
763 * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
764 * (";" /
765 * "{" stmtsep
766 * ;; these stmts can appear in any order
767 * [status-stmt stmtsep]
768 * [description-stmt stmtsep]
769 * [reference-stmt stmtsep]
770 * *((typedef-stmt /
771 * grouping-stmt) stmtsep)
772 * *(data-def-stmt stmtsep)
773 * "}")
774 * TODO : 0..1 occurance to be checked in listener
775 */
776 grouping_stmt : GROUPING_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
777 (status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt
778 | data_def_stmt)* RIGHT_CURLY_BRACE);
779
780 /**
781 * container-stmt = container-keyword sep identifier-arg-str optsep
782 * (";" /
783 * "{" stmtsep
784 * ;; these stmts can appear in any order
785 * [when-stmt stmtsep]
786 * *(if-feature-stmt stmtsep)
787 * *(must-stmt stmtsep)
788 * [presence-stmt stmtsep]
789 * [config-stmt stmtsep]
790 * [status-stmt stmtsep]
791 * [description-stmt stmtsep]
792 * [reference-stmt stmtsep]
793 * *((typedef-stmt /
794 * grouping-stmt) stmtsep)
795 * *(data-def-stmt stmtsep)
796 * "}")
797 * TODO : 0..1 occurance to be checked in listener
798 */
799 container_stmt : CONTAINER_KEYWORD IDENTIFIER
800 (STMTEND | LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | must_stmt | presence_stmt | config_stmt
801 | status_stmt | description_stmt | reference_stmt | typedef_stmt | grouping_stmt
802 | data_def_stmt)* RIGHT_CURLY_BRACE);
803
804 /**
805 * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
806 * "{" stmtsep
807 * ;; these stmts can appear in any order
808 * [when-stmt stmtsep]
809 * *(if-feature-stmt stmtsep)
810 * type-stmt stmtsep
811 * [units-stmt stmtsep]
812 * *(must-stmt stmtsep)
813 * [default-stmt stmtsep]
814 * [config-stmt stmtsep]
815 * [mandatory-stmt stmtsep]
816 * [status-stmt stmtsep]
817 * [description-stmt stmtsep]
818 * [reference-stmt stmtsep]
819 * "}"
820 * TODO : 0..1 occurance to be checked in listener
821 */
822 leaf_stmt : LEAF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | type_stmt | units_stmt
823 | must_stmt | default_stmt | config_stmt | mandatory_stmt | status_stmt | description_stmt
824 | reference_stmt)* RIGHT_CURLY_BRACE;
825
826 /**
827 * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
828 * "{" stmtsep
829 * ;; these stmts can appear in any order
830 * [when-stmt stmtsep]
831 * *(if-feature-stmt stmtsep)
832 * type-stmt stmtsep
833 * [units-stmt stmtsep]
834 * *(must-stmt stmtsep)
835 * [config-stmt stmtsep]
836 * [min-elements-stmt stmtsep]
837 * [max-elements-stmt stmtsep]
838 * [ordered-by-stmt stmtsep]
839 * [status-stmt stmtsep]
840 * [description-stmt stmtsep]
841 * [reference-stmt stmtsep]
842 * "}"
843 * TODO : 0..1 occurance to be checked in listener
844 */
845 leaf_list_stmt : LEAF_LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | type_stmt
846 | units_stmt | must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | ordered_by_stmt
847 | status_stmt | description_stmt | reference_stmt)* RIGHT_CURLY_BRACE;
848
849 /**
850 * list-stmt = list-keyword sep identifier-arg-str optsep
851 * "{" stmtsep
852 * ;; these stmts can appear in any order
853 * [when-stmt stmtsep]
854 * *(if-feature-stmt stmtsep)
855 * *(must-stmt stmtsep)
856 * [key-stmt stmtsep]
857 * *(unique-stmt stmtsep)
858 * [config-stmt stmtsep]
859 * [min-elements-stmt stmtsep]
860 * [max-elements-stmt stmtsep]
861 * [ordered-by-stmt stmtsep]
862 * [status-stmt stmtsep]
863 * [description-stmt stmtsep]
864 * [reference-stmt stmtsep]
865 * *((typedef-stmt /
866 * grouping-stmt) stmtsep)
867 * 1*(data-def-stmt stmtsep)
868 * "}"
869 * TODO : 0..1 occurance to be checked in listener
870 */
871 list_stmt : LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | must_stmt | key_stmt
872 | unique_stmt | config_stmt | min_elements_stmt | max_elements_stmt | ordered_by_stmt | status_stmt
873 | description_stmt | reference_stmt | typedef_stmt | grouping_stmt| data_def_stmt)* RIGHT_CURLY_BRACE;
874
875 /**
876 * key-stmt = key-keyword sep key-arg-str stmtend
877 */
878 key_stmt : KEY_KEYWORD string STMTEND;
879
880 /**
881 * unique-stmt = unique-keyword sep unique-arg-str stmtend
882 */
883 unique_stmt: UNIQUE_KEYWORD string STMTEND;
884
885 /**
886 * choice-stmt = choice-keyword sep identifier-arg-str optsep
887 * (";" /
888 * "{" stmtsep
889 * ;; these stmts can appear in any order
890 * [when-stmt stmtsep]
891 * *(if-feature-stmt stmtsep)
892 * [default-stmt stmtsep]
893 * [config-stmt stmtsep]
894 * [mandatory-stmt stmtsep]
895 * [status-stmt stmtsep]
896 * [description-stmt stmtsep]
897 * [reference-stmt stmtsep]
898 * *((short-case-stmt / case-stmt) stmtsep)
899 * "}")
900 * TODO : 0..1 occurance to be checked in listener
901 */
902 choice_stmt : CHOICE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | default_stmt
903 | config_stmt | mandatory_stmt | status_stmt | description_stmt | reference_stmt | short_case_stmt
904 | case_stmt)* RIGHT_CURLY_BRACE);
905
906 /**
907 * short-case-stmt = container-stmt /
908 * leaf-stmt /
909 * leaf-list-stmt /
910 * list-stmt /
911 * anyxml-stmt
912 */
913 short_case_stmt : container_stmt | leaf_stmt | leaf_list_stmt | list_stmt;
914
915 /**
916 * case-stmt = case-keyword sep identifier-arg-str optsep
917 * (";" /
918 * "{" stmtsep
919 * ;; these stmts can appear in any order
920 * [when-stmt stmtsep]
921 * *(if-feature-stmt stmtsep)
922 * [status-stmt stmtsep]
923 * [description-stmt stmtsep]
924 * [reference-stmt stmtsep]
925 * *(data-def-stmt stmtsep)
926 * "}")
927 * TODO : 0..1 occurance to be checked in listener
928 */
929 case_stmt : CASE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | status_stmt
930 | description_stmt | reference_stmt | data_def_stmt)* RIGHT_CURLY_BRACE);
931
932 /**
933 * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
934 * (";" /
935 * "{" stmtsep
936 * ;; these stmts can appear in any order
937 * [when-stmt stmtsep]
938 * *(if-feature-stmt stmtsep)
939 * [status-stmt stmtsep]
940 * [description-stmt stmtsep]
941 * [reference-stmt stmtsep]
942 * *(refine-stmt stmtsep)
943 * *(uses-augment-stmt stmtsep)
944 * "}")
945 * TODO : 0..1 occurance to be checked in listener
946 */
947 uses_stmt : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | status_stmt
948 | description_stmt | reference_stmt | refine_stmt | uses_augment_stmt)* RIGHT_CURLY_BRACE);
949
950 /**
951 * refine-stmt = refine-keyword sep refine-arg-str optsep
952 * (";" /
953 * "{" stmtsep
954 * (refine-container-stmts /
955 * refine-leaf-stmts /
956 * refine-leaf-list-stmts /
957 * refine-list-stmts /
958 * refine-choice-stmts /
959 * refine-case-stmts /
960 * refine-anyxml-stmts)
961 * "}")
962 */
963 refine_stmt : REFINE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (refine_container_stmts | refine_leaf_stmts
964 | refine_leaf_list_stmts | refine_list_stmts | refine_choice_stmts | refine_case_stmts)
965 RIGHT_CURLY_BRACE);
966
967 /**
968 * refine-container-stmts =
969 * ;; these stmts can appear in any order
970 * *(must-stmt stmtsep)
971 * [presence-stmt stmtsep]
972 * [config-stmt stmtsep]
973 * [description-stmt stmtsep]
974 * [reference-stmt stmtsep]
975 * TODO : 0..1 occurance to be checked in listener
976 */
977 refine_container_stmts : (must_stmt | presence_stmt | config_stmt | description_stmt | reference_stmt)* ;
978
979 /**
980 * refine-leaf-stmts = ;; these stmts can appear in any order
981 * *(must-stmt stmtsep)
982 * [default-stmt stmtsep]
983 * [config-stmt stmtsep]
984 * [mandatory-stmt stmtsep]
985 * [description-stmt stmtsep]
986 * [reference-stmt stmtsep]
987 * TODO : 0..1 occurance to be checked in listener
988 */
989 refine_leaf_stmts : (must_stmt | default_stmt | config_stmt | mandatory_stmt | description_stmt | reference_stmt)*;
990
991 /**
992 * refine-leaf-list-stmts =
993 * ;; these stmts can appear in any order
994 * *(must-stmt stmtsep)
995 * [config-stmt stmtsep]
996 * [min-elements-stmt stmtsep]
997 * [max-elements-stmt stmtsep]
998 * [description-stmt stmtsep]
999 * [reference-stmt stmtsep]
1000 * TODO : 0..1 occurance to be checked in listener
1001 */
1002 refine_leaf_list_stmts : (must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | description_stmt
1003 | reference_stmt)*;
1004
1005 /**
1006 * refine-list-stmts = ;; these stmts can appear in any order
1007 * *(must-stmt stmtsep)
1008 * [config-stmt stmtsep]
1009 * [min-elements-stmt stmtsep]
1010 * [max-elements-stmt stmtsep]
1011 * [description-stmt stmtsep]
1012 * [reference-stmt stmtsep]
1013 * TODO : 0..1 occurance to be checked in listener
1014 */
1015 refine_list_stmts : (must_stmt | config_stmt | min_elements_stmt | max_elements_stmt | description_stmt
1016 | reference_stmt)*;
1017
1018 /**
1019 * refine-choice-stmts = ;; these stmts can appear in any order
1020 * [default-stmt stmtsep]
1021 * [config-stmt stmtsep]
1022 * [mandatory-stmt stmtsep]
1023 * [description-stmt stmtsep]
1024 * [reference-stmt stmtsep]
1025 * TODO : 0..1 occurance to be checked in listener
1026 */
1027 refine_choice_stmts : (default_stmt | config_stmt | mandatory_stmt | description_stmt | reference_stmt)*;
1028
1029 /**
1030 * refine-case-stmts = ;; these stmts can appear in any order
1031 * [description-stmt stmtsep]
1032 * [reference-stmt stmtsep]
1033 *
1034 */
1035 refine_case_stmts : (description_stmt | reference_stmt)? | (reference_stmt | description_stmt)?;
1036
1037 /**
1038 * uses-augment-stmt = augment-keyword sep uses-augment-arg-str optsep
1039 * "{" stmtsep
1040 * ;; these stmts can appear in any order
1041 * [when-stmt stmtsep]
1042 * *(if-feature-stmt stmtsep)
1043 * [status-stmt stmtsep]
1044 * [description-stmt stmtsep]
1045 * [reference-stmt stmtsep]
1046 * 1*((data-def-stmt stmtsep) /
1047 * (case-stmt stmtsep))
1048 * "}"
1049 * TODO : 0..1 occurance to be checked in listener
1050 */
1051 uses_augment_stmt : AUGMENT_KEYWORD string LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | status_stmt
1052 | description_stmt | reference_stmt | data_def_stmt | case_stmt)* RIGHT_CURLY_BRACE;
1053
1054 /**
1055 * augment-stmt = augment-keyword sep augment-arg-str optsep
1056 * "{" stmtsep
1057 * ;; these stmts can appear in any order
1058 * [when-stmt stmtsep]
1059 * *(if-feature-stmt stmtsep)
1060 * [status-stmt stmtsep]
1061 * [description-stmt stmtsep]
1062 * [reference-stmt stmtsep]
1063 * 1*((data-def-stmt stmtsep) /
1064 * (case-stmt stmtsep))
1065 * "}"
1066 * TODO : 0..1 occurance to be checked in listener
1067 */
1068 augment_stmt : AUGMENT_KEYWORD string LEFT_CURLY_BRACE (when_stmt | if_feature_stmt | status_stmt
1069 | description_stmt | reference_stmt | data_def_stmt | case_stmt)* RIGHT_CURLY_BRACE;
1070
1071 /**
1072 * when-stmt = when-keyword sep string optsep
1073 * (";" /
1074 * "{" stmtsep
1075 * ;; these stmts can appear in any order
1076 * [description-stmt stmtsep]
1077 * [reference-stmt stmtsep]
1078 * "}")
1079 *
1080 */
1081 when_stmt : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((description_stmt? reference_stmt?)
1082 | (reference_stmt? description_stmt?)) RIGHT_CURLY_BRACE);
1083
1084 /**
1085 * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
1086 * (";" /
1087 * "{" stmtsep
1088 * ;; these stmts can appear in any order
1089 * *(if-feature-stmt stmtsep)
1090 * [status-stmt stmtsep]
1091 * [description-stmt stmtsep]
1092 * [reference-stmt stmtsep]
1093 * *((typedef-stmt /
1094 * grouping-stmt) stmtsep)
1095 * [input-stmt stmtsep]
1096 * [output-stmt stmtsep]
1097 * "}")
1098 * TODO : 0..1 occurance to be checked in listener
1099 */
1100 rpc_stmt : RPC_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (if_feature_stmt | status_stmt | description_stmt
1101 | reference_stmt | typedef_stmt | grouping_stmt | input_stmt | output_stmt)* RIGHT_CURLY_BRACE);
1102
1103 /**
1104 * input-stmt = input-keyword optsep
1105 * "{" stmtsep
1106 * ;; these stmts can appear in any order
1107 * *((typedef-stmt /
1108 * grouping-stmt) stmtsep)
1109 * 1*(data-def-stmt stmtsep)
1110 * "}"
1111 */
1112 input_stmt : INPUT_KEYWORD LEFT_CURLY_BRACE
1113 ((typedef_stmt | grouping_stmt)* | data_def_stmt+)
1114 | (data_def_stmt+ | (typedef_stmt | grouping_stmt)*)RIGHT_CURLY_BRACE;
1115
1116 /**
1117 * output-stmt = output-keyword optsep
1118 * "{" stmtsep
1119 * ;; these stmts can appear in any order
1120 * *((typedef-stmt /
1121 * grouping-stmt) stmtsep)
1122 * 1*(data-def-stmt stmtsep)
1123 * "}"
1124 */
1125 output_stmt : OUTPUT_KEYWORD LEFT_CURLY_BRACE
1126 ((typedef_stmt | grouping_stmt)* | data_def_stmt+)
1127 | (data_def_stmt+ | (typedef_stmt | grouping_stmt)*)RIGHT_CURLY_BRACE;
1128
1129 /**
1130 * notification-stmt = notification-keyword sep
1131 * identifier-arg-str optsep
1132 * (";" /
1133 * "{" stmtsep
1134 * ;; these stmts can appear in any order
1135 * *(if-feature-stmt stmtsep)
1136 * [status-stmt stmtsep]
1137 * [description-stmt stmtsep]
1138 * [reference-stmt stmtsep]
1139 * *((typedef-stmt /
1140 * grouping-stmt) stmtsep)
1141 * *(data-def-stmt stmtsep)
1142 * "}")
1143 * TODO : 0..1 occurance to be checked in listener
1144 */
1145 notification_stmt : NOTIFICATION_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (if_feature_stmt | status_stmt
1146 | description_stmt | reference_stmt | typedef_stmt | grouping_stmt | data_def_stmt)*
1147 RIGHT_CURLY_BRACE);
1148
1149 /**
1150 * deviation-stmt = deviation-keyword sep
1151 * deviation-arg-str optsep
1152 * "{" stmtsep
1153 * ;; these stmts can appear in any order
1154 * [description-stmt stmtsep]
1155 * [reference-stmt stmtsep]
1156 * (deviate-not-supported-stmt /
1157 * 1*(deviate-add-stmt /
1158 * deviate-replace-stmt /
1159 * deviate-delete-stmt))
1160 * "}"
1161 * TODO : 0..1 occurance to be checked in listener
1162 */
1163 deviation_stmt: DEVIATION_KEYWORD string LEFT_CURLY_BRACE (description_stmt | reference_stmt
1164 | deviate_not_supported_stmt | deviate_add_stmt | deviate_replace_stmt | deviate_delete_stmt)*
1165 RIGHT_CURLY_BRACE;
1166
1167 /**
1168 * deviate-not-supported-stmt =
1169 * deviate-keyword sep
1170 * not-supported-keyword optsep
1171 * (";" /
1172 * "{" stmtsep
1173 * "}")
1174 */
1175 deviate_not_supported_stmt: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND | LEFT_CURLY_BRACE RIGHT_CURLY_BRACE);
1176
1177 /**
1178 * deviate-add-stmt = deviate-keyword sep add-keyword optsep
1179 * (";" /
1180 * "{" stmtsep
1181 * [units-stmt stmtsep]
1182 * *(must-stmt stmtsep)
1183 * *(unique-stmt stmtsep)
1184 * [default-stmt stmtsep]
1185 * [config-stmt stmtsep]
1186 * [mandatory-stmt stmtsep]
1187 * [min-elements-stmt stmtsep]
1188 * [max-elements-stmt stmtsep]
1189 * "}")
1190 */
1191 deviate_add_stmt: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE units_stmt? must_stmt* unique_stmt*
1192 default_stmt? config_stmt? mandatory_stmt? min_elements_stmt? max_elements_stmt?
1193 RIGHT_CURLY_BRACE));
1194
1195 /**
1196 * deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
1197 * (";" /
1198 * "{" stmtsep
1199 * [units-stmt stmtsep]
1200 * *(must-stmt stmtsep)
1201 * *(unique-stmt stmtsep)
1202 * [default-stmt stmtsep]
1203 * "}")
1204 */
1205 deviate_delete_stmt: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
1206 | (LEFT_CURLY_BRACE units_stmt? must_stmt* unique_stmt* default_stmt? RIGHT_CURLY_BRACE));
1207
1208 /**
1209 * deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
1210 * (";" /
1211 * "{" stmtsep
1212 * [type-stmt stmtsep]
1213 * [units-stmt stmtsep]
1214 * [default-stmt stmtsep]
1215 * [config-stmt stmtsep]
1216 * [mandatory-stmt stmtsep]
1217 * [min-elements-stmt stmtsep]
1218 * [max-elements-stmt stmtsep]
1219 * "}")
1220 */
1221 deviate_replace_stmt: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE type_stmt? units_stmt?
1222 default_stmt? config_stmt? mandatory_stmt? min_elements_stmt?
1223 max_elements_stmt? RIGHT_CURLY_BRACE));
1224
1225 string : STRING (PLUS STRING)*;
1226