blob: 6f694e118d449691fea6e75f21db0ba142c29974 [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 * module-header-stmts = ;; these stmts can appear in any order
27 * [yang-version-stmt stmtsep]
28 * namespace-stmt stmtsep
29 * prefix-stmt stmtsep
30 *
31 * namespace-stmt = namespace-keyword sep uri-str optsep stmtend
32 *
33 * ANTLR grammar rule
34 * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
35 * | yang_version_stmt? prefix_stmt namespace_stmt
36 * | namespace_stmt yang_version_stmt? prefix_stmt
37 * | namespace_stmt prefix_stmt yang_version_stmt?
38 * | prefix_stmt namespace_stmt yang_version_stmt?
39 * | prefix_stmt yang_version_stmt? namespace_stmt
40 * ;
41 * namespace_stmt : NAMESPACE_KEYWORD string STMTEND;
42 */
43
44/**
45 * Implements listener based call back function corresponding to the "namespace"
46 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
47 */
48public final class NamespaceListener {
49
50 /**
51 * Creates a new namespace listener.
52 */
53 private NamespaceListener() {
54 }
55
56 /**
57 * It is called when parser receives an input matching the grammar
58 * rule (namespace), 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 processNamespaceEntry(TreeWalkListener listener,
65 GeneratedYangParser.NamespaceStatementContext ctx) {
66 // TODO method implementation
67 }
68}