blob: c473c83e80e54b904c6fe753e1563bdc60a1446a [file] [log] [blame]
Gaurav Agrawal22db16d2016-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-stmt = optsep module-keyword sep identifier-arg-str
27 * optsep
28 * "{" stmtsep
29 * module-header-stmts
30 * linkage-stmts
31 * meta-stmts
32 * revision-stmts
33 * body-stmts
34 * "}" optsep
35 *
36 * revision-stmt = revision-keyword sep revision-date optsep
37 * (";" /
38 * "{" stmtsep
39 * [description-stmt stmtsep]
40 * [reference-stmt stmtsep]
41 * "}")
42 *
43 * ANTLR grammar rule
44 * module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
45 *
46 * revision_stmt : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revision_stmt_body RIGHT_CURLY_BRACE);
47 * revision_stmt_body : description_stmt? reference_stmt?;
48 */
49
50/**
51 * Implements listener based call back function corresponding to the "revision"
52 * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020.
53 */
54public final class RevisionListener {
55
56 /**
57 * Creates a new revision listener.
58 */
59 private RevisionListener() {
60 }
61
62 /**
63 * It is called when parser receives an input matching the grammar
64 * rule (revision), perform validations and update the data model
65 * tree.
66 *
67 * @param listener Listener's object.
68 * @param ctx context object of the grammar rule.
69 */
70 public static void processRevisionEntry(TreeWalkListener listener, GeneratedYangParser.RevisionStatementContext
71 ctx) {
72 // TODO method implementation
73 }
74
75 /**
76 * It is called when parser exits from grammar rule (revision), it perform
77 * validations and update the data model tree.
78 *
79 * @param listener Listener's object.
80 * @param ctx context object of the grammar rule.
81 */
82 public static void processRevisionExit(TreeWalkListener listener, GeneratedYangParser.RevisionStatementContext
83 ctx) {
84 // TODO method implementation
85 }
86}