blob: 7aceab687257ac34dbb382e5e49b34428507e797 [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 * list-stmt = list-keyword sep identifier-arg-str optsep
27 * "{" stmtsep
28 * ;; these stmts can appear in any order
29 * [when-stmt stmtsep]
30 * *(if-feature-stmt stmtsep)
31 * *(must-stmt stmtsep)
32 * [key-stmt stmtsep]
33 * *(unique-stmt stmtsep)
34 * [config-stmt stmtsep]
35 * [min-elements-stmt stmtsep]
36 * [max-elements-stmt stmtsep]
37 * [ordered-by-stmt stmtsep]
38 * [status-stmt stmtsep]
39 * [description-stmt stmtsep]
40 * [reference-stmt stmtsep]
41 * *((typedef-stmt /
42 * grouping-stmt) stmtsep)
43 * 1*(data-def-stmt stmtsep)
44 * "}"
45 *
46 * ANTLR grammar rule
47 * listStatement : LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
48 * keyStatement | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement |
49 * orderedByStatement | statusStatement | descriptionStatement | referenceStatement | typedefStatement |
50 * groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
51 */
52
53/**
54 * Implements listener based call back function corresponding to the "list"
55 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
56 */
57public final class ListListener {
58
59 /**
60 * Creates a new list listener.
61 */
62 private ListListener() {
63 }
64
65 /**
66 * It is called when parser receives an input matching the grammar
67 * rule (list), performs validation and updates the data model
68 * tree.
69 *
70 * @param listener listener's object.
71 * @param ctx context object of the grammar rule.
72 */
73 public static void processListEntry(TreeWalkListener listener,
74 GeneratedYangParser.ListStatementContext ctx) {
75 // TODO
76 }
77
78 /**
79 * It is called when parser exits from grammar rule (list), it performs
80 * validation and updates the data model tree.
81 *
82 * @param listener listener's object.
83 * @param ctx context object of the grammar rule.
84 */
85 public static void processListExit(TreeWalkListener listener,
86 GeneratedYangParser.ListStatementContext ctx) {
87 // TODO
88 }
89}