blob: efb997edc772596c3942040566cb39939a9f7fc7 [file] [log] [blame]
Gaurav Agrawal2cbb9502016-02-12 16:50:55 +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 * submodule-header-stmts =
27 * ;; these stmts can appear in any order
28 * [yang-version-stmt stmtsep]
29 * belongs-to-stmt stmtsep
30 *
31 * belongs-to-stmt = belongs-to-keyword sep identifier-arg-str
32 * optsep
33 * "{" stmtsep
34 * prefix-stmt stmtsep
35 * "}"
36 *
37 * ANTLR grammar rule
38 * submodule_header_statement : yang_version_stmt? belongs_to_stmt
39 * | belongs_to_stmt yang_version_stmt?
40 * ;
41 * belongs_to_stmt : BELONGS_TO_KEYWORD IDENTIFIER LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
42 * belongs_to_stmt_body : prefix_stmt;
43 */
44
45/**
46 * Implements listener based call back function corresponding to the "belongs to"
47 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
48 */
49public final class BelongsToListener {
50
51 /**
52 * Creates a new belongto listener.
53 */
54 private BelongsToListener() {
55 }
56
57 /**
58 * It is called when parser receives an input matching the grammar
59 * rule (belongsto), perform validations and update the data model
60 * tree.
61 *
62 * @param listener Listener's object.
63 * @param ctx context object of the grammar rule.
64 */
65 public static void processBelongsToEntry(TreeWalkListener listener,
66 GeneratedYangParser.BelongstoStatementContext ctx) {
67 // TODO method implementation
68 }
69
70 /**
71 * It is called when parser exits from grammar rule (belongsto), it perform
72 * validations and update the data model tree.
73 *
74 * @param listener Listener's object.
75 * @param ctx context object of the grammar rule.
76 */
77 public static void processBelongsToExit(TreeWalkListener listener,
78 GeneratedYangParser.BelongstoStatementContext ctx) {
79 // TODO method implementation
80 }
81}