blob: 7167f7bd48bdd671df2d75c031c7742ceba583c9 [file] [log] [blame]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301/*
Brian O'Connor72b2df22017-08-03 18:48:28 -07002 * Copyright 2016-present Open Networking Foundation
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05303 *
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
Gaurav Agrawala599a8f2017-01-10 20:45:27 +053024 yangfile : moduleStatement EOF
25 | subModuleStatement EOF;
26
27 /**
28 * module-stmt = optsep module-keyword sep identifier-arg-str
29 * optsep
30 * "{" stmtsep
31 * module-header-stmts
32 * linkage-stmts
33 * meta-stmts
34 * revision-stmts
35 * body-stmts
36 * "}" optsep
37 */
38
Vidyashree Rama3c586732017-05-12 19:48:07 +053039 moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE stmtSep
40 moduleBody RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +053041
42 moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
43
44 /**
45 * module-header-stmts = ;; these stmts can appear in any order
46 * [yang-version-stmt stmtsep]
47 * namespace-stmt stmtsep
48 * prefix-stmt stmtsep
49 */
50
Vidyashree Rama3c586732017-05-12 19:48:07 +053051 moduleHeaderStatement : (yangVersionStatement stmtSep)? namespaceStatement stmtSep prefixStatement stmtSep
52 | (yangVersionStatement stmtSep)? prefixStatement stmtSep namespaceStatement stmtSep
53 | namespaceStatement stmtSep (yangVersionStatement stmtSep)? prefixStatement stmtSep
54 | namespaceStatement stmtSep prefixStatement stmtSep (yangVersionStatement stmtSep)?
55 | prefixStatement stmtSep namespaceStatement stmtSep (yangVersionStatement stmtSep)?
56 | prefixStatement stmtSep (yangVersionStatement stmtSep)? namespaceStatement stmtSep
Gaurav Agrawala599a8f2017-01-10 20:45:27 +053057 ;
58
59 /**
60 * linkage-stmts = ;; these stmts can appear in any order
61 * *(import-stmt stmtsep)
62 * *(include-stmt stmtsep)
63 */
Vidyashree Rama3c586732017-05-12 19:48:07 +053064 linkageStatements : (importStatement stmtSep | includeStatement stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +053065
66 /**
67 * meta-stmts = ;; these stmts can appear in any order
68 * [organization-stmt stmtsep]
69 * [contact-stmt stmtsep]
70 * [description-stmt stmtsep]
71 * [reference-stmt stmtsep]
72 */
Vidyashree Rama3c586732017-05-12 19:48:07 +053073 metaStatements : (organizationStatement stmtSep)? (contactStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
74 | (organizationStatement stmtSep)? (contactStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
75 | (organizationStatement stmtSep)? (descriptionStatement stmtSep)? (contactStatement stmtSep)? (referenceStatement stmtSep)?
76 | (organizationStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (contactStatement stmtSep)?
77 | (organizationStatement stmtSep)? (referenceStatement stmtSep)? (contactStatement stmtSep)? (descriptionStatement stmtSep)?
78 | (organizationStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (contactStatement stmtSep)?
79 | (contactStatement stmtSep)? (organizationStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
80 | (contactStatement stmtSep)? (organizationStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
81 | (contactStatement stmtSep)? (referenceStatement stmtSep)? (organizationStatement stmtSep)? (descriptionStatement stmtSep)?
82 | (contactStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (organizationStatement stmtSep)?
83 | (contactStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (organizationStatement stmtSep)?
84 | (contactStatement stmtSep)? (descriptionStatement stmtSep)? (organizationStatement stmtSep)? (referenceStatement stmtSep)?
85 | (referenceStatement stmtSep)? (contactStatement stmtSep)? (organizationStatement stmtSep)? (descriptionStatement stmtSep)?
86 | (referenceStatement stmtSep)? (contactStatement stmtSep)? (descriptionStatement stmtSep)? (organizationStatement stmtSep)?
87 | (referenceStatement stmtSep)? (organizationStatement stmtSep)? (contactStatement stmtSep)? (descriptionStatement stmtSep)?
88 | (referenceStatement stmtSep)? (organizationStatement stmtSep)? (descriptionStatement stmtSep)? (contactStatement stmtSep)?
89 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (organizationStatement stmtSep)? (contactStatement stmtSep)?
90 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (contactStatement stmtSep)? (organizationStatement stmtSep)?
91 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (contactStatement stmtSep)? (organizationStatement stmtSep)?
92 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (organizationStatement stmtSep)? (contactStatement stmtSep)?
93 | (descriptionStatement stmtSep)? (contactStatement stmtSep)? (referenceStatement stmtSep)? (organizationStatement stmtSep)?
94 | (descriptionStatement stmtSep)? (contactStatement stmtSep)? (organizationStatement stmtSep)? (referenceStatement stmtSep)?
95 | (descriptionStatement stmtSep)? (organizationStatement stmtSep)? (contactStatement stmtSep)? (referenceStatement stmtSep)?
96 | (descriptionStatement stmtSep)? (organizationStatement stmtSep)? (referenceStatement stmtSep)? (contactStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +053097 ;
98
99 // revision-stmts = *(revision-stmt stmtsep)
Vidyashree Rama3c586732017-05-12 19:48:07 +0530100 revisionStatements : (revisionStatement stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530101
102 /**
103 * body-stmts = *((extension-stmt /
104 * feature-stmt /
105 * identity-stmt /
106 * typedef-stmt /
107 * grouping-stmt /
108 * data-def-stmt /
109 * augment-stmt /
110 * rpc-stmt /
111 * notification-stmt /
112 * deviation-stmt) stmtsep)
113 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530114 bodyStatements : ((extensionStatement | featureStatement | identityStatement
115 | typedefStatement | groupingStatement | dataDefStatement
116 | augmentStatement | rpcStatement | notificationStatement
117 | deviationStatement | compilerAnnotationStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530118
119 /**
120 * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
121 * optsep stmtend
122 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530123 yangVersionStatement : YANG_VERSION_KEYWORD version stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530124
125 /**
126 * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
127 * For namespace validation TODO in Listener
128 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530129 namespaceStatement : NAMESPACE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530130
131 /**
132 * prefix-stmt = prefix-keyword sep prefix-arg-str
133 * optsep stmtend
134 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530135 prefixStatement : PREFIX_KEYWORD identifier stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530136
137 /**
138 * import-stmt = import-keyword sep identifier-arg-str optsep
139 * "{" stmtsep
140 * prefix-stmt stmtsep
141 * [revision-date-stmt stmtsep]
142 * "}"
143 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530144 importStatement : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE
145 stmtSep importStatementBody RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530146
Vidyashree Rama3c586732017-05-12 19:48:07 +0530147 importStatementBody : prefixStatement stmtSep (revisionDateStatement stmtSep)?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530148
149 // revision-date-stmt = revision-date-keyword sep revision-date stmtend
Vidyashree Rama3c586732017-05-12 19:48:07 +0530150 revisionDateStatement : REVISION_DATE_KEYWORD dateArgumentString stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530151
152 /**
153 * include-stmt = include-keyword sep identifier-arg-str optsep
154 * (";" /
155 * "{" stmtsep
156 * [revision-date-stmt stmtsep]
157 * "}")
158 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530159 includeStatement : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
160 stmtSep (revisionDateStatement stmtSep)? RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530161
162 /**
163 * organization-stmt = organization-keyword sep string
164 * optsep stmtend
165 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530166 organizationStatement : ORGANIZATION_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530167
168 // contact-stmt = contact-keyword sep string optsep stmtend
Vidyashree Rama3c586732017-05-12 19:48:07 +0530169 contactStatement : CONTACT_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530170
171 // description-stmt = description-keyword sep string optsep stmtend
Vidyashree Rama3c586732017-05-12 19:48:07 +0530172 descriptionStatement : DESCRIPTION_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530173
174 // reference-stmt = reference-keyword sep string optsep stmtend
Vidyashree Rama3c586732017-05-12 19:48:07 +0530175 referenceStatement : REFERENCE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530176
177 /**
178 * revision-stmt = revision-keyword sep revision-date optsep
179 * (";" /
180 * "{" stmtsep
181 * [description-stmt stmtsep]
182 * [reference-stmt stmtsep]
183 * "}")
184 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530185 revisionStatement : REVISION_KEYWORD dateArgumentString (STMTEND |
186 LEFT_CURLY_BRACE stmtSep revisionStatementBody RIGHT_CURLY_BRACE);
187 revisionStatementBody : (descriptionStatement stmtSep)?
188 (referenceStatement stmtSep)?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530189
190 /**
191 * submodule-stmt = optsep submodule-keyword sep identifier-arg-str
192 * optsep
193 * "{" stmtsep
194 * submodule-header-stmts
195 * linkage-stmts
196 * meta-stmts
197 * revision-stmts
198 * body-stmts
199 * "}" optsep
200 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530201 subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE
202 stmtSep submoduleBody RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530203 submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
204
205 /** submodule-header-stmts =
206 * ;; these stmts can appear in any order
207 * [yang-version-stmt stmtsep]
208 * belongs-to-stmt stmtsep
209 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530210 submoduleHeaderStatement : (yangVersionStatement stmtSep)? belongstoStatement stmtSep
211 | belongstoStatement stmtSep (yangVersionStatement stmtSep)? ;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530212
213 /**
214 * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
215 * optsep
216 * "{" stmtsep
217 * prefix-stmt stmtsep
218 * "}"
219 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530220 belongstoStatement : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE
221 stmtSep belongstoStatementBody RIGHT_CURLY_BRACE;
222 belongstoStatementBody : prefixStatement stmtSep;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530223
224 /**
225 * extension-stmt = extension-keyword sep identifier-arg-str optsep
226 * (";" /
227 * "{" stmtsep
228 * ;; these stmts can appear in any order
229 * [argument-stmt stmtsep]
230 * [status-stmt stmtsep]
231 * [description-stmt stmtsep]
232 * [reference-stmt stmtsep]
233 * "}")
234 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530235 extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
236 stmtSep extensionBody RIGHT_CURLY_BRACE);
237 extensionBody : (argumentStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
238 | (argumentStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
239 | (argumentStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
240 | (argumentStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
241 | (argumentStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
242 | (argumentStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
243 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (argumentStatement stmtSep)? (descriptionStatement stmtSep)?
244 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (argumentStatement stmtSep)?
245 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (argumentStatement stmtSep)?
246 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (argumentStatement stmtSep)? (referenceStatement stmtSep)?
247 | (statusStatement stmtSep)? (argumentStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
248 | (statusStatement stmtSep)? (argumentStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
249 | (descriptionStatement stmtSep)? (argumentStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
250 | (descriptionStatement stmtSep)? (argumentStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
251 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (argumentStatement stmtSep)? (referenceStatement stmtSep)?
252 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (argumentStatement stmtSep)?
253 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (argumentStatement stmtSep)?
254 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (argumentStatement stmtSep)? (statusStatement stmtSep)?
255 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (argumentStatement stmtSep)? (statusStatement stmtSep)?
256 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (argumentStatement stmtSep)?
257 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (argumentStatement stmtSep)? (descriptionStatement stmtSep)?
258 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (argumentStatement stmtSep)?
259 | (referenceStatement stmtSep)? (argumentStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
260 | (referenceStatement stmtSep)? (argumentStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530261 ;
262
263 /**
264 * argument-stmt = argument-keyword sep identifier-arg-str optsep
265 * (";" /
266 * "{" stmtsep
267 * [yin-element-stmt stmtsep]
268 * "}")
269 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530270 argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
271 stmtSep argumentBody RIGHT_CURLY_BRACE);
272 argumentBody : (yinElementStatement stmtSep)?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530273
274 /**
275 * yin-element-stmt = yin-element-keyword sep yin-element-arg-str
276 * stmtend
277 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530278 yinElementStatement : YIN_ELEMENT_KEYWORD (TRUE_KEYWORD | FALSE_KEYWORD)
279 stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530280
281 /**
282 * identity-stmt = identity-keyword sep identifier-arg-str optsep
283 * (";" /
284 * "{" stmtsep
285 * ;; these stmts can appear in any order
286 * [base-stmt stmtsep]
287 * [status-stmt stmtsep]
288 * [description-stmt stmtsep]
289 * [reference-stmt stmtsep]
290 * "}")
291 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530292 identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
293 stmtSep identityBody RIGHT_CURLY_BRACE);
294 identityBody : (baseStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
295 | (baseStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
296 | (baseStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
297 | (baseStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
298 | (baseStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
299 | (baseStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
300 | (referenceStatement stmtSep)? (baseStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
301 | (referenceStatement stmtSep)? (baseStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
302 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (baseStatement stmtSep)? (descriptionStatement stmtSep)?
303 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (baseStatement stmtSep)?
304 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (baseStatement stmtSep)?
305 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (baseStatement stmtSep)? (statusStatement stmtSep)?
306 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (baseStatement stmtSep)?
307 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (baseStatement stmtSep)? (statusStatement stmtSep)?
308 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (baseStatement stmtSep)? (referenceStatement stmtSep)?
309 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (baseStatement stmtSep)?
310 | (descriptionStatement stmtSep)? (baseStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
311 | (descriptionStatement stmtSep)? (baseStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
312 | (statusStatement stmtSep)? (baseStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
313 | (statusStatement stmtSep)? (baseStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
314 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (baseStatement stmtSep)? (referenceStatement stmtSep)?
315 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (baseStatement stmtSep)?
316 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (baseStatement stmtSep)?
317 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (baseStatement stmtSep)? (descriptionStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530318 ;
319
320 /**
321 * base-stmt = base-keyword sep identifier-ref-arg-str
322 * optsep stmtend*
323 * identifier-ref-arg = [prefix ":"] identifier
324 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530325 baseStatement : BASE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530326
327 /**
328 * feature-stmt = feature-keyword sep identifier-arg-str optsep
329 * (";" /
330 * "{" stmtsep
331 * ;; these stmts can appear in any order
332 * *(if-feature-stmt stmtsep)
333 * [status-stmt stmtsep]
334 * [description-stmt stmtsep]
335 * [reference-stmt stmtsep]
336 * "}")
337 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530338 featureStatement : FEATURE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
339 stmtSep featureBody RIGHT_CURLY_BRACE);
340 featureBody : (ifFeatureStatement stmtSep)* (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
341 | (ifFeatureStatement stmtSep)* (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
342 | (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
343 | (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
344 | (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
345 | (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
346 | (statusStatement stmtSep)? (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
347 | (statusStatement stmtSep)? (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
348 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)?
349 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (ifFeatureStatement stmtSep)*
350 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)?
351 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)*
352 | (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)* (statusStatement stmtSep)? (referenceStatement stmtSep)?
353 | (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)? (statusStatement stmtSep)?
354 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (ifFeatureStatement stmtSep)* (referenceStatement stmtSep)?
355 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (ifFeatureStatement stmtSep)*
356 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)* (statusStatement stmtSep)? (ifFeatureStatement stmtSep)*
357 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)* (ifFeatureStatement stmtSep)? (statusStatement stmtSep)?
358 | (referenceStatement stmtSep)? (ifFeatureStatement stmtSep)* (statusStatement stmtSep)? (descriptionStatement stmtSep)?
359 | (referenceStatement stmtSep)? (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)? (statusStatement stmtSep)?
360 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (ifFeatureStatement stmtSep)*
361 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)* (statusStatement stmtSep)?
362 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (ifFeatureStatement stmtSep)*
363 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (ifFeatureStatement stmtSep)* (descriptionStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530364 ;
365
366 /**
367 * data-def-stmt = container-stmt /
368 * leaf-stmt /
369 * leaf-list-stmt /
370 * list-stmt /
371 * choice-stmt /
372 * anyxml-stmt /
373 * uses-stmt
374 */
375 dataDefStatement : containerStatement
376 | leafStatement
377 | leafListStatement
378 | listStatement
379 | choiceStatement
380 | anyxmlStatement
381 | usesStatement;
382
383 /**
384 * if-feature-stmt = if-feature-keyword sep identifier-ref-arg-str
385 * optsep stmtend
386 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530387 ifFeatureStatement : IF_FEATURE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530388
389 /**
390 * units-stmt = units-keyword sep string optsep stmtend
391 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530392 unitsStatement : UNITS_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530393
394 /**
395 * typedef-stmt = typedef-keyword sep identifier-arg-str optsep
396 * "{" stmtsep
397 * ;; these stmts can appear in any order
398 * type-stmt stmtsep
399 * [units-stmt stmtsep]
400 * [default-stmt stmtsep]
401 * [status-stmt stmtsep]
402 * [description-stmt stmtsep]
403 * [reference-stmt stmtsep]
404 * "}"
405 * TODO : 0..1 occurance to be validated in listener
406 */
407 typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
Vidyashree Rama3c586732017-05-12 19:48:07 +0530408 stmtSep ((typeStatement stmtSep) | (unitsStatement stmtSep)
409 | (defaultStatement stmtSep) | (statusStatement stmtSep)
410 | (descriptionStatement stmtSep) | (referenceStatement stmtSep))*
411 RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530412
413 /**
414 * type-stmt = type-keyword sep identifier-ref-arg-str optsep
415 * (";" /
416 * "{" stmtsep
417 * type-body-stmts
418 * "}")
419 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530420 typeStatement : TYPE_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
421 stmtSep typeBodyStatements RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530422
423 /**
424 * type-body-stmts = numerical-restrictions /
425 * decimal64-specification /
426 * string-restrictions /
427 * enum-specification /
428 * leafref-specification /
429 * identityref-specification /
430 * instance-identifier-specification /
431 * bits-specification /
432 * union-specification
433 *
434 */
435 typeBodyStatements : numericalRestrictions | decimal64Specification | stringRestrictions | enumSpecification
436 | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification
437 | bitsSpecification | unionSpecification;
438
439 /**
440 * decimal64-specification = ;; these stmts can appear in any order
441 * fraction-digits-stmt
442 * [range-stmt]
443 */
444 decimal64Specification : fractionDigitStatement rangeStatement?;
445
446 /**
447 * fraction-digits-stmt = fraction-digits-keyword sep
448 * fraction-digits-arg-str stmtend
449 *
450 * fraction-digits-arg-str = < a string that matches the rule
451 * fraction-digits-arg >
452 *
453 * fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
454 * "5" / "6" / "7" / "8"])
455 * / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
456 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530457 fractionDigitStatement : FRACTION_DIGITS_KEYWORD fraction stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530458
459 /**
460 * numerical-restrictions = range-stmt stmtsep
461 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530462 numericalRestrictions : rangeStatement stmtSep;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530463
464 /**
465 * range-stmt = range-keyword sep range-arg-str optsep
466 * (";" /
467 * "{" stmtsep
468 * ;; these stmts can appear in any order
469 * [error-message-stmt stmtsep]
470 * [error-app-tag-stmt stmtsep]
471 * [description-stmt stmtsep]
472 * [reference-stmt stmtsep]
473 * "}")
474 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530475 rangeStatement : RANGE_KEYWORD range (STMTEND | LEFT_CURLY_BRACE
476 stmtSep commonStatements RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530477
Vidyashree Rama3c586732017-05-12 19:48:07 +0530478 commonStatements : (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
479 | (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
480 | (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)?
481 | (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)?
482 | (errorMessageStatement stmtSep)? (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)?
483 | (errorMessageStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)?
484 | (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
485 | (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
486 | (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (errorMessageStatement stmtSep)?
487 | (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)? (referenceStatement stmtSep)?
488 | (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)? (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)?
489 | (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)?
490 | (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)?
491 | (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)? (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)?
492 | (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)? (referenceStatement stmtSep)?
493 | (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)? (referenceStatement stmtSep)? (errorMessageStatement stmtSep)?
494 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)?
495 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)?
496 | (referenceStatement stmtSep)? (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)?
497 | (referenceStatement stmtSep)? (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)?
498 | (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)? (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)?
499 | (referenceStatement stmtSep)? (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)? (descriptionStatement stmtSep)?
500 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (errorMessageStatement stmtSep)? (errorAppTagStatement stmtSep)?
501 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (errorAppTagStatement stmtSep)? (errorMessageStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530502 ;
503
504 /**
505 * string-restrictions = ;; these stmts can appear in any order
506 * [length-stmt stmtsep]
507 * *(pattern-stmt stmtsep)
508 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530509 stringRestrictions : ((lengthStatement stmtSep)? (patternStatement stmtSep)*)
510 | ((patternStatement stmtSep)* (lengthStatement stmtSep)?);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530511
512 /**
513 * length-stmt = length-keyword sep length-arg-str optsep
514 * (";" /
515 * "{" stmtsep
516 * ;; these stmts can appear in any order
517 * [error-message-stmt stmtsep]
518 * [error-app-tag-stmt stmtsep]
519 * [description-stmt stmtsep]
520 * [reference-stmt stmtsep]
521 * "}")
522 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530523 lengthStatement : LENGTH_KEYWORD length (STMTEND | LEFT_CURLY_BRACE
524 stmtSep commonStatements RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530525
526 /**
527 * pattern-stmt = pattern-keyword sep string optsep
528 * (";" /
529 * "{" stmtsep
530 * ;; these stmts can appear in any order
531 * [error-message-stmt stmtsep]
532 * [error-app-tag-stmt stmtsep]
533 * [description-stmt stmtsep]
534 * [reference-stmt stmtsep]
535 * "}")
536 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530537 patternStatement : PATTERN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
538 stmtSep commonStatements RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530539
540 /**
541 * default-stmt = default-keyword sep string stmtend
542 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530543 defaultStatement : DEFAULT_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530544
545 /**
546 * enum-specification = 1*(enum-stmt stmtsep)
547 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530548 enumSpecification : (enumStatement stmtSep)+;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530549
550 /**
551 * enum-stmt = enum-keyword sep string optsep
552 * (";" /
553 * "{" stmtsep
554 * ;; these stmts can appear in any order
555 * [value-stmt stmtsep]
556 * [status-stmt stmtsep]
557 * [description-stmt stmtsep]
558 * [reference-stmt stmtsep]
559 * "}")
560 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530561 enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
562 stmtSep enumStatementBody RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530563
Vidyashree Rama3c586732017-05-12 19:48:07 +0530564 enumStatementBody : (valueStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
565 | (valueStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
566 | (valueStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
567 | (valueStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
568 | (valueStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
569 | (valueStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
570 | (statusStatement stmtSep)? (valueStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
571 | (statusStatement stmtSep)? (valueStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
572 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (valueStatement stmtSep)?
573 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (valueStatement stmtSep)? (referenceStatement stmtSep)?
574 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (valueStatement stmtSep)? (descriptionStatement stmtSep)?
575 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (valueStatement stmtSep)?
576 | (descriptionStatement stmtSep)? (valueStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
577 | (descriptionStatement stmtSep)? (valueStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
578 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (valueStatement stmtSep)? (referenceStatement stmtSep)?
579 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (valueStatement stmtSep)?
580 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (valueStatement stmtSep)? (statusStatement stmtSep)?
581 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (valueStatement stmtSep)?
582 | (referenceStatement stmtSep)? (valueStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
583 | (referenceStatement stmtSep)? (valueStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
584 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (valueStatement stmtSep)?
585 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (valueStatement stmtSep)? (descriptionStatement stmtSep)?
586 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (valueStatement stmtSep)? (statusStatement stmtSep)?
587 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (valueStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530588 ;
589
590 /**
591 * leafref-specification =
592 * ;; these stmts can appear in any order
593 * path-stmt stmtsep
594 * [require-instance-stmt stmtsep]
595 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530596 leafrefSpecification : (pathStatement stmtSep (requireInstanceStatement stmtSep)?)
597 | ((requireInstanceStatement stmtSep)? pathStatement stmtSep);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530598
599 /**
600 * path-stmt = path-keyword sep path-arg-str stmtend
601 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530602 pathStatement : PATH_KEYWORD path stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530603
604 /**
605 * require-instance-stmt = require-instance-keyword sep
606 * require-instance-arg-str stmtend
607 * require-instance-arg-str = < a string that matches the rule
608 * require-instance-arg >
609 * require-instance-arg = true-keyword / false-keyword
610 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530611 requireInstanceStatement : REQUIRE_INSTANCE_KEYWORD requireInstance stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530612
613 /**
614 * instance-identifier-specification =
615 * [require-instance-stmt stmtsep]
616 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530617 instanceIdentifierSpecification : (requireInstanceStatement stmtSep)?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530618
619 /**
620 * identityref-specification =
621 * base-stmt stmtsep
622 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530623 identityrefSpecification : baseStatement stmtSep;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530624
625 /**
626 * union-specification = 1*(type-stmt stmtsep)
627 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530628 unionSpecification : (typeStatement stmtSep)+;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530629
630 /**
631 * bits-specification = 1*(bit-stmt stmtsep)
632 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530633 bitsSpecification : (bitStatement stmtSep)+;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530634
635 /**
636 * bit-stmt = bit-keyword sep identifier-arg-str optsep
637 * (";" /
638 * "{" stmtsep
639 * ;; these stmts can appear in any order
640 * [position-stmt stmtsep]
641 * [status-stmt stmtsep]
642 * [description-stmt stmtsep]
643 * [reference-stmt stmtsep]
644 * "}"
645 * "}")
646 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530647 bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
648 stmtSep bitBodyStatement RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530649
Vidyashree Rama3c586732017-05-12 19:48:07 +0530650 bitBodyStatement : (positionStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
651 | (positionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
652 | (positionStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
653 | (positionStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
654 | (positionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
655 | (positionStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
656 | (statusStatement stmtSep)? (positionStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)?
657 | (statusStatement stmtSep)? (positionStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)?
658 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (positionStatement stmtSep)?
659 | (statusStatement stmtSep)? (descriptionStatement stmtSep)? (positionStatement stmtSep)? (referenceStatement stmtSep)?
660 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (positionStatement stmtSep)? (descriptionStatement stmtSep)?
661 | (statusStatement stmtSep)? (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (positionStatement stmtSep)?
662 | (descriptionStatement stmtSep)? (positionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)?
663 | (descriptionStatement stmtSep)? (positionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)?
664 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (positionStatement stmtSep)? (referenceStatement stmtSep)?
665 | (descriptionStatement stmtSep)? (statusStatement stmtSep)? (referenceStatement stmtSep)? (positionStatement stmtSep)?
666 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (positionStatement stmtSep)? (statusStatement stmtSep)?
667 | (descriptionStatement stmtSep)? (referenceStatement stmtSep)? (statusStatement stmtSep)? (positionStatement stmtSep)?
668 | (referenceStatement stmtSep)? (positionStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)?
669 | (referenceStatement stmtSep)? (positionStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)?
670 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (descriptionStatement stmtSep)? (positionStatement stmtSep)?
671 | (referenceStatement stmtSep)? (statusStatement stmtSep)? (positionStatement stmtSep)? (descriptionStatement stmtSep)?
672 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (positionStatement stmtSep)? (statusStatement stmtSep)?
673 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)? (statusStatement stmtSep)? (positionStatement stmtSep)?
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530674 ;
675
676 /**
677 * position-stmt = position-keyword sep
678 * position-value-arg-str stmtend
679 * position-value-arg-str = < a string that matches the rule
680 * position-value-arg >
681 * position-value-arg = non-negative-integer-value
682 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530683 positionStatement : POSITION_KEYWORD position stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530684
685 /**
686 * status-stmt = status-keyword sep status-arg-str stmtend
687 * status-arg-str = < a string that matches the rule
688 * status-arg >
689 * status-arg = current-keyword /
690 * obsolete-keyword /
691 * deprecated-keyword
692 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530693 statusStatement : STATUS_KEYWORD status stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530694
695 /**
696 * config-stmt = config-keyword sep
697 * config-arg-str stmtend
698 * config-arg-str = < a string that matches the rule
699 * config-arg >
700 * config-arg = true-keyword / false-keyword
701 */
702 configStatement : CONFIG_KEYWORD config STMTEND;
703
704 /**
705 * mandatory-stmt = mandatory-keyword sep
706 * mandatory-arg-str stmtend
707 *
708 * mandatory-arg-str = < a string that matches the rule
709 * mandatory-arg >
710 *
711 * mandatory-arg = true-keyword / false-keyword
712 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530713 mandatoryStatement : MANDATORY_KEYWORD mandatory stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530714
715 /**
716 * presence-stmt = presence-keyword sep string stmtend
717 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530718 presenceStatement : PRESENCE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530719
720 /**
721 * ordered-by-stmt = ordered-by-keyword sep
722 * ordered-by-arg-str stmtend
723 *
724 * ordered-by-arg-str = < a string that matches the rule
725 * ordered-by-arg >
726 *
727 * ordered-by-arg = user-keyword / system-keyword
728 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530729 orderedByStatement : ORDERED_BY_KEYWORD orderedBy stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530730
731 /**
732 * must-stmt = must-keyword sep string optsep
733 * (";" /
734 * "{" stmtsep
735 * ;; these stmts can appear in any order
736 * [error-message-stmt stmtsep]
737 * [error-app-tag-stmt stmtsep]
738 * [description-stmt stmtsep]
739 * [reference-stmt stmtsep]
740 * "}")
741 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530742 mustStatement : MUST_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
743 stmtSep commonStatements RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530744
745 /**
746 * error-message-stmt = error-message-keyword sep string stmtend
747 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530748 errorMessageStatement : ERROR_MESSAGE_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530749
750 /**
751 * error-app-tag-stmt = error-app-tag-keyword sep string stmtend
752 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530753 errorAppTagStatement : ERROR_APP_TAG_KEYWORD string stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530754
755 /**
756 * min-elements-stmt = min-elements-keyword sep
757 * min-value-arg-str stmtend
758 * min-value-arg-str = < a string that matches the rule
759 * min-value-arg >
760 * min-value-arg = non-negative-integer-value
761 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530762 minElementsStatement : MIN_ELEMENTS_KEYWORD minValue stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530763
764 /**
765 * max-elements-stmt = max-elements-keyword sep
766 * max-value-arg-str stmtend
767 * max-value-arg-str = < a string that matches the rule
768 * max-value-arg >
769 * max-value-arg = unbounded-keyword /
770 * positive-integer-value
771 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530772 maxElementsStatement : MAX_ELEMENTS_KEYWORD maxValue stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530773
774 /**
775 * value-stmt = value-keyword sep integer-value stmtend
776 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530777 valueStatement : VALUE_KEYWORD value stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530778
779 /**
780 * grouping-stmt = grouping-keyword sep identifier-arg-str optsep
781 * (";" /
782 * "{" stmtsep
783 * ;; these stmts can appear in any order
784 * [status-stmt stmtsep]
785 * [description-stmt stmtsep]
786 * [reference-stmt stmtsep]
787 * *((typedef-stmt /
788 * grouping-stmt) stmtsep)
789 * *(data-def-stmt stmtsep)
790 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530791 */
792 groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
Vidyashree Rama3c586732017-05-12 19:48:07 +0530793 stmtSep ((statusStatement | descriptionStatement
794 | referenceStatement | typedefStatement | groupingStatement
795 | dataDefStatement) stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530796
797 /**
798 * container-stmt = container-keyword sep identifier-arg-str optsep
799 * (";" /
800 * "{" stmtsep
801 * ;; these stmts can appear in any order
802 * [when-stmt stmtsep]
803 * *(if-feature-stmt stmtsep)
804 * *(must-stmt stmtsep)
805 * [presence-stmt stmtsep]
806 * [config-stmt stmtsep]
807 * [status-stmt stmtsep]
808 * [description-stmt stmtsep]
809 * [reference-stmt stmtsep]
810 * *((typedef-stmt /
811 * grouping-stmt) stmtsep)
812 * *(data-def-stmt stmtsep)
Sean Condon6b3a6452016-12-07 17:47:00 +0000813 * [default-deny-write-stmt stmtsep]
814 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530815 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530816 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530817 containerStatement : CONTAINER_KEYWORD identifier (STMTEND |
818 LEFT_CURLY_BRACE stmtSep ((whenStatement | ifFeatureStatement
819 | mustStatement | presenceStatement | configStatement
820 | statusStatement | descriptionStatement | referenceStatement
821 | typedefStatement | groupingStatement | dataDefStatement
822 | defaultDenyWriteStatement | defaultDenyAllStatement) stmtSep)*
823 RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530824
825 /**
826 * leaf-stmt = leaf-keyword sep identifier-arg-str optsep
827 * "{" stmtsep
828 * ;; these stmts can appear in any order
829 * [when-stmt stmtsep]
830 * *(if-feature-stmt stmtsep)
831 * type-stmt stmtsep
832 * [units-stmt stmtsep]
833 * *(must-stmt stmtsep)
834 * [default-stmt stmtsep]
835 * [config-stmt stmtsep]
836 * [mandatory-stmt stmtsep]
837 * [status-stmt stmtsep]
838 * [description-stmt stmtsep]
839 * [reference-stmt stmtsep]
Sean Condon6b3a6452016-12-07 17:47:00 +0000840 * [default-deny-write-stmt stmtsep]
841 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530842 * "}"
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530843 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530844 leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE stmtSep
845 ((whenStatement | ifFeatureStatement | typeStatement
846 | unitsStatement | mustStatement | defaultStatement
847 | configStatement | mandatoryStatement | statusStatement
848 | descriptionStatement | referenceStatement
849 | defaultDenyWriteStatement | defaultDenyAllStatement) stmtSep)*
850 RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530851
852 /**
853 * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep
854 * "{" stmtsep
855 * ;; these stmts can appear in any order
856 * [when-stmt stmtsep]
857 * *(if-feature-stmt stmtsep)
858 * type-stmt stmtsep
859 * [units-stmt stmtsep]
860 * *(must-stmt stmtsep)
861 * [config-stmt stmtsep]
862 * [min-elements-stmt stmtsep]
863 * [max-elements-stmt stmtsep]
864 * [ordered-by-stmt stmtsep]
865 * [status-stmt stmtsep]
866 * [description-stmt stmtsep]
867 * [reference-stmt stmtsep]
Sean Condon6b3a6452016-12-07 17:47:00 +0000868 * [default-deny-write-stmt stmtsep]
869 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530870 * "}"
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530871 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530872 leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE stmtSep
873 ((whenStatement | ifFeatureStatement | typeStatement
874 | unitsStatement | mustStatement | configStatement
875 | minElementsStatement | maxElementsStatement | orderedByStatement
876 | statusStatement | descriptionStatement | referenceStatement
877 | defaultDenyWriteStatement | defaultDenyAllStatement) stmtSep)*
878 RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530879
880 /**
881 * list-stmt = list-keyword sep identifier-arg-str optsep
882 * "{" stmtsep
883 * ;; these stmts can appear in any order
884 * [when-stmt stmtsep]
885 * *(if-feature-stmt stmtsep)
886 * *(must-stmt stmtsep)
887 * [key-stmt stmtsep]
888 * *(unique-stmt stmtsep)
889 * [config-stmt stmtsep]
890 * [min-elements-stmt stmtsep]
891 * [max-elements-stmt stmtsep]
892 * [ordered-by-stmt stmtsep]
893 * [status-stmt stmtsep]
894 * [description-stmt stmtsep]
895 * [reference-stmt stmtsep]
Sean Condon6b3a6452016-12-07 17:47:00 +0000896 * [default-deny-write-stmt stmtsep]
897 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530898 * *((typedef-stmt /
899 * grouping-stmt) stmtsep)
900 * 1*(data-def-stmt stmtsep)
901 * "}"
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530902 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530903 listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE stmtSep
904 ((whenStatement | ifFeatureStatement | mustStatement | keyStatement
905 | uniqueStatement | configStatement | minElementsStatement
906 | maxElementsStatement | orderedByStatement | statusStatement
907 | descriptionStatement | referenceStatement | defaultDenyWriteStatement
908 | defaultDenyAllStatement | typedefStatement | groupingStatement|
909 dataDefStatement) stmtSep)* RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530910
911 /**
912 * key-stmt = key-keyword sep key-arg-str stmtend
913 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530914 keyStatement : KEY_KEYWORD key stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530915
916 /**
917 * unique-stmt = unique-keyword sep unique-arg-str stmtend
918 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530919 uniqueStatement: UNIQUE_KEYWORD unique stmtEnd;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530920
921 /**
922 * choice-stmt = choice-keyword sep identifier-arg-str optsep
923 * (";" /
924 * "{" stmtsep
925 * ;; these stmts can appear in any order
926 * [when-stmt stmtsep]
927 * *(if-feature-stmt stmtsep)
928 * [default-stmt stmtsep]
929 * [config-stmt stmtsep]
930 * [mandatory-stmt stmtsep]
931 * [status-stmt stmtsep]
932 * [description-stmt stmtsep]
933 * [reference-stmt stmtsep]
934 * *((short-case-stmt / case-stmt) stmtsep)
Vidyashree Rama3c586732017-05-12 19:48:07 +0530935 * [default-deny-write-stmt stmtsep]
936 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530937 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530938 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530939 choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
940 stmtSep ((whenStatement | ifFeatureStatement | defaultStatement
941 | configStatement | mandatoryStatement | statusStatement
942 | descriptionStatement | referenceStatement | shortCaseStatement
943 | caseStatement | defaultDenyAllStatement
944 | defaultDenyWriteStatement) stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530945
946 /**
947 * short-case-stmt = container-stmt /
948 * leaf-stmt /
949 * leaf-list-stmt /
950 * list-stmt /
951 * anyxml-stmt
952 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530953 shortCaseStatement : containerStatement | leafStatement | leafListStatement
954 | listStatement | anyxmlStatement;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530955
956 /**
957 * case-stmt = case-keyword sep identifier-arg-str optsep
958 * (";" /
959 * "{" stmtsep
960 * ;; these stmts can appear in any order
961 * [when-stmt stmtsep]
962 * *(if-feature-stmt stmtsep)
963 * [status-stmt stmtsep]
964 * [description-stmt stmtsep]
965 * [reference-stmt stmtsep]
966 * *(data-def-stmt stmtsep)
967 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530968 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530969 caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE stmtSep
970 ((whenStatement | ifFeatureStatement | statusStatement
971 | descriptionStatement | referenceStatement | dataDefStatement)
972 stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530973
974 /**
975 * anyxml-stmt = anyxml-keyword sep identifier-arg-str optsep
976 * (";" /
977 * "{" stmtsep
978 * ;; these stmts can appear in any order
979 * [when-stmt stmtsep]
980 * *(if-feature-stmt stmtsep)
981 * *(must-stmt stmtsep)
982 * [config-stmt stmtsep]
983 * [mandatory-stmt stmtsep]
984 * [status-stmt stmtsep]
985 * [description-stmt stmtsep]
986 * [reference-stmt stmtsep]
Vidyashree Rama3c586732017-05-12 19:48:07 +0530987 * [default-deny-write-stmt stmtsep]
988 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530989 * "}")
990 */
Vidyashree Rama3c586732017-05-12 19:48:07 +0530991 anyxmlStatement : ANYXML_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
992 stmtSep ((whenStatement | ifFeatureStatement | mustStatement
993 | configStatement | mandatoryStatement | statusStatement
994 | descriptionStatement | referenceStatement
995 | defaultDenyWriteStatement | defaultDenyAllStatement) stmtSep)*
996 RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +0530997
998 /**
999 * uses-stmt = uses-keyword sep identifier-ref-arg-str optsep
1000 * (";" /
1001 * "{" stmtsep
1002 * ;; these stmts can appear in any order
1003 * [when-stmt stmtsep]
1004 * *(if-feature-stmt stmtsep)
1005 * [status-stmt stmtsep]
1006 * [description-stmt stmtsep]
1007 * [reference-stmt stmtsep]
1008 * *(refine-stmt stmtsep)
1009 * *(uses-augment-stmt stmtsep)
Vidyashree Rama3c586732017-05-12 19:48:07 +05301010 * [default-deny-write-stmt stmtsep]
1011 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301012 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301013 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301014 usesStatement : USES_KEYWORD string (STMTEND | LEFT_CURLY_BRACE
1015 stmtSep ((whenStatement | ifFeatureStatement | statusStatement
1016 | descriptionStatement | referenceStatement | refineStatement
1017 | augmentStatement | defaultDenyAllStatement
1018 | defaultDenyWriteStatement) stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301019
1020 /**
1021 * refine-stmt = refine-keyword sep refine-arg-str optsep
1022 * (";" /
1023 * "{" stmtsep
1024 * (refine-container-stmts /
1025 * refine-leaf-stmts /
1026 * refine-leaf-list-stmts /
1027 * refine-list-stmts /
1028 * refine-choice-stmts /
1029 * refine-case-stmts /
1030 * refine-anyxml-stmts)
1031 * "}")
1032 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301033 refineStatement : REFINE_KEYWORD refine (STMTEND | LEFT_CURLY_BRACE
1034 stmtSep (refineContainerStatements | refineLeafStatements
1035 | refineLeafListStatements | refineListStatements
1036 | refineChoiceStatements | refineCaseStatements
1037 | refineAnyxmlStatements) RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301038
1039 /**
1040 * refine-container-stmts =
1041 * ;; these stmts can appear in any order
1042 * *(must-stmt stmtsep)
1043 * [presence-stmt stmtsep]
1044 * [config-stmt stmtsep]
1045 * [description-stmt stmtsep]
1046 * [reference-stmt stmtsep]
1047 * TODO : 0..1 occurance to be checked in listener
1048 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301049 refineContainerStatements : ((mustStatement | presenceStatement
1050 | configStatement | descriptionStatement stmtSep
1051 | referenceStatement) stmtSep)* ;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301052
1053 /**
1054 * refine-leaf-stmts = ;; these stmts can appear in any order
1055 * *(must-stmt stmtsep)
1056 * [default-stmt stmtsep]
1057 * [config-stmt stmtsep]
1058 * [mandatory-stmt stmtsep]
1059 * [description-stmt stmtsep]
1060 * [reference-stmt stmtsep]
1061 * TODO : 0..1 occurance to be checked in listener
1062 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301063 refineLeafStatements : ((mustStatement | defaultStatement
1064 | configStatement | mandatoryStatement | descriptionStatement
1065 | referenceStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301066
1067 /**
1068 * refine-leaf-list-stmts =
1069 * ;; these stmts can appear in any order
1070 * *(must-stmt stmtsep)
1071 * [config-stmt stmtsep]
1072 * [min-elements-stmt stmtsep]
1073 * [max-elements-stmt stmtsep]
1074 * [description-stmt stmtsep]
1075 * [reference-stmt stmtsep]
1076 * TODO : 0..1 occurance to be checked in listener
1077 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301078 refineLeafListStatements : ((mustStatement | configStatement
1079 | minElementsStatement | maxElementsStatement
1080 | descriptionStatement | referenceStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301081
1082 /**
1083 * refine-list-stmts = ;; these stmts can appear in any order
1084 * *(must-stmt stmtsep)
1085 * [config-stmt stmtsep]
1086 * [min-elements-stmt stmtsep]
1087 * [max-elements-stmt stmtsep]
1088 * [description-stmt stmtsep]
1089 * [reference-stmt stmtsep]
1090 * TODO : 0..1 occurance to be checked in listener
1091 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301092 refineListStatements : ((mustStatement | configStatement
1093 | minElementsStatement | maxElementsStatement
1094 | descriptionStatement | referenceStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301095
1096 /**
1097 * refine-choice-stmts = ;; these stmts can appear in any order
1098 * [default-stmt stmtsep]
1099 * [config-stmt stmtsep]
1100 * [mandatory-stmt stmtsep]
1101 * [description-stmt stmtsep]
1102 * [reference-stmt stmtsep]
1103 * TODO : 0..1 occurance to be checked in listener
1104 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301105 refineChoiceStatements : ((defaultStatement | configStatement
1106 | mandatoryStatement | descriptionStatement
1107 | referenceStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301108
1109 /**
1110 * refine-case-stmts = ;; these stmts can appear in any order
1111 * [description-stmt stmtsep]
1112 * [reference-stmt stmtsep]
1113 *
1114 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301115 refineCaseStatements : ((descriptionStatement stmtSep)
1116 | (referenceStatement stmtSep))? | ((referenceStatement stmtSep)
1117 | (descriptionStatement stmtSep))?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301118
1119 /**
1120 * refine-anyxml-stmts = ;; these stmts can appear in any order
1121 * *(must-stmt stmtsep)
1122 * [config-stmt stmtsep]
1123 * [mandatory-stmt stmtsep]
1124 * [description-stmt stmtsep]
1125 * [reference-stmt stmtsep]
1126 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301127 refineAnyxmlStatements : ((mustStatement | configStatement
1128 | mandatoryStatement | descriptionStatement
1129 | referenceStatement) stmtSep)*;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301130
1131 /**
1132 * augment-stmt = augment-keyword sep augment-arg-str optsep
1133 * "{" stmtsep
1134 * ;; these stmts can appear in any order
1135 * [when-stmt stmtsep]
1136 * *(if-feature-stmt stmtsep)
1137 * [status-stmt stmtsep]
1138 * [description-stmt stmtsep]
1139 * [reference-stmt stmtsep]
1140 * 1*((data-def-stmt stmtsep) /
1141 * (case-stmt stmtsep))
1142 * "}"
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301143 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301144 augmentStatement : AUGMENT_KEYWORD augment LEFT_CURLY_BRACE stmtSep
1145 ((whenStatement | ifFeatureStatement | statusStatement
1146 | descriptionStatement | referenceStatement
1147 | dataDefStatement | caseStatement) stmtSep)* RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301148
1149 /**
1150 * when-stmt = when-keyword sep string optsep
1151 * (";" /
1152 * "{" stmtsep
1153 * ;; these stmts can appear in any order
1154 * [description-stmt stmtsep]
1155 * [reference-stmt stmtsep]
1156 * "}")
1157 *
1158 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301159 whenStatement : WHEN_KEYWORD string (STMTEND | LEFT_CURLY_BRACE stmtSep
1160 ((descriptionStatement stmtSep)? (referenceStatement stmtSep)?
1161 | (referenceStatement stmtSep)? (descriptionStatement stmtSep)?)
1162 RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301163
1164 /**
1165 * rpc-stmt = rpc-keyword sep identifier-arg-str optsep
1166 * (";" /
1167 * "{" stmtsep
1168 * ;; these stmts can appear in any order
1169 * *(if-feature-stmt stmtsep)
1170 * [status-stmt stmtsep]
1171 * [description-stmt stmtsep]
1172 * [reference-stmt stmtsep]
1173 * *((typedef-stmt /
1174 * grouping-stmt) stmtsep)
1175 * [input-stmt stmtsep]
1176 * [output-stmt stmtsep]
Sean Condon6b3a6452016-12-07 17:47:00 +00001177 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301178 * "}")
1179 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301180 rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE stmtSep
1181 ((ifFeatureStatement | statusStatement | descriptionStatement
1182 | referenceStatement | typedefStatement | groupingStatement
1183 | inputStatement | outputStatement | defaultDenyAllStatement)
1184 stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301185
1186 /**
1187 * input-stmt = input-keyword optsep
1188 * "{" stmtsep
1189 * ;; these stmts can appear in any order
1190 * *((typedef-stmt /
1191 * grouping-stmt) stmtsep)
1192 * 1*(data-def-stmt stmtsep)
1193 * "}"
1194 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301195 inputStatement : INPUT_KEYWORD LEFT_CURLY_BRACE stmtSep ((typedefStatement
1196 | groupingStatement | dataDefStatement) stmtSep)* RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301197
1198 /**
1199 * output-stmt = output-keyword optsep
1200 * "{" stmtsep
1201 * ;; these stmts can appear in any order
1202 * *((typedef-stmt /
1203 * grouping-stmt) stmtsep)
1204 * 1*(data-def-stmt stmtsep)
1205 * "}"
1206 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301207 outputStatement : OUTPUT_KEYWORD LEFT_CURLY_BRACE stmtSep ((typedefStatement
1208 | groupingStatement | dataDefStatement) stmtSep)* RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301209
1210 /**
1211 * notification-stmt = notification-keyword sep
1212 * identifier-arg-str optsep
1213 * (";" /
1214 * "{" stmtsep
1215 * ;; these stmts can appear in any order
1216 * *(if-feature-stmt stmtsep)
1217 * [status-stmt stmtsep]
1218 * [description-stmt stmtsep]
1219 * [reference-stmt stmtsep]
Sean Condon6b3a6452016-12-07 17:47:00 +00001220 * [default-deny-all-stmt stmtsep]
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301221 * *((typedef-stmt /
1222 * grouping-stmt) stmtsep)
1223 * *(data-def-stmt stmtsep)
1224 * "}")
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301225 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301226 notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | stmtSep
1227 LEFT_CURLY_BRACE ((ifFeatureStatement | statusStatement
1228 | descriptionStatement | referenceStatement | typedefStatement
1229 | defaultDenyAllStatement | groupingStatement | dataDefStatement)
1230 stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301231
1232 /**
1233 * deviation-stmt = deviation-keyword sep
1234 * deviation-arg-str optsep
1235 * "{" stmtsep
1236 * ;; these stmts can appear in any order
1237 * [description-stmt stmtsep]
1238 * [reference-stmt stmtsep]
1239 * (deviate-not-supported-stmt /
1240 * 1*(deviate-add-stmt /
1241 * deviate-replace-stmt /
1242 * deviate-delete-stmt))
1243 * "}"
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301244 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301245 deviationStatement: DEVIATION_KEYWORD deviation LEFT_CURLY_BRACE stmtSep
1246 ((descriptionStatement stmtSep) | (referenceStatement stmtSep)
1247 | deviateNotSupportedStatement | deviateAddStatement | deviateReplaceStatement
1248 | deviateDeleteStatement)* RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301249
1250 /**
1251 * deviate-not-supported-stmt =
1252 * deviate-keyword sep
1253 * not-supported-keyword optsep
1254 * (";" /
1255 * "{" stmtsep
1256 * "}")
1257 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301258 deviateNotSupportedStatement: DEVIATE_KEYWORD NOT_SUPPORTED_KEYWORD (STMTEND
1259 | LEFT_CURLY_BRACE stmtSep RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301260
1261 /**
1262 * deviate-add-stmt = deviate-keyword sep add-keyword optsep
1263 * (";" /
1264 * "{" stmtsep
1265 * [units-stmt stmtsep]
1266 * *(must-stmt stmtsep)
1267 * *(unique-stmt stmtsep)
1268 * [default-stmt stmtsep]
1269 * [config-stmt stmtsep]
1270 * [mandatory-stmt stmtsep]
1271 * [min-elements-stmt stmtsep]
1272 * [max-elements-stmt stmtsep]
1273 * "}")
1274 */
Vidyashree Rama4066d712017-01-16 12:20:47 +05301275 deviateAddStatement: DEVIATE_KEYWORD ADD_KEYWORD (STMTEND
Vidyashree Rama3c586732017-05-12 19:48:07 +05301276 | LEFT_CURLY_BRACE stmtSep ((unitsStatement | mustStatement
1277 | uniqueStatement | defaultStatement | configStatement
1278 | mandatoryStatement | minElementsStatement | maxElementsStatement)
1279 stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301280
1281 /**
1282 * deviate-delete-stmt = deviate-keyword sep delete-keyword optsep
1283 * (";" /
1284 * "{" stmtsep
1285 * [units-stmt stmtsep]
1286 * *(must-stmt stmtsep)
1287 * *(unique-stmt stmtsep)
1288 * [default-stmt stmtsep]
1289 * "}")
1290 */
1291 deviateDeleteStatement: DEVIATE_KEYWORD DELETE_KEYWORD (STMTEND
Vidyashree Rama3c586732017-05-12 19:48:07 +05301292 | LEFT_CURLY_BRACE stmtSep ((unitsStatement | mustStatement
1293 | uniqueStatement | defaultStatement) stmtSep)* RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301294
1295 /**
1296 * deviate-replace-stmt = deviate-keyword sep replace-keyword optsep
1297 * (";" /
1298 * "{" stmtsep
1299 * [type-stmt stmtsep]
1300 * [units-stmt stmtsep]
1301 * [default-stmt stmtsep]
1302 * [config-stmt stmtsep]
1303 * [mandatory-stmt stmtsep]
1304 * [min-elements-stmt stmtsep]
1305 * [max-elements-stmt stmtsep]
1306 * "}")
1307 */
Vidyashree Rama4066d712017-01-16 12:20:47 +05301308 deviateReplaceStatement: DEVIATE_KEYWORD REPLACE_KEYWORD (STMTEND
Vidyashree Rama3c586732017-05-12 19:48:07 +05301309 | LEFT_CURLY_BRACE stmtSep ((typeStatement | unitsStatement
1310 | defaultStatement | configStatement | mandatoryStatement
1311 | minElementsStatement | maxElementsStatement) stmtSep)*
1312 RIGHT_CURLY_BRACE);
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301313
1314 /**
1315 * compiler-annotation-stmt = prefix:compiler-annotation-keyword string
1316 * "{"
1317 * [app-data-structure-stmt stmtsep]
1318 * [app-extended-stmt stmtsep]
1319 * "}"
1320 */
1321 compilerAnnotationStatement : COMPILER_ANNOTATION string LEFT_CURLY_BRACE
Vidyashree Rama3c586732017-05-12 19:48:07 +05301322 compilerAnnotationBodyStatement RIGHT_CURLY_BRACE;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301323
Vidyashree Rama3c586732017-05-12 19:48:07 +05301324 compilerAnnotationBodyStatement : (appDataStructureStatement stmtSep)?
1325 (appExtendedStatement stmtSep)?;
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301326
1327 /**
1328 * app-data-structure-stmt = prefix:app-data-structure-keyword string
1329 * (";" /
1330 * "{"
1331 * [data-structure-key-stmt stmtsep]
1332 * "}")
1333 */
Vidyashree Rama3c586732017-05-12 19:48:07 +05301334 appDataStructureStatement : APP_DATA_STRUCTURE appDataStructure (STMTEND
1335 | (LEFT_CURLY_BRACE (dataStructureKeyStatement stmtSep)?
1336 RIGHT_CURLY_BRACE));
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301337
1338 /**
1339 * data-structure-key-stmt = prefix:key-keyword string ";"
1340 */
1341 dataStructureKeyStatement : DATA_STRUCTURE_KEY string STMTEND;
1342
1343 /**
1344 * app-extended-stmt = prefix:app-extended-name-keyword string ";"
1345 */
1346 appExtendedStatement : APP_EXTENDED extendedName STMTEND;
1347
Sean Condon6b3a6452016-12-07 17:47:00 +00001348 /**
1349 * default-deny-write-stmt = prefix:default-deny-write ";"
1350 * From ietf-netconf-acm.yang RFC 6536
1351 */
1352 defaultDenyWriteStatement : DEFAULT_DENY_WRITE STMTEND;
1353
1354 /**
1355 * default-deny-all-stmt = prefix:default-deny-all ";"
1356 * From ietf-netconf-acm.yang RFC 6536
1357 */
1358 defaultDenyAllStatement : DEFAULT_DENY_ALL STMTEND;
1359
Vidyashree Rama3c586732017-05-12 19:48:07 +05301360 /**
1361 * unknown-statement = prefix ":" identifier [sep string] optsep
1362 * (";" / "{" *unknown-statement2 "}")
1363 */
1364 unknownStatement : unknown string? (STMTEND
1365 | LEFT_CURLY_BRACE unknownStatement2* RIGHT_CURLY_BRACE);
1366
1367 /**
1368 * unknown-statement2 = [prefix ":"] identifier [sep string] optsep
1369 * (";" / "{" *unknown-statement2 "}")
1370 */
1371 unknownStatement2 : unknown2 string? (STMTEND
1372 | LEFT_CURLY_BRACE unknownStatement2* RIGHT_CURLY_BRACE);
1373
1374 /**
1375 * stmtend = ";" / "{" *unknown-statement "}"
1376 */
1377 stmtEnd : STMTEND | LEFT_CURLY_BRACE unknownStatement* RIGHT_CURLY_BRACE;
1378
1379 stmtSep : unknownStatement*;
1380
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301381 string : STRING (PLUS STRING)*
1382 | IDENTIFIER
1383 | INTEGER
Vidyashree Rama3c586732017-05-12 19:48:07 +05301384 | UNKNOWN_STATEMENT
1385 | UNKNOWN_STATEMENT2
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301386 | yangConstruct;
1387
Vidyashree Rama3c586732017-05-12 19:48:07 +05301388 unknown : UNKNOWN_STATEMENT;
1389
1390 unknown2 : UNKNOWN_STATEMENT
1391 | IDENTIFIER;
1392
Gaurav Agrawala599a8f2017-01-10 20:45:27 +05301393 identifier : STRING (PLUS STRING)*
1394 | IDENTIFIER
1395 | yangConstruct;
1396
1397 dateArgumentString : DATE_ARG
1398 | STRING (PLUS STRING)*;
1399
1400 version : string;
1401
1402 range : string;
1403
1404 length : string;
1405
1406 path : string;
1407
1408 position : string;
1409
1410 status : string;
1411
1412 config : string;
1413
1414 mandatory : string;
1415
1416 orderedBy : string;
1417
1418 minValue : string;
1419
1420 maxValue : string;
1421
1422 key : string;
1423
1424 unique : string;
1425
1426 refine : string;
1427
1428 requireInstance : string;
1429
1430 augment : string;
1431
1432 deviation : string;
1433
1434 value : string;
1435
1436 fraction : string;
1437
1438 appDataStructure : string;
1439
1440 extendedName : string;
1441
1442 yangConstruct : ANYXML_KEYWORD | ARGUMENT_KEYWORD | AUGMENT_KEYWORD | BASE_KEYWORD | BELONGS_TO_KEYWORD
1443 | BIT_KEYWORD | CASE_KEYWORD | CHOICE_KEYWORD | CONFIG_KEYWORD | CONTACT_KEYWORD | CONTAINER_KEYWORD
1444 | DEFAULT_KEYWORD | DESCRIPTION_KEYWORD | ENUM_KEYWORD | ERROR_APP_TAG_KEYWORD | ERROR_MESSAGE_KEYWORD
1445 | EXTENSION_KEYWORD | DEVIATION_KEYWORD | DEVIATE_KEYWORD | FEATURE_KEYWORD
1446 | FRACTION_DIGITS_KEYWORD | GROUPING_KEYWORD | IDENTITY_KEYWORD | IF_FEATURE_KEYWORD
1447 | IMPORT_KEYWORD | INCLUDE_KEYWORD | INPUT_KEYWORD | KEY_KEYWORD | LEAF_KEYWORD | LEAF_LIST_KEYWORD
1448 | LENGTH_KEYWORD | LIST_KEYWORD | MANDATORY_KEYWORD | MAX_ELEMENTS_KEYWORD | MIN_ELEMENTS_KEYWORD
1449 | MODULE_KEYWORD | MUST_KEYWORD | NAMESPACE_KEYWORD | NOTIFICATION_KEYWORD | ORDERED_BY_KEYWORD
1450 | ORGANIZATION_KEYWORD | OUTPUT_KEYWORD | PATH_KEYWORD | PATTERN_KEYWORD | POSITION_KEYWORD
1451 | PREFIX_KEYWORD | PRESENCE_KEYWORD | RANGE_KEYWORD | REFERENCE_KEYWORD | REFINE_KEYWORD
1452 | REQUIRE_INSTANCE_KEYWORD | REVISION_KEYWORD | REVISION_DATE_KEYWORD | RPC_KEYWORD
1453 | STATUS_KEYWORD | SUBMODULE_KEYWORD | TYPE_KEYWORD | TYPEDEF_KEYWORD | UNIQUE_KEYWORD
1454 | UNITS_KEYWORD | USES_KEYWORD | VALUE_KEYWORD | WHEN_KEYWORD | YANG_VERSION_KEYWORD
1455 | YIN_ELEMENT_KEYWORD | ADD_KEYWORD | CURRENT_KEYWORD | DELETE_KEYWORD | DEPRECATED_KEYWORD
1456 | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
1457 | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
1458 | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
Sean Condon6b3a6452016-12-07 17:47:00 +00001459 | APP_EXTENDED_KEYWORD | DEFAULT_DENY_WRITE_KEYWORD | DEFAULT_DENY_ALL_KEYWORD;