blob: 02afdcf213ed82ea23d554a676348b35350e405a [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 * submodule-header-stmts =
32 * ;; these stmts can appear in any order
33 * [yang-version-stmt stmtsep]
34 * belongs-to-stmt stmtsep
35 *
36 * yang-version-stmt = yang-version-keyword sep yang-version-arg-str
37 * optsep stmtend
38 *
39 *
40 * ANTLR grammar rule
41 * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt
42 * | yang_version_stmt? prefix_stmt namespace_stmt
43 * | namespace_stmt yang_version_stmt? prefix_stmt
44 * | namespace_stmt prefix_stmt yang_version_stmt?
45 * | prefix_stmt namespace_stmt yang_version_stmt?
46 * | prefix_stmt yang_version_stmt? namespace_stmt?
47 * ;
48 * submodule_header_statement : yang_version_stmt? belongs_to_stmt
49 * | belongs_to_stmt yang_version_stmt?
50 * ;
51 * yang_version_stmt : YANG_VERSION_KEYWORD INTEGER STMTEND;
52 */
53
54/**
55 * Implements listener based call back function corresponding to the "version"
56 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
57 */
58public final class VersionListener {
59
60 /**
61 * Creates a new version listener.
62 */
63 private VersionListener() {
64 }
65
66 /**
67 * It is called when parser receives an input matching the grammar
68 * rule (version), perform validations and update the data model
69 * tree.
70 *
71 * @param listener Listener's object.
72 * @param ctx context object of the grammar rule.
73 */
74 public static void processVersionEntry(TreeWalkListener listener,
75 GeneratedYangParser.YangVersionStatementContext ctx) {
76 // TODO method implementation
77 }
78}