Gaurav Agrawal | 22db16d | 2016-02-12 16:50:55 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.yangutils.parser.impl.listeners; |
| 18 | |
| 19 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; |
| 20 | import 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 | * ANTLR grammar rule |
| 37 | * module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE; |
| 38 | */ |
| 39 | |
| 40 | /** |
| 41 | * Implements listener based call back function corresponding to the "module" |
| 42 | * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 43 | */ |
| 44 | public final class ModuleListener { |
| 45 | |
| 46 | /** |
| 47 | * Creates a new module listener. |
| 48 | */ |
| 49 | private ModuleListener() { |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * It is called when parser receives an input matching the grammar |
| 54 | * rule (module), perform validations and update the data model |
| 55 | * tree. |
| 56 | * |
| 57 | * @param listener Listener's object. |
| 58 | * @param ctx context object of the grammar rule. |
| 59 | */ |
| 60 | public static void processModuleEntry(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) { |
| 61 | // TODO method implementation |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * It is called when parser exits from grammar rule (module), it perform |
| 66 | * validations and update the data model tree. |
| 67 | * |
| 68 | * @param listener Listener's object. |
| 69 | * @param ctx context object of the grammar rule. |
| 70 | */ |
| 71 | public static void processModuleExit(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) { |
| 72 | // TODO method implementation |
| 73 | } |
| 74 | } |