blob: ef53b3d29d8d76c7f4733daa93a728f4b82320f5 [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 * linkage-stmts = ;; these stmts can appear in any order
27 * *(import-stmt stmtsep)
28 * *(include-stmt stmtsep)
29 *
30 * import-stmt = import-keyword sep identifier-arg-str optsep
31 * "{" stmtsep
32 * prefix-stmt stmtsep
33 * [revision-date-stmt stmtsep]
34 * "}"
35 *
36 * ANTLR grammar rule
37 * linkage_stmts : (import_stmt
38 * | include_stmt)*;
39 * import_stmt : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE import_stmt_body
40 * RIGHT_CURLY_BRACE;
41 * import_stmt_body : prefix_stmt revision_date_stmt?;
42 */
43
44/**
45 * Implements listener based call back function corresponding to the "import"
46 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
47 */
48public final class ImportListener {
49
50 /**
51 * Creates a new import listener.
52 */
53 private ImportListener() {
54 }
55
56 /**
57 * It is called when parser receives an input matching the grammar
58 * rule (import), perform validations and update the data model
59 * tree.
60 *
61 * @param listener Listener's object.
62 * @param ctx context object of the grammar rule.
63 */
64 public static void processImportEntry(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
65 // TODO method implementation
66 }
67
68 /**
69 * It is called when parser exits from grammar rule (import), it perform
70 * validations and update the data model tree.
71 *
72 * @param listener Listener's object.
73 * @param ctx context object of the grammar rule.
74 */
75 public static void processImportExit(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
76 // TODO method implementation
77 }
78}