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