blob: b77f5943c702ff823689e3c6a1670b1a9f0d9039 [file] [log] [blame]
Vidyashree Rama92fc5562016-02-12 18:44:12 +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
17package org.onosproject.yangutils.parser.impl.listeners;
18
19import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
20import org.onosproject.yangutils.parser.impl.TreeWalkListener;
21
22/*
23 * Reference: RFC6020 and YANG ANTLR Grammar
24 *
25 * ABNF grammar as per RFC6020
26 * container-stmt = container-keyword sep identifier-arg-str optsep
27 * (";" /
28 * "{" stmtsep
29 * ;; these stmts can appear in any order
30 * [when-stmt stmtsep]
31 * *(if-feature-stmt stmtsep)
32 * *(must-stmt stmtsep)
33 * [presence-stmt stmtsep]
34 * [config-stmt stmtsep]
35 * [status-stmt stmtsep]
36 * [description-stmt stmtsep]
37 * [reference-stmt stmtsep]
38 * *((typedef-stmt /
39 * grouping-stmt) stmtsep)
40 * *(data-def-stmt stmtsep)
41 * "}")
42 *
43 * ANTLR grammar rule
44 * containerStatement : CONTAINER_KEYWORD IDENTIFIER
45 * (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
46 * presenceStatement | configStatement | statusStatement | descriptionStatement |
47 * referenceStatement | typedefStatement | groupingStatement
48 * | dataDefStatement)* RIGHT_CURLY_BRACE);
49 */
50
51/**
52 * Implements listener based call back function corresponding to the "container"
53 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
54 */
55public final class ContainerListener {
56
57 /**
58 * Creates a new container listener.
59 */
60 private ContainerListener() {
61 }
62
63 /**
64 * It is called when parser receives an input matching the grammar
65 * rule (container), performs validation and updates the data model
66 * tree.
67 *
68 * @param listener listener's object.
69 * @param ctx context object of the grammar rule.
70 */
71 public static void processContainerEntry(TreeWalkListener listener,
72 GeneratedYangParser.ContainerStatementContext ctx) {
73 // TODO method implementation
74 }
75
76 /**
77 * It is called when parser exits from grammar rule (container), it perform
78 * validations and updates the data model tree.
79 *
80 * @param listener listener's object.
81 * @param ctx context object of the grammar rule.
82 */
83 public static void processContainerExit(TreeWalkListener listener,
84 GeneratedYangParser.ContainerStatementContext ctx) {
85 //TODO method implementation
86 }
87}