blob: 3ba1201a679952376a0614c7192893d57546ce09 [file] [log] [blame]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301/*
2 * Copyright 2016-present 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.yang.compiler.parser.antlrgencode;
26}
27
28 yangfile : moduleStatement EOF
29 | subModuleStatement EOF;
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 moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody RIGHT_CURLY_BRACE;
44
45 moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
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 moduleHeaderStatement : yangVersionStatement? namespaceStatement prefixStatement
55 | yangVersionStatement? prefixStatement namespaceStatement
56 | namespaceStatement yangVersionStatement? prefixStatement
57 | namespaceStatement prefixStatement yangVersionStatement?
58 | prefixStatement namespaceStatement yangVersionStatement?
59 | prefixStatement yangVersionStatement? namespaceStatement
60 ;
61
62 /**
63 * linkage-stmts = ;; these stmts can appear in any order
64 * *(import-stmt stmtsep)
65 * *(include-stmt stmtsep)
66 */
67 linkageStatements : (importStatement
68 | includeStatement)*;
69
70 /**
71 * meta-stmts = ;; these stmts can appear in any order
72 * [organization-stmt stmtsep]
73 * [contact-stmt stmtsep]
74 * [description-stmt stmtsep]
75 * [reference-stmt stmtsep]
76 */
77 metaStatements : organizationStatement? contactStatement? descriptionStatement? referenceStatement?
78 | organizationStatement? contactStatement? referenceStatement? descriptionStatement?
79 | organizationStatement? descriptionStatement? contactStatement? referenceStatement?
80 | organizationStatement? descriptionStatement? referenceStatement? contactStatement?
81 | organizationStatement? referenceStatement? contactStatement? descriptionStatement?
82 | organizationStatement? referenceStatement? descriptionStatement? contactStatement?
83 | contactStatement? organizationStatement? descriptionStatement? referenceStatement?
84 | contactStatement? organizationStatement? referenceStatement? descriptionStatement?
85 | contactStatement? referenceStatement? organizationStatement? descriptionStatement?
86 | contactStatement? referenceStatement? descriptionStatement? organizationStatement?
87 | contactStatement? descriptionStatement? referenceStatement? organizationStatement?
88 | contactStatement? descriptionStatement? organizationStatement? referenceStatement?
89 | referenceStatement? contactStatement? organizationStatement? descriptionStatement?
90 | referenceStatement? contactStatement? descriptionStatement? organizationStatement?
91 | referenceStatement? organizationStatement? contactStatement? descriptionStatement?
92 | referenceStatement? organizationStatement? descriptionStatement? contactStatement?
93 | referenceStatement? descriptionStatement? organizationStatement? contactStatement?
94 | referenceStatement? descriptionStatement? contactStatement? organizationStatement?
95 | descriptionStatement? referenceStatement? contactStatement? organizationStatement?
96 | descriptionStatement? referenceStatement? organizationStatement? contactStatement?
97 | descriptionStatement? contactStatement? referenceStatement? organizationStatement?
98 | descriptionStatement? contactStatement? organizationStatement? referenceStatement?
99 | descriptionStatement? organizationStatement? contactStatement? referenceStatement?
100 | descriptionStatement? organizationStatement? referenceStatement? contactStatement?
101 ;
102
103 // revision-stmts = *(revision-stmt stmtsep)
104 revisionStatements : revisionStatement*;
105
106 /**
107 * body-stmts = *((extension-stmt /
108 * feature-stmt /
109 * identity-stmt /
110 * typedef-stmt /
111 * grouping-stmt /
112 * data-def-stmt /
113 * augment-stmt /
114 * rpc-stmt /
115 * notification-stmt /
116 * deviation-stmt) stmtsep)
117 */
118 bodyStatements : (extensionStatement
119 | featureStatement
120 | identityStatement
121 | typedefStatement
122 | groupingStatement
123 | dataDefStatement
124 | augmentStatement
125 | rpcStatement
126 | notificationStatement
127 | deviationStatement
128 | compilerAnnotationStatement)*
129 ;
130
131 /**
132 * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
133 * optsep stmtend
134 */
135 yangVersionStatement : YANG_VERSION_KEYWORD version STMTEND;
136
137
138 /**
139 * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
140 * For namespace validation TODO in Listener
141 */
142 namespaceStatement : NAMESPACE_KEYWORD string STMTEND;
143
144 /**
145 * prefix-stmt = prefix-keyword sep prefix-arg-str
146 * optsep stmtend
147 */
148 prefixStatement : PREFIX_KEYWORD identifier STMTEND;
149
150 /**
151 * import-stmt = import-keyword sep identifier-arg-str optsep
152 * "{" stmtsep
153 * prefix-stmt stmtsep
154 * [revision-date-stmt stmtsep]
155 * "}"
156 */
157 importStatement : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
158
159 importStatementBody : prefixStatement revisionDateStatement?;
160
161 // revision-date-stmt = revision-date-keyword sep revision-date stmtend
162 revisionDateStatement : REVISION_DATE_KEYWORD dateArgumentString STMTEND;
163
164 /**
165 * include-stmt = include-keyword sep identifier-arg-str optsep
166 * (";" /
167 * "{" stmtsep
168 * [revision-date-stmt stmtsep]
169 * "}")
170 */
171 includeStatement : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
172
173 /**
174 * organization-stmt = organization-keyword sep string
175 * optsep stmtend
176 */
177 organizationStatement : ORGANIZATION_KEYWORD string STMTEND;
178
179 // contact-stmt = contact-keyword sep string optsep stmtend
180 contactStatement : CONTACT_KEYWORD string STMTEND;
181
182 // description-stmt = description-keyword sep string optsep stmtend
183 descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
184
185 // reference-stmt = reference-keyword sep string optsep stmtend
186 referenceStatement : REFERENCE_KEYWORD string STMTEND;
187
188 /**
189 * revision-stmt = revision-keyword sep revision-date optsep
190 * (";" /
191 * "{" stmtsep
192 * [description-stmt stmtsep]
193 * [reference-stmt stmtsep]
194 * "}")
195 */
196 revisionStatement : REVISION_KEYWORD dateArgumentString (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
197 revisionStatementBody : descriptionStatement? referenceStatement?;
198
199 /**
200 * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
201 * optsep
202 * "{" stmtsep
203 * submodule-header-stmts
204 * linkage-stmts
205 * meta-stmts
206 * revision-stmts
207 * body-stmts
208 * "}" optsep
209 */
210 subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody RIGHT_CURLY_BRACE;
211 submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
212
213 /** submodule-header-stmts =
214 * ;; these stmts can appear in any order
215 * [yang-version-stmt stmtsep]
216 * belongs-to-stmt stmtsep
217 */
218 submoduleHeaderStatement : yangVersionStatement? belongstoStatement
219 | belongstoStatement yangVersionStatement?
220 ;
221
222 /**
223 * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
224 * optsep
225 * "{" stmtsep
226 * prefix-stmt stmtsep
227 * "}"
228 */
229 belongstoStatement : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
230 belongstoStatementBody : prefixStatement;
231
232 /**
233 * extension-stmt = extension-keyword sep identifier-arg-str optsep
234 * (";" /
235 * "{" stmtsep
236 * ;; these stmts can appear in any order
237 * [argument-stmt stmtsep]
238 * [status-stmt stmtsep]
239 * [description-stmt stmtsep]
240 * [reference-stmt stmtsep]
241 * "}")
242 */
243 extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
244 extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
245 | argumentStatement? statusStatement? referenceStatement? descriptionStatement?
246 | argumentStatement? descriptionStatement? statusStatement? referenceStatement?
247 | argumentStatement? descriptionStatement? referenceStatement? statusStatement?
248 | argumentStatement? referenceStatement? descriptionStatement? statusStatement?
249 | argumentStatement? referenceStatement? statusStatement? descriptionStatement?
250 | statusStatement? referenceStatement? argumentStatement? descriptionStatement?
251 | statusStatement? referenceStatement? descriptionStatement? argumentStatement?
252 | statusStatement? descriptionStatement? referenceStatement? argumentStatement?
253 | statusStatement? descriptionStatement? argumentStatement? referenceStatement?
254 | statusStatement? argumentStatement? referenceStatement? descriptionStatement?
255 | statusStatement? argumentStatement? descriptionStatement? referenceStatement?
256 | descriptionStatement? argumentStatement? statusStatement? referenceStatement?
257 | descriptionStatement? argumentStatement? referenceStatement? statusStatement?
258 | descriptionStatement? statusStatement? argumentStatement? referenceStatement?
259 | descriptionStatement? statusStatement? referenceStatement? argumentStatement?
260 | descriptionStatement? referenceStatement? statusStatement? argumentStatement?
261 | descriptionStatement? referenceStatement? argumentStatement? statusStatement?
262 | referenceStatement? descriptionStatement? argumentStatement? statusStatement?
263 | referenceStatement? descriptionStatement? statusStatement? argumentStatement?
264 | referenceStatement? statusStatement? argumentStatement? descriptionStatement?
265 | referenceStatement? statusStatement? descriptionStatement? argumentStatement?
266 | referenceStatement? argumentStatement? descriptionStatement? statusStatement?
267 | referenceStatement? argumentStatement? statusStatement? descriptionStatement?
268 ;
269
270 /**
271 * argument-stmt = argument-keyword sep identifier-arg-str optsep
272 * (";" /
273 * "{" stmtsep
274 * [yin-element-stmt stmtsep]
275 * "}")
276 */
277 argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
278 argumentBody : yinElementStatement?;
279
280 /**
281 * yin-element-stmt = yin-element-keyword sep yin-element-arg-str
282 * stmtend
283 */
284 yinElementStatement : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
285
286 /**
287 * identity-stmt = identity-keyword sep identifier-arg-str optsep
288 * (";" /
289 * "{" stmtsep
290 * ;; these stmts can appear in any order
291 * [base-stmt stmtsep]
292 * [status-stmt stmtsep]
293 * [description-stmt stmtsep]
294 * [reference-stmt stmtsep]
295 * "}")
296 */
297 identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
298 identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
299 | baseStatement? statusStatement? referenceStatement? descriptionStatement?
300 | baseStatement? descriptionStatement? statusStatement? referenceStatement?
301 | baseStatement? descriptionStatement? referenceStatement? statusStatement?
302 | baseStatement? referenceStatement? descriptionStatement? statusStatement?
303 | baseStatement? referenceStatement? statusStatement? descriptionStatement?
304 | referenceStatement? baseStatement? statusStatement? descriptionStatement?
305 | referenceStatement? baseStatement? descriptionStatement? statusStatement?
306 | referenceStatement? statusStatement? baseStatement? descriptionStatement?
307 | referenceStatement? statusStatement? descriptionStatement? baseStatement?
308 | referenceStatement? descriptionStatement? statusStatement? baseStatement?
309 | referenceStatement? descriptionStatement? baseStatement? statusStatement?
310 | descriptionStatement? referenceStatement? statusStatement? baseStatement?
311 | descriptionStatement? referenceStatement? statusStatement? baseStatement?
312 | descriptionStatement? referenceStatement? baseStatement? statusStatement?
313 | descriptionStatement? statusStatement? baseStatement? referenceStatement?
314 | descriptionStatement? statusStatement? referenceStatement? baseStatement?
315 | descriptionStatement? baseStatement? referenceStatement? statusStatement?
316 | descriptionStatement? baseStatement? statusStatement? referenceStatement?
317 | statusStatement? baseStatement? descriptionStatement? referenceStatement?
318 | statusStatement? baseStatement? referenceStatement? descriptionStatement?
319 | statusStatement? descriptionStatement? baseStatement? referenceStatement?
320 | statusStatement? descriptionStatement? referenceStatement? baseStatement?
321 | statusStatement? referenceStatement? descriptionStatement? baseStatement?
322 | statusStatement? referenceStatement? baseStatement? descriptionStatement?
323 ;
324
325 /**
326 * base-stmt = base-keyword sep identifier-ref-arg-str
327 * optsep stmtend*
328 * identifier-ref-arg = [prefix ":"] identifier
329 */
330 baseStatement : BASE_KEYWORD string STMTEND;
331
332 /**
333 * feature-stmt = feature-keyword sep identifier-arg-str optsep
334 * (";" /
335 * "{" stmtsep
336 * ;; these stmts can appear in any order
337 * *(if-feature-stmt stmtsep)
338 * [status-stmt stmtsep]
339 * [description-stmt stmtsep]
340 * [reference-stmt stmtsep]
341 * "}")
342 */
343 featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
344 featureBody : ifFeatureStatement* statusStatement? descriptionStatement? referenceStatement?
345 | ifFeatureStatement* statusStatement? referenceStatement? descriptionStatement?
346 | ifFeatureStatement* descriptionStatement? statusStatement? referenceStatement?
347 | ifFeatureStatement* descriptionStatement? referenceStatement? statusStatement?
348 | ifFeatureStatement* referenceStatement? statusStatement? descriptionStatement?
349 | ifFeatureStatement* referenceStatement? descriptionStatement? statusStatement?
350 | statusStatement? ifFeatureStatement* descriptionStatement? referenceStatement?
351 | statusStatement? ifFeatureStatement* referenceStatement? descriptionStatement?
352 | statusStatement? descriptionStatement? ifFeatureStatement* referenceStatement?
353 | statusStatement? descriptionStatement? referenceStatement? ifFeatureStatement*
354 | statusStatement? referenceStatement? ifFeatureStatement* descriptionStatement?
355 | statusStatement? referenceStatement? descriptionStatement? ifFeatureStatement*
356 | descriptionStatement? ifFeatureStatement* statusStatement? referenceStatement?
357 | descriptionStatement? ifFeatureStatement* referenceStatement? statusStatement?
358 | descriptionStatement? statusStatement? ifFeatureStatement* referenceStatement?
359 | descriptionStatement? statusStatement? referenceStatement? ifFeatureStatement*
360 | descriptionStatement? referenceStatement* statusStatement? ifFeatureStatement*
361 | descriptionStatement? referenceStatement* ifFeatureStatement? statusStatement?
362 | referenceStatement? ifFeatureStatement* statusStatement? descriptionStatement?
363 | referenceStatement? ifFeatureStatement* descriptionStatement? statusStatement?
364 | referenceStatement? descriptionStatement? statusStatement? ifFeatureStatement*
365 | referenceStatement? descriptionStatement? ifFeatureStatement* statusStatement?
366 | referenceStatement? statusStatement? descriptionStatement? ifFeatureStatement*
367 | referenceStatement? statusStatement? ifFeatureStatement* descriptionStatement?
368 ;
369
370 /**
371 * data-def-stmt = container-stmt /
372 * leaf-stmt /
373 * leaf-list-stmt /
374 * list-stmt /
375 * choice-stmt /
376 * anyxml-stmt /
377 * uses-stmt
378 */
379 dataDefStatement : containerStatement
380 | leafStatement
381 | leafListStatement
382 | listStatement
383 | choiceStatement
384 | anyxmlStatement
385 | usesStatement;
386
387 /**
388 * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
389 * optsep stmtend
390 */
391 ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
392
393 /**
394 * units-stmt = units-keyword sep string optsep stmtend
395 */
396 unitsStatement : UNITS_KEYWORD string STMTEND;
397
398 /**
399 * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
400 * "{" stmtsep
401 * ;; these stmts can appear in any order
402 * type-stmt stmtsep
403 * [units-stmt stmtsep]
404 * [default-stmt stmtsep]
405 * [status-stmt stmtsep]
406 * [description-stmt stmtsep]
407 * [reference-stmt stmtsep]
408 * "}"
409 * TODO : 0..1 occurance to be validated in listener
410 */
411 typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
412 (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
413 RIGHT_CURLY_BRACE;
414
415 /**
416 * type-stmt = type-keyword sep identifier-ref-arg-str optsep
417 * (";" /
418 * "{" stmtsep
419 * type-body-stmts
420 * "}")
421 */
422 typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
423
424 /**
425 * type-body-stmts = numerical-restrictions /
426 * decimal64-specification /
427 * string-restrictions /
428 * enum-specification /
429 * leafref-specification /
430 * identityref-specification /
431 * instance-identifier-specification /
432 * bits-specification /
433 * union-specification
434 *
435 */
436 typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
437 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
438 | bitsSpecification | unionSpecification;
439
440 /**
441 * decimal64-specification = ;; these stmts can appear in any order
442 * fraction-digits-stmt
443 * [range-stmt]
444 */
445 decimal64Specification : fractionDigitStatement rangeStatement?;
446
447 /**
448 * fraction-digits-stmt = fraction-digits-keyword sep
449 * fraction-digits-arg-str stmtend
450 *
451 * fraction-digits-arg-str = < a string that matches the rule
452 * fraction-digits-arg >
453 *
454 * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
455 * "5" / "6" / "7" / "8"])
456 * / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
457 */
458 fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction STMTEND;
459
460 /**
461 * numerical-restrictions = range-stmt stmtsep
462 */
463 numericalRestrictions : rangeStatement;
464
465 /**
466 * range-stmt = range-keyword sep range-arg-str optsep
467 * (";" /
468 * "{" stmtsep
469 * ;; these stmts can appear in any order
470 * [error-message-stmt stmtsep]
471 * [error-app-tag-stmt stmtsep]
472 * [description-stmt stmtsep]
473 * [reference-stmt stmtsep]
474 * "}")
475 */
476 rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
477
478 commonStatements : errorMessageStatement? errorAppTagStatement? descriptionStatement? referenceStatement?
479 | errorMessageStatement? errorAppTagStatement? referenceStatement? descriptionStatement?
480 | errorMessageStatement? descriptionStatement? errorAppTagStatement? referenceStatement?
481 | errorMessageStatement? descriptionStatement? referenceStatement? errorAppTagStatement?
482 | errorMessageStatement? referenceStatement? errorAppTagStatement? descriptionStatement?
483 | errorMessageStatement? referenceStatement? descriptionStatement? errorAppTagStatement?
484 | errorAppTagStatement? errorMessageStatement? descriptionStatement? referenceStatement?
485 | errorAppTagStatement? errorMessageStatement? referenceStatement? descriptionStatement?
486 | errorAppTagStatement? descriptionStatement? descriptionStatement? errorMessageStatement?
487 | errorAppTagStatement? descriptionStatement? errorMessageStatement? descriptionStatement?
488 | errorAppTagStatement? referenceStatement? errorMessageStatement? descriptionStatement?
489 | errorAppTagStatement? referenceStatement? descriptionStatement? errorMessageStatement?
490 | descriptionStatement? errorMessageStatement? errorAppTagStatement? referenceStatement?
491 | descriptionStatement? errorMessageStatement? referenceStatement? errorAppTagStatement?
492 | descriptionStatement? errorAppTagStatement? errorMessageStatement? referenceStatement?
493 | descriptionStatement? errorAppTagStatement? referenceStatement? errorMessageStatement?
494 | descriptionStatement? referenceStatement? errorMessageStatement? errorAppTagStatement?
495 | descriptionStatement? referenceStatement? errorAppTagStatement? errorMessageStatement?
496 | referenceStatement? errorMessageStatement? descriptionStatement? errorAppTagStatement?
497 | referenceStatement? errorMessageStatement? errorAppTagStatement? descriptionStatement?
498 | referenceStatement? errorAppTagStatement? descriptionStatement? errorMessageStatement?
499 | referenceStatement? errorAppTagStatement? errorMessageStatement? descriptionStatement?
500 | referenceStatement? descriptionStatement? errorMessageStatement? errorAppTagStatement?
501 | referenceStatement? descriptionStatement? errorAppTagStatement? errorMessageStatement?
502 ;
503
504 /**
505 * string-restrictions = ;; these stmts can appear in any order
506 * [length-stmt stmtsep]
507 * *(pattern-stmt stmtsep)
508 */
509 stringRestrictions : ((lengthStatement)? (patternStatement)*) | ((patternStatement)* (lengthStatement)?);
510
511 /**
512 * length-stmt = length-keyword sep length-arg-str optsep
513 * (";" /
514 * "{" stmtsep
515 * ;; these stmts can appear in any order
516 * [error-message-stmt stmtsep]
517 * [error-app-tag-stmt stmtsep]
518 * [description-stmt stmtsep]
519 * [reference-stmt stmtsep]
520 * "}")
521 */
522 lengthStatement : LENGTH_KEYWORD length
523 (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
524
525 /**
526 * pattern-stmt = pattern-keyword sep string optsep
527 * (";" /
528 * "{" stmtsep
529 * ;; these stmts can appear in any order
530 * [error-message-stmt stmtsep]
531 * [error-app-tag-stmt stmtsep]
532 * [description-stmt stmtsep]
533 * [reference-stmt stmtsep]
534 * "}")
535 */
536 patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
537
538 /**
539 * default-stmt = default-keyword sep string stmtend
540 */
541 defaultStatement : DEFAULT_KEYWORD string STMTEND;
542
543 /**
544 * enum-specification = 1*(enum-stmt stmtsep)
545 */
546 enumSpecification : enumStatement+;
547
548 /**
549 * enum-stmt = enum-keyword sep string optsep
550 * (";" /
551 * "{" stmtsep
552 * ;; these stmts can appear in any order
553 * [value-stmt stmtsep]
554 * [status-stmt stmtsep]
555 * [description-stmt stmtsep]
556 * [reference-stmt stmtsep]
557 * "}")
558 */
559 enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
560
561 enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
562 | valueStatement? statusStatement? referenceStatement? descriptionStatement?
563 | valueStatement? descriptionStatement? statusStatement? referenceStatement?
564 | valueStatement? descriptionStatement? referenceStatement? statusStatement?
565 | valueStatement? referenceStatement? statusStatement? descriptionStatement?
566 | valueStatement? referenceStatement? descriptionStatement? statusStatement?
567 | statusStatement? valueStatement? descriptionStatement? referenceStatement?
568 | statusStatement? valueStatement? referenceStatement? descriptionStatement?
569 | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
570 | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
571 | statusStatement? referenceStatement? valueStatement? descriptionStatement?
572 | statusStatement? referenceStatement? descriptionStatement? valueStatement?
573 | descriptionStatement? valueStatement? statusStatement? referenceStatement?
574 | descriptionStatement? valueStatement? referenceStatement? statusStatement?
575 | descriptionStatement? statusStatement? valueStatement? referenceStatement?
576 | descriptionStatement? statusStatement? referenceStatement? valueStatement?
577 | descriptionStatement? referenceStatement? valueStatement? statusStatement?
578 | descriptionStatement? referenceStatement? statusStatement? valueStatement?
579 | referenceStatement? valueStatement? descriptionStatement? statusStatement?
580 | referenceStatement? valueStatement? statusStatement? descriptionStatement?
581 | referenceStatement? statusStatement? descriptionStatement? valueStatement?
582 | referenceStatement? statusStatement? valueStatement? descriptionStatement?
583 | referenceStatement? descriptionStatement? valueStatement? statusStatement?
584 | referenceStatement? descriptionStatement? statusStatement? valueStatement?
585 ;
586
587 /**
588 * leafref-specification =
589 * ;; these stmts can appear in any order
590 * path-stmt stmtsep
591 * [require-instance-stmt stmtsep]
592 */
593 leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
594
595 /**
596 * path-stmt = path-keyword sep path-arg-str stmtend
597 */
598 pathStatement : PATH_KEYWORD path STMTEND;
599
600 /**
601 * require-instance-stmt = require-instance-keyword sep
602 * require-instance-arg-str stmtend
603 * require-instance-arg-str = < a string that matches the rule
604 * require-instance-arg >
605 * require-instance-arg = true-keyword / false-keyword
606 */
607 requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance STMTEND;
608
609 /**
610 * instance-identifier-specification =
611 * [require-instance-stmt stmtsep]
612 */
613 instanceIdentifierSpecification : requireInstanceStatement?;
614
615 /**
616 * identityref-specification =
617 * base-stmt stmtsep
618 */
619 identityrefSpecification : baseStatement;
620
621 /**
622 * union-specification = 1*(type-stmt stmtsep)
623 */
624 unionSpecification : typeStatement+;
625
626 /**
627 * bits-specification = 1*(bit-stmt stmtsep)
628 */
629 bitsSpecification : bitStatement+;
630
631 /**
632 * bit-stmt = bit-keyword sep identifier-arg-str optsep
633 * (";" /
634 * "{" stmtsep
635 * ;; these stmts can appear in any order
636 * [position-stmt stmtsep]
637 * [status-stmt stmtsep]
638 * [description-stmt stmtsep]
639 * [reference-stmt stmtsep]
640 * "}"
641 * "}")
642 */
643 bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
644
645 bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
646 | positionStatement? statusStatement? referenceStatement? descriptionStatement?
647 | positionStatement? descriptionStatement? statusStatement? referenceStatement?
648 | positionStatement? descriptionStatement? referenceStatement? statusStatement?
649 | positionStatement? referenceStatement? statusStatement? descriptionStatement?
650 | positionStatement? referenceStatement? descriptionStatement? statusStatement?
651 | statusStatement? positionStatement? descriptionStatement? referenceStatement?
652 | statusStatement? positionStatement? referenceStatement? descriptionStatement?
653 | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
654 | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
655 | statusStatement? referenceStatement? positionStatement? descriptionStatement?
656 | statusStatement? referenceStatement? descriptionStatement? positionStatement?
657 | descriptionStatement? positionStatement? statusStatement? referenceStatement?
658 | descriptionStatement? positionStatement? referenceStatement? statusStatement?
659 | descriptionStatement? statusStatement? positionStatement? referenceStatement?
660 | descriptionStatement? statusStatement? referenceStatement? positionStatement?
661 | descriptionStatement? referenceStatement? positionStatement? statusStatement?
662 | descriptionStatement? referenceStatement? statusStatement? positionStatement?
663 | referenceStatement? positionStatement? descriptionStatement? statusStatement?
664 | referenceStatement? positionStatement? statusStatement? descriptionStatement?
665 | referenceStatement? statusStatement? descriptionStatement? positionStatement?
666 | referenceStatement? statusStatement? positionStatement? descriptionStatement?
667 | referenceStatement? descriptionStatement? positionStatement? statusStatement?
668 | referenceStatement? descriptionStatement? statusStatement? positionStatement?
669 ;
670
671 /**
672 * position-stmt = position-keyword sep
673 * position-value-arg-str stmtend
674 * position-value-arg-str = < a string that matches the rule
675 * position-value-arg >
676 * position-value-arg = non-negative-integer-value
677 */
678 positionStatement : POSITION_KEYWORD position STMTEND;
679
680 /**
681 * status-stmt = status-keyword sep status-arg-str stmtend
682 * status-arg-str = < a string that matches the rule
683 * status-arg >
684 * status-arg = current-keyword /
685 * obsolete-keyword /
686 * deprecated-keyword
687 */
688 statusStatement : STATUS_KEYWORD status STMTEND;
689
690 /**
691 * config-stmt = config-keyword sep
692 * config-arg-str stmtend
693 * config-arg-str = < a string that matches the rule
694 * config-arg >
695 * config-arg = true-keyword / false-keyword
696 */
697 configStatement : CONFIG_KEYWORD config STMTEND;
698
699 /**
700 * mandatory-stmt = mandatory-keyword sep
701 * mandatory-arg-str stmtend
702 *
703 * mandatory-arg-str = < a string that matches the rule
704 * mandatory-arg >
705 *
706 * mandatory-arg = true-keyword / false-keyword
707 */
708 mandatoryStatement : MANDATORY_KEYWORD mandatory STMTEND;
709
710 /**
711 * presence-stmt = presence-keyword sep string stmtend
712 */
713 presenceStatement : PRESENCE_KEYWORD string STMTEND;
714
715 /**
716 * ordered-by-stmt = ordered-by-keyword sep
717 * ordered-by-arg-str stmtend
718 *
719 * ordered-by-arg-str = < a string that matches the rule
720 * ordered-by-arg >
721 *
722 * ordered-by-arg = user-keyword / system-keyword
723 */
724 orderedByStatement : ORDERED_BY_KEYWORD orderedBy STMTEND;
725
726 /**
727 * must-stmt = must-keyword sep string optsep
728 * (";" /
729 * "{" stmtsep
730 * ;; these stmts can appear in any order
731 * [error-message-stmt stmtsep]
732 * [error-app-tag-stmt stmtsep]
733 * [description-stmt stmtsep]
734 * [reference-stmt stmtsep]
735 * "}")
736 */
737 mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
738
739 /**
740 * error-message-stmt = error-message-keyword sep string stmtend
741 */
742 errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
743
744 /**
745 * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
746 */
747 errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
748
749 /**
750 * min-elements-stmt = min-elements-keyword sep
751 * min-value-arg-str stmtend
752 * min-value-arg-str = < a string that matches the rule
753 * min-value-arg >
754 * min-value-arg = non-negative-integer-value
755 */
756 minElementsStatement : MIN_ELEMENTS_KEYWORD minValue STMTEND;
757
758 /**
759 * max-elements-stmt = max-elements-keyword sep
760 * max-value-arg-str stmtend
761 * max-value-arg-str = < a string that matches the rule
762 * max-value-arg >
763 * max-value-arg = unbounded-keyword /
764 * positive-integer-value
765 */
766 maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValue STMTEND;
767
768 /**
769 * value-stmt = value-keyword sep integer-value stmtend
770 */
771 valueStatement : VALUE_KEYWORD value STMTEND;
772
773 /**
774 * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
775 * (";" /
776 * "{" stmtsep
777 * ;; these stmts can appear in any order
778 * [status-stmt stmtsep]
779 * [description-stmt stmtsep]
780 * [reference-stmt stmtsep]
781 * *((typedef-stmt /
782 * grouping-stmt) stmtsep)
783 * *(data-def-stmt stmtsep)
784 * "}")
785 * TODO : 0..1 occurance to be checked in listener
786 */
787 groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
788 (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
789 | dataDefStatement)* RIGHT_CURLY_BRACE);
790
791 /**
792 * container-stmt = container-keyword sep identifier-arg-str optsep
793 * (";" /
794 * "{" stmtsep
795 * ;; these stmts can appear in any order
796 * [when-stmt stmtsep]
797 * *(if-feature-stmt stmtsep)
798 * *(must-stmt stmtsep)
799 * [presence-stmt stmtsep]
800 * [config-stmt stmtsep]
801 * [status-stmt stmtsep]
802 * [description-stmt stmtsep]
803 * [reference-stmt stmtsep]
804 * *((typedef-stmt /
805 * grouping-stmt) stmtsep)
806 * *(data-def-stmt stmtsep)
807 * "}")
808 * TODO : 0..1 occurance to be checked in listener
809 */
810 containerStatement : CONTAINER_KEYWORD identifier
811 (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
812 | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
813 | dataDefStatement)* RIGHT_CURLY_BRACE);
814
815 /**
816 * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
817 * "{" stmtsep
818 * ;; these stmts can appear in any order
819 * [when-stmt stmtsep]
820 * *(if-feature-stmt stmtsep)
821 * type-stmt stmtsep
822 * [units-stmt stmtsep]
823 * *(must-stmt stmtsep)
824 * [default-stmt stmtsep]
825 * [config-stmt stmtsep]
826 * [mandatory-stmt stmtsep]
827 * [status-stmt stmtsep]
828 * [description-stmt stmtsep]
829 * [reference-stmt stmtsep]
830 * "}"
831 * TODO : 0..1 occurance to be checked in listener
832 */
833 leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
834 | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
835 | referenceStatement)* RIGHT_CURLY_BRACE;
836
837 /**
838 * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
839 * "{" stmtsep
840 * ;; these stmts can appear in any order
841 * [when-stmt stmtsep]
842 * *(if-feature-stmt stmtsep)
843 * type-stmt stmtsep
844 * [units-stmt stmtsep]
845 * *(must-stmt stmtsep)
846 * [config-stmt stmtsep]
847 * [min-elements-stmt stmtsep]
848 * [max-elements-stmt stmtsep]
849 * [ordered-by-stmt stmtsep]
850 * [status-stmt stmtsep]
851 * [description-stmt stmtsep]
852 * [reference-stmt stmtsep]
853 * "}"
854 * TODO : 0..1 occurance to be checked in listener
855 */
856 leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
857 | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
858 | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
859
860 /**
861 * list-stmt = list-keyword sep identifier-arg-str optsep
862 * "{" stmtsep
863 * ;; these stmts can appear in any order
864 * [when-stmt stmtsep]
865 * *(if-feature-stmt stmtsep)
866 * *(must-stmt stmtsep)
867 * [key-stmt stmtsep]
868 * *(unique-stmt stmtsep)
869 * [config-stmt stmtsep]
870 * [min-elements-stmt stmtsep]
871 * [max-elements-stmt stmtsep]
872 * [ordered-by-stmt stmtsep]
873 * [status-stmt stmtsep]
874 * [description-stmt stmtsep]
875 * [reference-stmt stmtsep]
876 * *((typedef-stmt /
877 * grouping-stmt) stmtsep)
878 * 1*(data-def-stmt stmtsep)
879 * "}"
880 * TODO : 0..1 occurance to be checked in listener
881 */
882 listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
883 | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
884 | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
885
886 /**
887 * key-stmt = key-keyword sep key-arg-str stmtend
888 */
889 keyStatement : KEY_KEYWORD key STMTEND;
890
891 /**
892 * unique-stmt = unique-keyword sep unique-arg-str stmtend
893 */
894 uniqueStatement: UNIQUE_KEYWORD unique STMTEND;
895
896 /**
897 * choice-stmt = choice-keyword sep identifier-arg-str optsep
898 * (";" /
899 * "{" stmtsep
900 * ;; these stmts can appear in any order
901 * [when-stmt stmtsep]
902 * *(if-feature-stmt stmtsep)
903 * [default-stmt stmtsep]
904 * [config-stmt stmtsep]
905 * [mandatory-stmt stmtsep]
906 * [status-stmt stmtsep]
907 * [description-stmt stmtsep]
908 * [reference-stmt stmtsep]
909 * *((short-case-stmt / case-stmt) stmtsep)
910 * "}")
911 * TODO : 0..1 occurance to be checked in listener
912 */
913 choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
914 | configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
915 | caseStatement)* RIGHT_CURLY_BRACE);
916
917 /**
918 * short-case-stmt = container-stmt /
919 * leaf-stmt /
920 * leaf-list-stmt /
921 * list-stmt /
922 * anyxml-stmt
923 */
924 shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement | anyxmlStatement;
925
926 /**
927 * case-stmt = case-keyword sep identifier-arg-str optsep
928 * (";" /
929 * "{" stmtsep
930 * ;; these stmts can appear in any order
931 * [when-stmt stmtsep]
932 * *(if-feature-stmt stmtsep)
933 * [status-stmt stmtsep]
934 * [description-stmt stmtsep]
935 * [reference-stmt stmtsep]
936 * *(data-def-stmt stmtsep)
937 * "}")
938 * TODO : 0..1 occurance to be checked in listener
939 */
940 caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
941 | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
942
943 /**
944 * anyxml-stmt = anyxml-keyword sep identifier-arg-str optsep
945 * (";" /
946 * "{" stmtsep
947 * ;; these stmts can appear in any order
948 * [when-stmt stmtsep]
949 * *(if-feature-stmt stmtsep)
950 * *(must-stmt stmtsep)
951 * [config-stmt stmtsep]
952 * [mandatory-stmt stmtsep]
953 * [status-stmt stmtsep]
954 * [description-stmt stmtsep]
955 * [reference-stmt stmtsep]
956 * "}")
957 */
958 anyxmlStatement : ANYXML_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement
959 | mustStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
960 | referenceStatement)* RIGHT_CURLY_BRACE);
961
962 /**
963 * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
964 * (";" /
965 * "{" stmtsep
966 * ;; these stmts can appear in any order
967 * [when-stmt stmtsep]
968 * *(if-feature-stmt stmtsep)
969 * [status-stmt stmtsep]
970 * [description-stmt stmtsep]
971 * [reference-stmt stmtsep]
972 * *(refine-stmt stmtsep)
973 * *(uses-augment-stmt stmtsep)
974 * "}")
975 * TODO : 0..1 occurance to be checked in listener
976 */
977 usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
978 | descriptionStatement | referenceStatement | refineStatement | augmentStatement)* RIGHT_CURLY_BRACE);
979
980 /**
981 * refine-stmt = refine-keyword sep refine-arg-str optsep
982 * (";" /
983 * "{" stmtsep
984 * (refine-container-stmts /
985 * refine-leaf-stmts /
986 * refine-leaf-list-stmts /
987 * refine-list-stmts /
988 * refine-choice-stmts /
989 * refine-case-stmts /
990 * refine-anyxml-stmts)
991 * "}")
992 */
993 refineStatement : REFINE_KEYWORD refine (STMTEND | LEFT_CURLY_BRACE (refineContainerStatements
994 | refineLeafStatements | refineLeafListStatements | refineListStatements | refineChoiceStatements
995 | refineCaseStatements | refineAnyxmlStatements) RIGHT_CURLY_BRACE);
996
997 /**
998 * refine-container-stmts =
999 * ;; these stmts can appear in any order
1000 * *(must-stmt stmtsep)
1001 * [presence-stmt stmtsep]
1002 * [config-stmt stmtsep]
1003 * [description-stmt stmtsep]
1004 * [reference-stmt stmtsep]
1005 * TODO : 0..1 occurance to be checked in listener
1006 */
1007 refineContainerStatements : (mustStatement | presenceStatement | configStatement | descriptionStatement | referenceStatement)* ;
1008
1009 /**
1010 * refine-leaf-stmts = ;; these stmts can appear in any order
1011 * *(must-stmt stmtsep)
1012 * [default-stmt stmtsep]
1013 * [config-stmt stmtsep]
1014 * [mandatory-stmt stmtsep]
1015 * [description-stmt stmtsep]
1016 * [reference-stmt stmtsep]
1017 * TODO : 0..1 occurance to be checked in listener
1018 */
1019 refineLeafStatements : (mustStatement | defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
1020
1021 /**
1022 * refine-leaf-list-stmts =
1023 * ;; these stmts can appear in any order
1024 * *(must-stmt stmtsep)
1025 * [config-stmt stmtsep]
1026 * [min-elements-stmt stmtsep]
1027 * [max-elements-stmt stmtsep]
1028 * [description-stmt stmtsep]
1029 * [reference-stmt stmtsep]
1030 * TODO : 0..1 occurance to be checked in listener
1031 */
1032 refineLeafListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
1033 | referenceStatement)*;
1034
1035 /**
1036 * refine-list-stmts = ;; these stmts can appear in any order
1037 * *(must-stmt stmtsep)
1038 * [config-stmt stmtsep]
1039 * [min-elements-stmt stmtsep]
1040 * [max-elements-stmt stmtsep]
1041 * [description-stmt stmtsep]
1042 * [reference-stmt stmtsep]
1043 * TODO : 0..1 occurance to be checked in listener
1044 */
1045 refineListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
1046 | referenceStatement)*;
1047
1048 /**
1049 * refine-choice-stmts = ;; these stmts can appear in any order
1050 * [default-stmt stmtsep]
1051 * [config-stmt stmtsep]
1052 * [mandatory-stmt stmtsep]
1053 * [description-stmt stmtsep]
1054 * [reference-stmt stmtsep]
1055 * TODO : 0..1 occurance to be checked in listener
1056 */
1057 refineChoiceStatements : (defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
1058
1059 /**
1060 * refine-case-stmts = ;; these stmts can appear in any order
1061 * [description-stmt stmtsep]
1062 * [reference-stmt stmtsep]
1063 *
1064 */
1065 refineCaseStatements : (descriptionStatement | referenceStatement)? | (referenceStatement | descriptionStatement)?;
1066
1067 /**
1068 * refine-anyxml-stmts = ;; these stmts can appear in any order
1069 * *(must-stmt stmtsep)
1070 * [config-stmt stmtsep]
1071 * [mandatory-stmt stmtsep]
1072 * [description-stmt stmtsep]
1073 * [reference-stmt stmtsep]
1074 */
1075 refineAnyxmlStatements : (mustStatement | configStatement | mandatoryStatement | descriptionStatement
1076 | referenceStatement)*;
1077
1078 /**
1079 * augment-stmt = augment-keyword sep augment-arg-str optsep
1080 * "{" stmtsep
1081 * ;; these stmts can appear in any order
1082 * [when-stmt stmtsep]
1083 * *(if-feature-stmt stmtsep)
1084 * [status-stmt stmtsep]
1085 * [description-stmt stmtsep]
1086 * [reference-stmt stmtsep]
1087 * 1*((data-def-stmt stmtsep) /
1088 * (case-stmt stmtsep))
1089 * "}"
1090 * TODO : 0..1 occurance to be checked in listener
1091 */
1092 augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
1093 | descriptionStatement | referenceStatement | dataDefStatement | caseStatement)* RIGHT_CURLY_BRACE;
1094
1095 /**
1096 * when-stmt = when-keyword sep string optsep
1097 * (";" /
1098 * "{" stmtsep
1099 * ;; these stmts can appear in any order
1100 * [description-stmt stmtsep]
1101 * [reference-stmt stmtsep]
1102 * "}")
1103 *
1104 */
1105 whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
1106 | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
1107
1108 /**
1109 * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
1110 * (";" /
1111 * "{" stmtsep
1112 * ;; these stmts can appear in any order
1113 * *(if-feature-stmt stmtsep)
1114 * [status-stmt stmtsep]
1115 * [description-stmt stmtsep]
1116 * [reference-stmt stmtsep]
1117 * *((typedef-stmt /
1118 * grouping-stmt) stmtsep)
1119 * [input-stmt stmtsep]
1120 * [output-stmt stmtsep]
1121 * "}")
1122 */
1123 rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
1124 | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
1125
1126 /**
1127 * input-stmt = input-keyword optsep
1128 * "{" stmtsep
1129 * ;; these stmts can appear in any order
1130 * *((typedef-stmt /
1131 * grouping-stmt) stmtsep)
1132 * 1*(data-def-stmt stmtsep)
1133 * "}"
1134 */
1135 inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
1136
1137 /**
1138 * output-stmt = output-keyword optsep
1139 * "{" stmtsep
1140 * ;; these stmts can appear in any order
1141 * *((typedef-stmt /
1142 * grouping-stmt) stmtsep)
1143 * 1*(data-def-stmt stmtsep)
1144 * "}"
1145 */
1146 outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE (typedefStatement | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE;
1147
1148 /**
1149 * notification-stmt = notification-keyword sep
1150 * identifier-arg-str optsep
1151 * (";" /
1152 * "{" stmtsep
1153 * ;; these stmts can appear in any order
1154 * *(if-feature-stmt stmtsep)
1155 * [status-stmt stmtsep]
1156 * [description-stmt stmtsep]
1157 * [reference-stmt stmtsep]
1158 * *((typedef-stmt /
1159 * grouping-stmt) stmtsep)
1160 * *(data-def-stmt stmtsep)
1161 * "}")
1162 * TODO : 0..1 occurance to be checked in listener
1163 */
1164 notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
1165 | statusStatement | descriptionStatement | referenceStatement | typedefStatement
1166 | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
1167
1168 /**
1169 * deviation-stmt = deviation-keyword sep
1170 * deviation-arg-str optsep
1171 * "{" stmtsep
1172 * ;; these stmts can appear in any order
1173 * [description-stmt stmtsep]
1174 * [reference-stmt stmtsep]
1175 * (deviate-not-supported-stmt /
1176 * 1*(deviate-add-stmt /
1177 * deviate-replace-stmt /
1178 * deviate-delete-stmt))
1179 * "}"
1180 * TODO : 0..1 occurance to be checked in listener
1181 */
1182 deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE (descriptionStatement | referenceStatement
1183 | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement
1184 | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
1185
1186 /**
1187 * deviate-not-supported-stmt =
1188 * deviate-keyword sep
1189 * not-supported-keyword optsep
1190 * (";" /
1191 * "{" stmtsep
1192 * "}")
1193 */
1194 deviateNotSupportedStatement: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND | LEFT_CURLY_BRACE RIGHT_CURLY_BRACE);
1195
1196 /**
1197 * deviate-add-stmt = deviate-keyword sep add-keyword optsep
1198 * (";" /
1199 * "{" stmtsep
1200 * [units-stmt stmtsep]
1201 * *(must-stmt stmtsep)
1202 * *(unique-stmt stmtsep)
1203 * [default-stmt stmtsep]
1204 * [config-stmt stmtsep]
1205 * [mandatory-stmt stmtsep]
1206 * [min-elements-stmt stmtsep]
1207 * [max-elements-stmt stmtsep]
1208 * "}")
1209 */
1210 deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement*
1211 defaultStatement? configStatement? mandatoryStatement? minElementsStatement? maxElementsStatement?
1212 RIGHT_CURLY_BRACE));
1213
1214 /**
1215 * deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
1216 * (";" /
1217 * "{" stmtsep
1218 * [units-stmt stmtsep]
1219 * *(must-stmt stmtsep)
1220 * *(unique-stmt stmtsep)
1221 * [default-stmt stmtsep]
1222 * "}")
1223 */
1224 deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
1225 | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement* defaultStatement? RIGHT_CURLY_BRACE));
1226
1227 /**
1228 * deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
1229 * (";" /
1230 * "{" stmtsep
1231 * [type-stmt stmtsep]
1232 * [units-stmt stmtsep]
1233 * [default-stmt stmtsep]
1234 * [config-stmt stmtsep]
1235 * [mandatory-stmt stmtsep]
1236 * [min-elements-stmt stmtsep]
1237 * [max-elements-stmt stmtsep]
1238 * "}")
1239 */
1240 deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE typeStatement? unitsStatement?
1241 defaultStatement? configStatement? mandatoryStatement? minElementsStatement?
1242 maxElementsStatement? RIGHT_CURLY_BRACE));
1243
1244 /**
1245 * compiler-annotation-stmt = prefix:compiler-annotation-keyword string
1246 * "{"
1247 * [app-data-structure-stmt stmtsep]
1248 * [app-extended-stmt stmtsep]
1249 * "}"
1250 */
1251 compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
1252 compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
1253
1254 compilerAnnotationBodyStatement : appDataStructureStatement? appExtendedStatement? ;
1255
1256 /**
1257 * app-data-structure-stmt = prefix:app-data-structure-keyword string
1258 * (";" /
1259 * "{"
1260 * [data-structure-key-stmt stmtsep]
1261 * "}")
1262 */
1263 appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND | (LEFT_CURLY_BRACE
1264 dataStructureKeyStatement? RIGHT_CURLY_BRACE));
1265
1266 /**
1267 * data-structure-key-stmt = prefix:key-keyword string ";"
1268 */
1269 dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
1270
1271 /**
1272 * app-extended-stmt = prefix:app-extended-name-keyword string ";"
1273 */
1274 appExtendedStatement : APP_EXTENDED extendedName STMTEND;
1275
1276 string : STRING (PLUS STRING)*
1277 | IDENTIFIER
1278 | INTEGER
1279 | yangConstruct;
1280
1281 identifier : STRING (PLUS STRING)*
1282 | IDENTIFIER
1283 | yangConstruct;
1284
1285 dateArgumentString : DATE_ARG
1286 | STRING (PLUS STRING)*;
1287
1288 version : string;
1289
1290 range : string;
1291
1292 length : string;
1293
1294 path : string;
1295
1296 position : string;
1297
1298 status : string;
1299
1300 config : string;
1301
1302 mandatory : string;
1303
1304 orderedBy : string;
1305
1306 minValue : string;
1307
1308 maxValue : string;
1309
1310 key : string;
1311
1312 unique : string;
1313
1314 refine : string;
1315
1316 requireInstance : string;
1317
1318 augment : string;
1319
1320 deviation : string;
1321
1322 value : string;
1323
1324 fraction : string;
1325
1326 appDataStructure : string;
1327
1328 extendedName : string;
1329
1330 yangConstruct : ANYXML_KEYWORD | ARGUMENT_KEYWORD | AUGMENT_KEYWORD | BASE_KEYWORD | BELONGS_TO_KEYWORD
1331 | BIT_KEYWORD | CASE_KEYWORD | CHOICE_KEYWORD | CONFIG_KEYWORD | CONTACT_KEYWORD | CONTAINER_KEYWORD
1332 | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD | ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
1333 | EXTENSION_KEYWORD | DEVIATION_KEYWORD | DEVIATE_KEYWORD | FEATURE_KEYWORD
1334 | FRACTION_DIGITS_KEYWORD | GROUPING_KEYWORD | IDENTITY_KEYWORD | IF_FEATURE_KEYWORD
1335 | IMPORT_KEYWORD | INCLUDE_KEYWORD | INPUT_KEYWORD | KEY_KEYWORD | LEAF_KEYWORD | LEAF_LIST_KEYWORD
1336 | LENGTH_KEYWORD | LIST_KEYWORD | MANDATORY_KEYWORD | MAX_ELEMENTS_KEYWORD | MIN_ELEMENTS_KEYWORD
1337 | MODULE_KEYWORD | MUST_KEYWORD | NAMESPACE_KEYWORD | NOTIFICATION_KEYWORD | ORDERED_BY_KEYWORD
1338 | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD | POSITION_KEYWORD
1339 | PREFIX_KEYWORD | PRESENCE_KEYWORD | RANGE_KEYWORD | REFERENCE_KEYWORD | REFINE_KEYWORD
1340 | REQUIRE_INSTANCE_KEYWORD | REVISION_KEYWORD | REVISION_DATE_KEYWORD | RPC_KEYWORD
1341 | STATUS_KEYWORD | SUBMODULE_KEYWORD | TYPE_KEYWORD | TYPEDEF_KEYWORD | UNIQUE_KEYWORD
1342 | UNITS_KEYWORD | USES_KEYWORD | VALUE_KEYWORD | WHEN_KEYWORD | YANG_VERSION_KEYWORD
1343 | YIN_ELEMENT_KEYWORD | ADD_KEYWORD | CURRENT_KEYWORD | DELETE_KEYWORD | DEPRECATED_KEYWORD
1344 | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
1345 | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
1346 | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
1347 | APP_EXTENDED_KEYWORD;