blob: b3272bc077b7117466d937528fc3e6c167c35459 [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
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053028 yangfile : moduleStatement
29 | subModuleStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +053030
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
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053043 moduleStatement : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE moduleBody* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +053044
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053045 moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
Vidyashree Ramada621502016-02-05 22:32:34 +053046
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
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053054 moduleHeaderStatement : yangVersionStatement? namespaceStatement prefixStatement
55 | yangVersionStatement? prefixStatement namespaceStatement
56 | namespaceStatement yangVersionStatement? prefixStatement
57 | namespaceStatement prefixStatement yangVersionStatement?
58 | prefixStatement namespaceStatement yangVersionStatement?
59 | prefixStatement yangVersionStatement? namespaceStatement
Vidyashree Ramada621502016-02-05 22:32:34 +053060 ;
61
62 /**
63 * linkage-stmts = ;; these stmts can appear in any order
64 * *(import-stmt stmtsep)
65 * *(include-stmt stmtsep)
66 */
67
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053068 linkageStatements : (importStatement
69 | includeStatement)*;
Vidyashree Ramada621502016-02-05 22:32:34 +053070
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
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +053079 metaStatements : organizationStatement? contactStatement? descriptionStatement? referenceStatement?
80 | organizationStatement? contactStatement? referenceStatement? descriptionStatement?
81 | organizationStatement? descriptionStatement? contactStatement? referenceStatement?
82 | organizationStatement? descriptionStatement? referenceStatement? contactStatement?
83 | organizationStatement? referenceStatement? contactStatement? descriptionStatement?
84 | organizationStatement? referenceStatement? descriptionStatement? contactStatement?
85 | contactStatement? organizationStatement? descriptionStatement? referenceStatement?
86 | contactStatement? organizationStatement? referenceStatement? descriptionStatement?
87 | contactStatement? referenceStatement? organizationStatement? descriptionStatement?
88 | contactStatement? referenceStatement? descriptionStatement? organizationStatement?
89 | contactStatement? descriptionStatement? referenceStatement? organizationStatement?
90 | contactStatement? descriptionStatement? organizationStatement? referenceStatement?
91 | referenceStatement? contactStatement? organizationStatement? descriptionStatement?
92 | referenceStatement? contactStatement? descriptionStatement? organizationStatement?
93 | referenceStatement? organizationStatement? contactStatement? descriptionStatement?
94 | referenceStatement? organizationStatement? descriptionStatement? contactStatement?
95 | referenceStatement? descriptionStatement? organizationStatement? contactStatement?
96 | referenceStatement? descriptionStatement? contactStatement? organizationStatement?
97 | descriptionStatement? referenceStatement? contactStatement? organizationStatement?
98 | descriptionStatement? referenceStatement? organizationStatement? contactStatement?
99 | descriptionStatement? contactStatement? referenceStatement? organizationStatement?
100 | descriptionStatement? contactStatement? organizationStatement? referenceStatement?
101 | descriptionStatement? organizationStatement? contactStatement? referenceStatement?
102 | descriptionStatement? organizationStatement? referenceStatement? contactStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530103 ;
104
105 // revision-stmts = *(revision-stmt stmtsep)
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530106 revisionStatements : revisionStatement*;
Vidyashree Ramada621502016-02-05 22:32:34 +0530107
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
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530121 bodyStatements : (extensionStatement
122 | featureStatement
123 | identityStatement
124 | typedefStatement
125 | groupingStatement
126 | dataDefStatement
127 | augmentStatement
128 | rpcStatement
129 | notificationStatement
130 | deviationStatement)*
Vidyashree Ramada621502016-02-05 22:32:34 +0530131 ;
132
133 /**
134 * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
135 * optsep stmtend
136 */
137
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530138 yangVersionStatement : YANG_VERSION_KEYWORD INTEGER STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530139
140
141 /**
142 * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
143 * For namespace validation TODO in Listener
144 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530145 namespaceStatement : NAMESPACE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530146
147 /**
148 * prefix-stmt = prefix-keyword sep prefix-arg-str
149 * optsep stmtend
150 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530151 prefixStatement : PREFIX_KEYWORD IDENTIFIER STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530152
153 /**
154 * import-stmt = import-keyword sep identifier-arg-str optsep
155 * "{" stmtsep
156 * prefix-stmt stmtsep
157 * [revision-date-stmt stmtsep]
158 * "}"
159 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530160 importStatement : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +0530161
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530162 importStatementBody : prefixStatement revisionDateStatement?;
Vidyashree Ramada621502016-02-05 22:32:34 +0530163
164 // revision-date-stmt = revision-date-keyword sep revision-date stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530165 revisionDateStatement : REVISION_DATE_KEYWORD DATE_ARG STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530166
167 /**
168 * include-stmt = include-keyword sep identifier-arg-str optsep
169 * (";" /
170 * "{" stmtsep
171 * [revision-date-stmt stmtsep]
172 * "}")
173 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530174 includeStatement : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530175
176 /**
177 * organization-stmt = organization-keyword sep string
178 * optsep stmtend
179 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530180 organizationStatement : ORGANIZATION_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530181
182 // contact-stmt = contact-keyword sep string optsep stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530183 contactStatement : CONTACT_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530184
185 // description-stmt = description-keyword sep string optsep stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530186 descriptionStatement : DESCRIPTION_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530187
188 // reference-stmt = reference-keyword sep string optsep stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530189 referenceStatement : REFERENCE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530190
191 /**
192 * revision-stmt = revision-keyword sep revision-date optsep
193 * (";" /
194 * "{" stmtsep
195 * [description-stmt stmtsep]
196 * [reference-stmt stmtsep]
197 * "}")
198 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530199 revisionStatement : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
200 revisionStatementBody : descriptionStatement? referenceStatement?;
Vidyashree Ramada621502016-02-05 22:32:34 +0530201
202 /**
203 * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
204 * optsep
205 * "{" stmtsep
206 * submodule-header-stmts
207 * linkage-stmts
208 * meta-stmts
209 * revision-stmts
210 * body-stmts
211 * "}" optsep
212 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530213 subModuleStatement : SUBMODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE submoduleBody* RIGHT_CURLY_BRACE;
214 submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
Vidyashree Ramada621502016-02-05 22:32:34 +0530215
216 /** submodule-header-stmts =
217 * ;; these stmts can appear in any order
218 * [yang-version-stmt stmtsep]
219 * belongs-to-stmt stmtsep
220 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530221 submoduleHeaderStatement : yangVersionStatement? belongstoStatement
222 | belongstoStatement yangVersionStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530223 ;
224
225 /**
226 * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
227 * optsep
228 * "{" stmtsep
229 * prefix-stmt stmtsep
230 * "}"
231 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530232 belongstoStatement : BELONGS_TO_KEYWORD IDENTIFIER LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
233 belongstoStatementBody : prefixStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +0530234
235 /**
236 * extension-stmt = extension-keyword sep identifier-arg-str optsep
237 * (";" /
238 * "{" stmtsep
239 * ;; these stmts can appear in any order
240 * [argument-stmt stmtsep]
241 * [status-stmt stmtsep]
242 * [description-stmt stmtsep]
243 * [reference-stmt stmtsep]
244 * "}")
245 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530246 extensionStatement : EXTENSION_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
247 extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
248 | argumentStatement? statusStatement? referenceStatement? descriptionStatement?
249 | argumentStatement? descriptionStatement? statusStatement? referenceStatement?
250 | argumentStatement? descriptionStatement? referenceStatement? statusStatement?
251 | argumentStatement? referenceStatement? descriptionStatement? statusStatement?
252 | argumentStatement? referenceStatement? statusStatement? descriptionStatement?
253 | statusStatement? referenceStatement? argumentStatement? descriptionStatement?
254 | statusStatement? referenceStatement? descriptionStatement? argumentStatement?
255 | statusStatement? descriptionStatement? referenceStatement? argumentStatement?
256 | statusStatement? descriptionStatement? argumentStatement? referenceStatement?
257 | statusStatement? argumentStatement? referenceStatement? descriptionStatement?
258 | statusStatement? argumentStatement? descriptionStatement? referenceStatement?
259 | descriptionStatement? argumentStatement? statusStatement? referenceStatement?
260 | descriptionStatement? argumentStatement? referenceStatement? statusStatement?
261 | descriptionStatement? statusStatement? argumentStatement? referenceStatement?
262 | descriptionStatement? statusStatement? referenceStatement? argumentStatement?
263 | descriptionStatement? referenceStatement? statusStatement? argumentStatement?
264 | descriptionStatement? referenceStatement? argumentStatement? statusStatement?
265 | referenceStatement? descriptionStatement? argumentStatement? statusStatement?
266 | referenceStatement? descriptionStatement? statusStatement? argumentStatement?
267 | referenceStatement? statusStatement? argumentStatement? descriptionStatement?
268 | referenceStatement? statusStatement? descriptionStatement? argumentStatement?
269 | referenceStatement? argumentStatement? descriptionStatement? statusStatement?
270 | referenceStatement? argumentStatement? statusStatement? descriptionStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530271 ;
272
273 /**
274 * argument-stmt = argument-keyword sep identifier-arg-str optsep
275 * (";" /
276 * "{" stmtsep
277 * [yin-element-stmt stmtsep]
278 * "}")
279 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530280 argumentStatement : ARGUMENT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
281 argumentBody : yinElementStatement?;
Vidyashree Ramada621502016-02-05 22:32:34 +0530282
283 /**
284 * yin-element-stmt = yin-element-keyword sep yin-element-arg-str
285 * stmtend
286 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530287 yinElementStatement : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530288
289 /**
290 * identity-stmt = identity-keyword sep identifier-arg-str optsep
291 * (";" /
292 * "{" stmtsep
293 * ;; these stmts can appear in any order
294 * [base-stmt stmtsep]
295 * [status-stmt stmtsep]
296 * [description-stmt stmtsep]
297 * [reference-stmt stmtsep]
298 * "}")
299 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530300 identityStatement : IDENTITY_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
301 identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
302 | baseStatement? statusStatement? referenceStatement? descriptionStatement?
303 | baseStatement? descriptionStatement? statusStatement? referenceStatement?
304 | baseStatement? descriptionStatement? referenceStatement? statusStatement?
305 | baseStatement? referenceStatement? descriptionStatement? statusStatement?
306 | baseStatement? referenceStatement? statusStatement? descriptionStatement?
307 | referenceStatement? baseStatement? statusStatement? descriptionStatement?
308 | referenceStatement? baseStatement? descriptionStatement? statusStatement?
309 | referenceStatement? statusStatement? baseStatement? descriptionStatement?
310 | referenceStatement? statusStatement? descriptionStatement? baseStatement?
311 | referenceStatement? descriptionStatement? statusStatement? baseStatement?
312 | referenceStatement? descriptionStatement? baseStatement? statusStatement?
313 | descriptionStatement? referenceStatement? statusStatement? baseStatement?
314 | descriptionStatement? referenceStatement? statusStatement? baseStatement?
315 | descriptionStatement? referenceStatement? baseStatement? statusStatement?
316 | descriptionStatement? statusStatement? baseStatement? referenceStatement?
317 | descriptionStatement? statusStatement? referenceStatement? baseStatement?
318 | descriptionStatement? baseStatement? referenceStatement? statusStatement?
319 | descriptionStatement? baseStatement? statusStatement? referenceStatement?
320 | statusStatement? baseStatement? descriptionStatement? referenceStatement?
321 | statusStatement? baseStatement? referenceStatement? descriptionStatement?
322 | statusStatement? descriptionStatement? baseStatement? referenceStatement?
323 | statusStatement? descriptionStatement? referenceStatement? baseStatement?
324 | statusStatement? referenceStatement? descriptionStatement? baseStatement?
325 | statusStatement? referenceStatement? baseStatement? descriptionStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530326 ;
327
328 /**
329 * base-stmt = base-keyword sep identifier-ref-arg-str
330 * optsep stmtend*
331 * identifier-ref-arg = [prefix ":"] identifier
332 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530333 baseStatement : BASE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530334
335 /**
336 * feature-stmt = feature-keyword sep identifier-arg-str optsep
337 * (";" /
338 * "{" stmtsep
339 * ;; these stmts can appear in any order
340 * *(if-feature-stmt stmtsep)
341 * [status-stmt stmtsep]
342 * [description-stmt stmtsep]
343 * [reference-stmt stmtsep]
344 * "}")
345 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530346 featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE featureBody RIGHT_CURLY_BRACE);
347 featureBody : ifFeatureStatement* statusStatement? descriptionStatement? referenceStatement?
348 | ifFeatureStatement* statusStatement? referenceStatement? descriptionStatement?
349 | ifFeatureStatement* descriptionStatement? statusStatement? referenceStatement?
350 | ifFeatureStatement* descriptionStatement? referenceStatement? statusStatement?
351 | ifFeatureStatement* referenceStatement? statusStatement? descriptionStatement?
352 | ifFeatureStatement* referenceStatement? descriptionStatement? statusStatement?
353 | statusStatement? ifFeatureStatement* descriptionStatement? referenceStatement?
354 | statusStatement? ifFeatureStatement* referenceStatement? descriptionStatement?
355 | statusStatement? descriptionStatement? ifFeatureStatement* referenceStatement?
356 | statusStatement? descriptionStatement? referenceStatement? ifFeatureStatement*
357 | statusStatement? referenceStatement? ifFeatureStatement* descriptionStatement?
358 | statusStatement? referenceStatement? descriptionStatement? ifFeatureStatement*
359 | descriptionStatement? ifFeatureStatement* statusStatement? referenceStatement?
360 | descriptionStatement? ifFeatureStatement* referenceStatement? statusStatement?
361 | descriptionStatement? statusStatement? ifFeatureStatement* referenceStatement?
362 | descriptionStatement? statusStatement? referenceStatement? ifFeatureStatement*
363 | descriptionStatement? referenceStatement* statusStatement? ifFeatureStatement*
364 | descriptionStatement? referenceStatement* ifFeatureStatement? statusStatement?
365 | referenceStatement? ifFeatureStatement* statusStatement? descriptionStatement?
366 | referenceStatement? ifFeatureStatement* descriptionStatement? statusStatement?
367 | referenceStatement? descriptionStatement? statusStatement? ifFeatureStatement*
368 | referenceStatement? descriptionStatement? ifFeatureStatement* statusStatement?
369 | referenceStatement? statusStatement? descriptionStatement? ifFeatureStatement*
370 | referenceStatement? statusStatement? ifFeatureStatement* descriptionStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530371 ;
372
373 /**
374 * data-def-stmt = container-stmt /
375 * leaf-stmt /
376 * leaf-list-stmt /
377 * list-stmt /
378 * choice-stmt /
379 * anyxml-stmt /
380 * uses-stmt
381 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530382 dataDefStatement : containerStatement
383 | leafStatement
384 | leafListStatement
385 | listStatement
386 | choiceStatement
387 | usesStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +0530388
389 /**
390 * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
391 * optsep stmtend
392 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530393 ifFeatureStatement : IF_FEATURE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530394
395 /**
396 * units-stmt = units-keyword sep string optsep stmtend
397 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530398 unitsStatement : UNITS_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530399
400 /**
401 * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
402 * "{" stmtsep
403 * ;; these stmts can appear in any order
404 * type-stmt stmtsep
405 * [units-stmt stmtsep]
406 * [default-stmt stmtsep]
407 * [status-stmt stmtsep]
408 * [description-stmt stmtsep]
409 * [reference-stmt stmtsep]
410 * "}"
411 * TODO : 0..1 occurance to be validated in listener
412 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530413 typedefStatement : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
414 (typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
Vidyashree Ramada621502016-02-05 22:32:34 +0530415 RIGHT_CURLY_BRACE;
416
417 /**
418 * type-stmt = type-keyword sep identifier-ref-arg-str optsep
419 * (";" /
420 * "{" stmtsep
421 * type-body-stmts
422 * "}")
423 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530424 typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE typeBodyStatements RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530425
426 /**
427 * type-body-stmts = numerical-restrictions /
428 * decimal64-specification /
429 * string-restrictions /
430 * enum-specification /
431 * leafref-specification /
432 * identityref-specification /
433 * instance-identifier-specification /
434 * bits-specification /
435 * union-specification
436 * TODO : decimal64-specification to be added
437 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530438 typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification
439 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
440 | bitsSpecification | unionSpecification;
Vidyashree Ramada621502016-02-05 22:32:34 +0530441
442 /**
443 * numerical-restrictions = range-stmt stmtsep
444 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530445 numericalRestrictions : rangeStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +0530446
447 /**
448 * range-stmt = range-keyword sep range-arg-str optsep
449 * (";" /
450 * "{" stmtsep
451 * ;; these stmts can appear in any order
452 * [error-message-stmt stmtsep]
453 * [error-app-tag-stmt stmtsep]
454 * [description-stmt stmtsep]
455 * [reference-stmt stmtsep]
456 * "}")
457 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530458 rangeStatement : RANGE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530459
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530460 commonStatements : errorMessageStatement? errorAppTagStatement? descriptionStatement? referenceStatement?
461 | errorMessageStatement? errorAppTagStatement? referenceStatement? descriptionStatement?
462 | errorMessageStatement? descriptionStatement? errorAppTagStatement? referenceStatement?
463 | errorMessageStatement? descriptionStatement? referenceStatement? errorAppTagStatement?
464 | errorMessageStatement? referenceStatement? errorAppTagStatement? descriptionStatement?
465 | errorMessageStatement? referenceStatement? descriptionStatement? errorAppTagStatement?
466 | errorAppTagStatement? errorMessageStatement? descriptionStatement? referenceStatement?
467 | errorAppTagStatement? errorMessageStatement? referenceStatement? descriptionStatement?
468 | errorAppTagStatement? descriptionStatement? descriptionStatement? errorMessageStatement?
469 | errorAppTagStatement? descriptionStatement? errorMessageStatement? descriptionStatement?
470 | errorAppTagStatement? referenceStatement? errorMessageStatement? descriptionStatement?
471 | errorAppTagStatement? referenceStatement? descriptionStatement? errorMessageStatement?
472 | descriptionStatement? errorMessageStatement? errorAppTagStatement? referenceStatement?
473 | descriptionStatement? errorMessageStatement? referenceStatement? errorAppTagStatement?
474 | descriptionStatement? errorAppTagStatement? errorMessageStatement? referenceStatement?
475 | descriptionStatement? errorAppTagStatement? referenceStatement? errorMessageStatement?
476 | descriptionStatement? referenceStatement? errorMessageStatement? errorAppTagStatement?
477 | descriptionStatement? referenceStatement? errorAppTagStatement? errorMessageStatement?
478 | referenceStatement? errorMessageStatement? descriptionStatement? errorAppTagStatement?
479 | referenceStatement? errorMessageStatement? errorAppTagStatement? descriptionStatement?
480 | referenceStatement? errorAppTagStatement? descriptionStatement? errorMessageStatement?
481 | referenceStatement? errorAppTagStatement? errorMessageStatement? descriptionStatement?
482 | referenceStatement? descriptionStatement? errorMessageStatement? errorAppTagStatement?
483 | referenceStatement? descriptionStatement? errorAppTagStatement? errorMessageStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530484 ;
485
486 /**
487 * string-restrictions = ;; these stmts can appear in any order
488 * [length-stmt stmtsep]
489 * *(pattern-stmt stmtsep)
490 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530491 stringRestrictions : ((lengthStatement)? (patternStatement)*) | ((patternStatement)* (lengthStatement)?);
Vidyashree Ramada621502016-02-05 22:32:34 +0530492
493 /**
494 * length-stmt = length-keyword sep length-arg-str optsep
495 * (";" /
496 * "{" stmtsep
497 * ;; these stmts can appear in any order
498 * [error-message-stmt stmtsep]
499 * [error-app-tag-stmt stmtsep]
500 * [description-stmt stmtsep]
501 * [reference-stmt stmtsep]
502 * "}")
503 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530504 lengthStatement : LENGTH_KEYWORD string
505 (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530506
507 /**
508 * pattern-stmt = pattern-keyword sep string optsep
509 * (";" /
510 * "{" stmtsep
511 * ;; these stmts can appear in any order
512 * [error-message-stmt stmtsep]
513 * [error-app-tag-stmt stmtsep]
514 * [description-stmt stmtsep]
515 * [reference-stmt stmtsep]
516 * "}")
517 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530518 patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530519
520 /**
521 * default-stmt = default-keyword sep string stmtend
522 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530523 defaultStatement : DEFAULT_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530524
525 /**
526 * enum-specification = 1*(enum-stmt stmtsep)
527 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530528 enumSpecification : enumStatement+;
Vidyashree Ramada621502016-02-05 22:32:34 +0530529
530 /**
531 * enum-stmt = enum-keyword sep string optsep
532 * (";" /
533 * "{" stmtsep
534 * ;; these stmts can appear in any order
535 * [value-stmt stmtsep]
536 * [status-stmt stmtsep]
537 * [description-stmt stmtsep]
538 * [reference-stmt stmtsep]
539 * "}")
540 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530541 enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530542
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530543 enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement?
544 | valueStatement? statusStatement? referenceStatement? descriptionStatement?
545 | valueStatement? descriptionStatement? statusStatement? referenceStatement?
546 | valueStatement? descriptionStatement? referenceStatement? statusStatement?
547 | valueStatement? referenceStatement? statusStatement? descriptionStatement?
548 | valueStatement? referenceStatement? descriptionStatement? statusStatement?
549 | statusStatement? valueStatement? descriptionStatement? referenceStatement?
550 | statusStatement? valueStatement? referenceStatement? descriptionStatement?
551 | statusStatement? descriptionStatement? descriptionStatement? valueStatement?
552 | statusStatement? descriptionStatement? valueStatement? descriptionStatement?
553 | statusStatement? referenceStatement? valueStatement? descriptionStatement?
554 | statusStatement? referenceStatement? descriptionStatement? valueStatement?
555 | descriptionStatement? valueStatement? statusStatement? referenceStatement?
556 | descriptionStatement? valueStatement? referenceStatement? statusStatement?
557 | descriptionStatement? statusStatement? valueStatement? referenceStatement?
558 | descriptionStatement? statusStatement? referenceStatement? valueStatement?
559 | descriptionStatement? referenceStatement? valueStatement? statusStatement?
560 | descriptionStatement? referenceStatement? statusStatement? valueStatement?
561 | referenceStatement? valueStatement? descriptionStatement? statusStatement?
562 | referenceStatement? valueStatement? statusStatement? descriptionStatement?
563 | referenceStatement? statusStatement? descriptionStatement? valueStatement?
564 | referenceStatement? statusStatement? valueStatement? descriptionStatement?
565 | referenceStatement? descriptionStatement? valueStatement? statusStatement?
566 | referenceStatement? descriptionStatement? statusStatement? valueStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530567 ;
568
569 /**
570 * leafref-specification =
571 * ;; these stmts can appear in any order
572 * path-stmt stmtsep
573 * [require-instance-stmt stmtsep]
574 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530575 leafrefSpecification : (pathStatement (requireInstanceStatement)?) | ((requireInstanceStatement)? pathStatement);
Vidyashree Ramada621502016-02-05 22:32:34 +0530576
577 /**
578 * path-stmt = path-keyword sep path-arg-str stmtend
579 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530580 pathStatement : PATH_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530581
582 /**
583 * require-instance-stmt = require-instance-keyword sep
584 * require-instance-arg-str stmtend
585 * require-instance-arg-str = < a string that matches the rule
586 * require-instance-arg >
587 * require-instance-arg = true-keyword / false-keyword
588 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530589 requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530590
591 /**
592 * instance-identifier-specification =
593 * [require-instance-stmt stmtsep]
594 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530595 instanceIdentifierSpecification : requireInstanceStatement?;
Vidyashree Ramada621502016-02-05 22:32:34 +0530596
597 /**
598 * identityref-specification =
599 * base-stmt stmtsep
600 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530601 identityrefSpecification : baseStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +0530602
603 /**
604 * union-specification = 1*(type-stmt stmtsep)
605 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530606 unionSpecification : typeStatement+;
Vidyashree Ramada621502016-02-05 22:32:34 +0530607
608 /**
609 * bits-specification = 1*(bit-stmt stmtsep)
610 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530611 bitsSpecification : bitStatement+;
Vidyashree Ramada621502016-02-05 22:32:34 +0530612
613 /**
614 * bit-stmt = bit-keyword sep identifier-arg-str optsep
615 * (";" /
616 * "{" stmtsep
617 * ;; these stmts can appear in any order
618 * [position-stmt stmtsep]
619 * [status-stmt stmtsep]
620 * [description-stmt stmtsep]
621 * [reference-stmt stmtsep]
622 * "}"
623 * "}")
624 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530625 bitStatement : BIT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530626
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530627 bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
628 | positionStatement? statusStatement? referenceStatement? descriptionStatement?
629 | positionStatement? descriptionStatement? statusStatement? referenceStatement?
630 | positionStatement? descriptionStatement? referenceStatement? statusStatement?
631 | positionStatement? referenceStatement? statusStatement? descriptionStatement?
632 | positionStatement? referenceStatement? descriptionStatement? statusStatement?
633 | statusStatement? positionStatement? descriptionStatement? referenceStatement?
634 | statusStatement? positionStatement? referenceStatement? descriptionStatement?
635 | statusStatement? descriptionStatement? descriptionStatement? positionStatement?
636 | statusStatement? descriptionStatement? positionStatement? descriptionStatement?
637 | statusStatement? referenceStatement? positionStatement? descriptionStatement?
638 | statusStatement? referenceStatement? descriptionStatement? positionStatement?
639 | descriptionStatement? positionStatement? statusStatement? referenceStatement?
640 | descriptionStatement? positionStatement? referenceStatement? statusStatement?
641 | descriptionStatement? statusStatement? positionStatement? referenceStatement?
642 | descriptionStatement? statusStatement? referenceStatement? positionStatement?
643 | descriptionStatement? referenceStatement? positionStatement? statusStatement?
644 | descriptionStatement? referenceStatement? statusStatement? positionStatement?
645 | referenceStatement? positionStatement? descriptionStatement? statusStatement?
646 | referenceStatement? positionStatement? statusStatement? descriptionStatement?
647 | referenceStatement? statusStatement? descriptionStatement? positionStatement?
648 | referenceStatement? statusStatement? positionStatement? descriptionStatement?
649 | referenceStatement? descriptionStatement? positionStatement? statusStatement?
650 | referenceStatement? descriptionStatement? statusStatement? positionStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +0530651 ;
652
653 /**
654 * position-stmt = position-keyword sep
655 * position-value-arg-str stmtend
656 * position-value-arg-str = < a string that matches the rule
657 * position-value-arg >
658 * position-value-arg = non-negative-integer-value
659 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530660 positionStatement : POSITION_KEYWORD INTEGER STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530661
662 /**
663 * status-stmt = status-keyword sep status-arg-str stmtend
664 * status-arg-str = < a string that matches the rule
665 * status-arg >
666 * status-arg = current-keyword /
667 * obsolete-keyword /
668 * deprecated-keyword
669 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530670 statusStatement : STATUS_KEYWORD (CURRENT_KEYWORD | OBSOLETE_KEYWORD | DEPRECATED_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530671
672 /**
673 * config-stmt = config-keyword sep
674 * config-arg-str stmtend
675 * config-arg-str = < a string that matches the rule
676 * config-arg >
677 * config-arg = true-keyword / false-keyword
678 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530679 configStatement : CONFIG_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530680
681 /**
682 * mandatory-stmt = mandatory-keyword sep
683 * mandatory-arg-str stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530684 *
Vidyashree Ramada621502016-02-05 22:32:34 +0530685 * mandatory-arg-str = < a string that matches the rule
686 * mandatory-arg >
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530687 *
688 * mandatory-arg = true-keyword / false-keyword
Vidyashree Ramada621502016-02-05 22:32:34 +0530689 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530690 mandatoryStatement : MANDATORY_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530691
692 /**
693 * presence-stmt = presence-keyword sep string stmtend
694 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530695 presenceStatement : PRESENCE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530696
697 /**
698 * ordered-by-stmt = ordered-by-keyword sep
699 * ordered-by-arg-str stmtend
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530700 *
Vidyashree Ramada621502016-02-05 22:32:34 +0530701 * ordered-by-arg-str = < a string that matches the rule
702 * ordered-by-arg >
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530703 *
Vidyashree Ramada621502016-02-05 22:32:34 +0530704 * ordered-by-arg = user-keyword / system-keyword
705 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530706 orderedByStatement : ORDERED_BY_KEYWORD (USER_KEYWORD | SYSTEM_KEYWORD) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530707
708 /**
709 * must-stmt = must-keyword sep string optsep
710 * (";" /
711 * "{" stmtsep
712 * ;; these stmts can appear in any order
713 * [error-message-stmt stmtsep]
714 * [error-app-tag-stmt stmtsep]
715 * [description-stmt stmtsep]
716 * [reference-stmt stmtsep]
717 * "}")
718 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530719 mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE commonStatements RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530720
721 /**
722 * error-message-stmt = error-message-keyword sep string stmtend
723 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530724 errorMessageStatement : ERROR_MESSAGE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530725
726 /**
727 * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
728 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530729 errorAppTagStatement : ERROR_APP_TAG_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530730
731 /**
732 * min-elements-stmt = min-elements-keyword sep
733 * min-value-arg-str stmtend
734 * min-value-arg-str = < a string that matches the rule
735 * min-value-arg >
736 * min-value-arg = non-negative-integer-value
737 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530738 minElementsStatement : MIN_ELEMENTS_KEYWORD INTEGER STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530739
740 /**
741 * max-elements-stmt = max-elements-keyword sep
742 * max-value-arg-str stmtend
743 * max-value-arg-str = < a string that matches the rule
744 * max-value-arg >
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530745
Vidyashree Ramada621502016-02-05 22:32:34 +0530746 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530747 maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValueArgument STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530748
749 /**
750 * max-value-arg = unbounded-keyword /
751 * positive-integer-value
752 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530753 maxValueArgument : UNBOUNDED_KEYWORD | INTEGER;
Vidyashree Ramada621502016-02-05 22:32:34 +0530754
755 /**
756 * value-stmt = value-keyword sep integer-value stmtend
757 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530758 valueStatement : VALUE_KEYWORD ((MINUS INTEGER) | INTEGER) STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530759
760 /**
761 * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
762 * (";" /
763 * "{" stmtsep
764 * ;; these stmts can appear in any order
765 * [status-stmt stmtsep]
766 * [description-stmt stmtsep]
767 * [reference-stmt stmtsep]
768 * *((typedef-stmt /
769 * grouping-stmt) stmtsep)
770 * *(data-def-stmt stmtsep)
771 * "}")
772 * TODO : 0..1 occurance to be checked in listener
773 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530774 groupingStatement : GROUPING_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
775 (statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
776 | dataDefStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530777
778 /**
779 * container-stmt = container-keyword sep identifier-arg-str optsep
780 * (";" /
781 * "{" stmtsep
782 * ;; these stmts can appear in any order
783 * [when-stmt stmtsep]
784 * *(if-feature-stmt stmtsep)
785 * *(must-stmt stmtsep)
786 * [presence-stmt stmtsep]
787 * [config-stmt stmtsep]
788 * [status-stmt stmtsep]
789 * [description-stmt stmtsep]
790 * [reference-stmt stmtsep]
791 * *((typedef-stmt /
792 * grouping-stmt) stmtsep)
793 * *(data-def-stmt stmtsep)
794 * "}")
795 * TODO : 0..1 occurance to be checked in listener
796 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530797 containerStatement : CONTAINER_KEYWORD IDENTIFIER
798 (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
799 | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
800 | dataDefStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530801
802 /**
803 * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
804 * "{" stmtsep
805 * ;; these stmts can appear in any order
806 * [when-stmt stmtsep]
807 * *(if-feature-stmt stmtsep)
808 * type-stmt stmtsep
809 * [units-stmt stmtsep]
810 * *(must-stmt stmtsep)
811 * [default-stmt stmtsep]
812 * [config-stmt stmtsep]
813 * [mandatory-stmt stmtsep]
814 * [status-stmt stmtsep]
815 * [description-stmt stmtsep]
816 * [reference-stmt stmtsep]
817 * "}"
818 * TODO : 0..1 occurance to be checked in listener
819 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530820 leafStatement : LEAF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
821 | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
822 | referenceStatement)* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +0530823
824 /**
825 * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
826 * "{" stmtsep
827 * ;; these stmts can appear in any order
828 * [when-stmt stmtsep]
829 * *(if-feature-stmt stmtsep)
830 * type-stmt stmtsep
831 * [units-stmt stmtsep]
832 * *(must-stmt stmtsep)
833 * [config-stmt stmtsep]
834 * [min-elements-stmt stmtsep]
835 * [max-elements-stmt stmtsep]
836 * [ordered-by-stmt stmtsep]
837 * [status-stmt stmtsep]
838 * [description-stmt stmtsep]
839 * [reference-stmt stmtsep]
840 * "}"
841 * TODO : 0..1 occurance to be checked in listener
842 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530843 leafListStatement : LEAF_LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
844 | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
845 | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +0530846
847 /**
848 * list-stmt = list-keyword sep identifier-arg-str optsep
849 * "{" stmtsep
850 * ;; these stmts can appear in any order
851 * [when-stmt stmtsep]
852 * *(if-feature-stmt stmtsep)
853 * *(must-stmt stmtsep)
854 * [key-stmt stmtsep]
855 * *(unique-stmt stmtsep)
856 * [config-stmt stmtsep]
857 * [min-elements-stmt stmtsep]
858 * [max-elements-stmt stmtsep]
859 * [ordered-by-stmt stmtsep]
860 * [status-stmt stmtsep]
861 * [description-stmt stmtsep]
862 * [reference-stmt stmtsep]
863 * *((typedef-stmt /
864 * grouping-stmt) stmtsep)
865 * 1*(data-def-stmt stmtsep)
866 * "}"
867 * TODO : 0..1 occurance to be checked in listener
868 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530869 listStatement : LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
870 | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
871 | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +0530872
873 /**
874 * key-stmt = key-keyword sep key-arg-str stmtend
875 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530876 keyStatement : KEY_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530877
878 /**
879 * unique-stmt = unique-keyword sep unique-arg-str stmtend
880 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530881 uniqueStatement: UNIQUE_KEYWORD string STMTEND;
Vidyashree Ramada621502016-02-05 22:32:34 +0530882
883 /**
884 * choice-stmt = choice-keyword sep identifier-arg-str optsep
885 * (";" /
886 * "{" stmtsep
887 * ;; these stmts can appear in any order
888 * [when-stmt stmtsep]
889 * *(if-feature-stmt stmtsep)
890 * [default-stmt stmtsep]
891 * [config-stmt stmtsep]
892 * [mandatory-stmt stmtsep]
893 * [status-stmt stmtsep]
894 * [description-stmt stmtsep]
895 * [reference-stmt stmtsep]
896 * *((short-case-stmt / case-stmt) stmtsep)
897 * "}")
898 * TODO : 0..1 occurance to be checked in listener
899 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530900 choiceStatement : CHOICE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
901 | configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
902 | caseStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530903
904 /**
905 * short-case-stmt = container-stmt /
906 * leaf-stmt /
907 * leaf-list-stmt /
908 * list-stmt /
909 * anyxml-stmt
910 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530911 shortCaseStatement : containerStatement | leafStatement | leafListStatement | listStatement;
Vidyashree Ramada621502016-02-05 22:32:34 +0530912
913 /**
914 * case-stmt = case-keyword sep identifier-arg-str optsep
915 * (";" /
916 * "{" stmtsep
917 * ;; these stmts can appear in any order
918 * [when-stmt stmtsep]
919 * *(if-feature-stmt stmtsep)
920 * [status-stmt stmtsep]
921 * [description-stmt stmtsep]
922 * [reference-stmt stmtsep]
923 * *(data-def-stmt stmtsep)
924 * "}")
925 * TODO : 0..1 occurance to be checked in listener
926 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530927 caseStatement : CASE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
928 | descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530929
930 /**
931 * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
932 * (";" /
933 * "{" stmtsep
934 * ;; these stmts can appear in any order
935 * [when-stmt stmtsep]
936 * *(if-feature-stmt stmtsep)
937 * [status-stmt stmtsep]
938 * [description-stmt stmtsep]
939 * [reference-stmt stmtsep]
940 * *(refine-stmt stmtsep)
941 * *(uses-augment-stmt stmtsep)
942 * "}")
943 * TODO : 0..1 occurance to be checked in listener
944 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530945 usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
946 | descriptionStatement | referenceStatement | refineStatement | usesAugmentStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +0530947
948 /**
949 * refine-stmt = refine-keyword sep refine-arg-str optsep
950 * (";" /
951 * "{" stmtsep
952 * (refine-container-stmts /
953 * refine-leaf-stmts /
954 * refine-leaf-list-stmts /
955 * refine-list-stmts /
956 * refine-choice-stmts /
957 * refine-case-stmts /
958 * refine-anyxml-stmts)
959 * "}")
960 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530961 refineStatement : REFINE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE (refineContainerStatements | refineLeafStatements
962 | refineLeafListStatements | refineListStatements | refineChoiceStatements | refineCaseStatements)
Vidyashree Ramada621502016-02-05 22:32:34 +0530963 RIGHT_CURLY_BRACE);
964
965 /**
966 * refine-container-stmts =
967 * ;; these stmts can appear in any order
968 * *(must-stmt stmtsep)
969 * [presence-stmt stmtsep]
970 * [config-stmt stmtsep]
971 * [description-stmt stmtsep]
972 * [reference-stmt stmtsep]
973 * TODO : 0..1 occurance to be checked in listener
974 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530975 refineContainerStatements : (mustStatement | presenceStatement | configStatement | descriptionStatement | referenceStatement)* ;
Vidyashree Ramada621502016-02-05 22:32:34 +0530976
977 /**
978 * refine-leaf-stmts = ;; these stmts can appear in any order
979 * *(must-stmt stmtsep)
980 * [default-stmt stmtsep]
981 * [config-stmt stmtsep]
982 * [mandatory-stmt stmtsep]
983 * [description-stmt stmtsep]
984 * [reference-stmt stmtsep]
985 * TODO : 0..1 occurance to be checked in listener
986 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +0530987 refineLeafStatements : (mustStatement | defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
Vidyashree Ramada621502016-02-05 22:32:34 +0530988
989 /**
990 * refine-leaf-list-stmts =
991 * ;; these stmts can appear in any order
992 * *(must-stmt stmtsep)
993 * [config-stmt stmtsep]
994 * [min-elements-stmt stmtsep]
995 * [max-elements-stmt stmtsep]
996 * [description-stmt stmtsep]
997 * [reference-stmt stmtsep]
998 * TODO : 0..1 occurance to be checked in listener
999 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301000 refineLeafListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
1001 | referenceStatement)*;
Vidyashree Ramada621502016-02-05 22:32:34 +05301002
1003 /**
1004 * refine-list-stmts = ;; these stmts can appear in any order
1005 * *(must-stmt stmtsep)
1006 * [config-stmt stmtsep]
1007 * [min-elements-stmt stmtsep]
1008 * [max-elements-stmt stmtsep]
1009 * [description-stmt stmtsep]
1010 * [reference-stmt stmtsep]
1011 * TODO : 0..1 occurance to be checked in listener
1012 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301013 refineListStatements : (mustStatement | configStatement | minElementsStatement | maxElementsStatement | descriptionStatement
1014 | referenceStatement)*;
Vidyashree Ramada621502016-02-05 22:32:34 +05301015
1016 /**
1017 * refine-choice-stmts = ;; these stmts can appear in any order
1018 * [default-stmt stmtsep]
1019 * [config-stmt stmtsep]
1020 * [mandatory-stmt stmtsep]
1021 * [description-stmt stmtsep]
1022 * [reference-stmt stmtsep]
1023 * TODO : 0..1 occurance to be checked in listener
1024 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301025 refineChoiceStatements : (defaultStatement | configStatement | mandatoryStatement | descriptionStatement | referenceStatement)*;
Vidyashree Ramada621502016-02-05 22:32:34 +05301026
1027 /**
1028 * refine-case-stmts = ;; these stmts can appear in any order
1029 * [description-stmt stmtsep]
1030 * [reference-stmt stmtsep]
1031 *
1032 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301033 refineCaseStatements : (descriptionStatement | referenceStatement)? | (referenceStatement | descriptionStatement)?;
Vidyashree Ramada621502016-02-05 22:32:34 +05301034
1035 /**
1036 * uses-augment-stmt = augment-keyword sep uses-augment-arg-str optsep
1037 * "{" stmtsep
1038 * ;; these stmts can appear in any order
1039 * [when-stmt stmtsep]
1040 * *(if-feature-stmt stmtsep)
1041 * [status-stmt stmtsep]
1042 * [description-stmt stmtsep]
1043 * [reference-stmt stmtsep]
1044 * 1*((data-def-stmt stmtsep) /
1045 * (case-stmt stmtsep))
1046 * "}"
1047 * TODO : 0..1 occurance to be checked in listener
1048 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301049 usesAugmentStatement : AUGMENT_KEYWORD string LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
1050 | descriptionStatement | referenceStatement | dataDefStatement | caseStatement)* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +05301051
1052 /**
1053 * augment-stmt = augment-keyword sep augment-arg-str optsep
1054 * "{" stmtsep
1055 * ;; these stmts can appear in any order
1056 * [when-stmt stmtsep]
1057 * *(if-feature-stmt stmtsep)
1058 * [status-stmt stmtsep]
1059 * [description-stmt stmtsep]
1060 * [reference-stmt stmtsep]
1061 * 1*((data-def-stmt stmtsep) /
1062 * (case-stmt stmtsep))
1063 * "}"
1064 * TODO : 0..1 occurance to be checked in listener
1065 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301066 augmentStatement : AUGMENT_KEYWORD string LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
1067 | descriptionStatement | referenceStatement | dataDefStatement | caseStatement)* RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +05301068
1069 /**
1070 * when-stmt = when-keyword sep string optsep
1071 * (";" /
1072 * "{" stmtsep
1073 * ;; these stmts can appear in any order
1074 * [description-stmt stmtsep]
1075 * [reference-stmt stmtsep]
1076 * "}")
1077 *
1078 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301079 whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE ((descriptionStatement? referenceStatement?)
1080 | (referenceStatement? descriptionStatement?)) RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +05301081
1082 /**
1083 * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
1084 * (";" /
1085 * "{" stmtsep
1086 * ;; these stmts can appear in any order
1087 * *(if-feature-stmt stmtsep)
1088 * [status-stmt stmtsep]
1089 * [description-stmt stmtsep]
1090 * [reference-stmt stmtsep]
1091 * *((typedef-stmt /
1092 * grouping-stmt) stmtsep)
1093 * [input-stmt stmtsep]
1094 * [output-stmt stmtsep]
1095 * "}")
1096 * TODO : 0..1 occurance to be checked in listener
1097 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301098 rpcStatement : RPC_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
1099 | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +05301100
1101 /**
1102 * input-stmt = input-keyword optsep
1103 * "{" stmtsep
1104 * ;; these stmts can appear in any order
1105 * *((typedef-stmt /
1106 * grouping-stmt) stmtsep)
1107 * 1*(data-def-stmt stmtsep)
1108 * "}"
1109 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301110 inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE
1111 ((typedefStatement | groupingStatement)* | dataDefStatement+)
1112 | (dataDefStatement+ | (typedefStatement | groupingStatement)*)RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +05301113
1114 /**
1115 * output-stmt = output-keyword optsep
1116 * "{" stmtsep
1117 * ;; these stmts can appear in any order
1118 * *((typedef-stmt /
1119 * grouping-stmt) stmtsep)
1120 * 1*(data-def-stmt stmtsep)
1121 * "}"
1122 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301123 outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE
1124 ((typedefStatement | groupingStatement)* | dataDefStatement+)
1125 | (dataDefStatement+ | (typedefStatement | groupingStatement)*)RIGHT_CURLY_BRACE;
Vidyashree Ramada621502016-02-05 22:32:34 +05301126
1127 /**
1128 * notification-stmt = notification-keyword sep
1129 * identifier-arg-str optsep
1130 * (";" /
1131 * "{" stmtsep
1132 * ;; these stmts can appear in any order
1133 * *(if-feature-stmt stmtsep)
1134 * [status-stmt stmtsep]
1135 * [description-stmt stmtsep]
1136 * [reference-stmt stmtsep]
1137 * *((typedef-stmt /
1138 * grouping-stmt) stmtsep)
1139 * *(data-def-stmt stmtsep)
1140 * "}")
1141 * TODO : 0..1 occurance to be checked in listener
1142 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301143 notificationStatement : NOTIFICATION_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement
1144 | descriptionStatement | referenceStatement | typedefStatement | groupingStatement | dataDefStatement)*
Vidyashree Ramada621502016-02-05 22:32:34 +05301145 RIGHT_CURLY_BRACE);
1146
1147 /**
1148 * deviation-stmt = deviation-keyword sep
1149 * deviation-arg-str optsep
1150 * "{" stmtsep
1151 * ;; these stmts can appear in any order
1152 * [description-stmt stmtsep]
1153 * [reference-stmt stmtsep]
1154 * (deviate-not-supported-stmt /
1155 * 1*(deviate-add-stmt /
1156 * deviate-replace-stmt /
1157 * deviate-delete-stmt))
1158 * "}"
1159 * TODO : 0..1 occurance to be checked in listener
1160 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301161 deviationStatement: DEVIATION_KEYWORD string LEFT_CURLY_BRACE (descriptionStatement | referenceStatement
1162 | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement | deviateDeleteStatement)*
Vidyashree Ramada621502016-02-05 22:32:34 +05301163 RIGHT_CURLY_BRACE;
1164
1165 /**
1166 * deviate-not-supported-stmt =
1167 * deviate-keyword sep
1168 * not-supported-keyword optsep
1169 * (";" /
1170 * "{" stmtsep
1171 * "}")
1172 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301173 deviateNotSupportedStatement: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND | LEFT_CURLY_BRACE RIGHT_CURLY_BRACE);
Vidyashree Ramada621502016-02-05 22:32:34 +05301174
1175 /**
1176 * deviate-add-stmt = deviate-keyword sep add-keyword optsep
1177 * (";" /
1178 * "{" stmtsep
1179 * [units-stmt stmtsep]
1180 * *(must-stmt stmtsep)
1181 * *(unique-stmt stmtsep)
1182 * [default-stmt stmtsep]
1183 * [config-stmt stmtsep]
1184 * [mandatory-stmt stmtsep]
1185 * [min-elements-stmt stmtsep]
1186 * [max-elements-stmt stmtsep]
1187 * "}")
1188 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301189 deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement*
1190 defaultStatement? configStatement? mandatoryStatement? minElementsStatement? maxElementsStatement?
Vidyashree Ramada621502016-02-05 22:32:34 +05301191 RIGHT_CURLY_BRACE));
1192
1193 /**
1194 * deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
1195 * (";" /
1196 * "{" stmtsep
1197 * [units-stmt stmtsep]
1198 * *(must-stmt stmtsep)
1199 * *(unique-stmt stmtsep)
1200 * [default-stmt stmtsep]
1201 * "}")
1202 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301203 deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
1204 | (LEFT_CURLY_BRACE unitsStatement? mustStatement* uniqueStatement* defaultStatement? RIGHT_CURLY_BRACE));
Vidyashree Ramada621502016-02-05 22:32:34 +05301205
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301206 /**
Vidyashree Ramada621502016-02-05 22:32:34 +05301207 * deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
1208 * (";" /
1209 * "{" stmtsep
1210 * [type-stmt stmtsep]
1211 * [units-stmt stmtsep]
1212 * [default-stmt stmtsep]
1213 * [config-stmt stmtsep]
1214 * [mandatory-stmt stmtsep]
1215 * [min-elements-stmt stmtsep]
1216 * [max-elements-stmt stmtsep]
1217 * "}")
1218 */
Gaurav Agrawal4f8ad172016-02-12 16:17:32 +05301219 deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND | (LEFT_CURLY_BRACE typeStatement? unitsStatement?
1220 defaultStatement? configStatement? mandatoryStatement? minElementsStatement?
1221 maxElementsStatement? RIGHT_CURLY_BRACE));
Vidyashree Ramada621502016-02-05 22:32:34 +05301222
Gaurav Agrawalb5a1c132016-02-21 02:56:46 +05301223 string : STRING (PLUS STRING)*
1224 | IDENTIFIER
1225 | INTEGER;