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 | * import-stmt = import-keyword sep identifier-arg-str optsep |
| 27 | * "{" stmtsep |
| 28 | * prefix-stmt stmtsep |
| 29 | * [revision-date-stmt stmtsep] |
| 30 | * "}" |
| 31 | * include-stmt = include-keyword sep identifier-arg-str optsep |
| 32 | * (";" / |
| 33 | * "{" stmtsep |
| 34 | * [revision-date-stmt stmtsep] |
| 35 | * "}") |
| 36 | * revision-date-stmt = revision-date-keyword sep revision-date stmtend |
| 37 | * |
| 38 | * ANTLR grammar rule |
| 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 | * include_stmt : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE |
| 44 | * revision_date_stmt_body? RIGHT_CURLY_BRACE); |
| 45 | * |
| 46 | * revision_date_stmt : REVISION_DATE_KEYWORD DATE_ARG STMTEND; |
| 47 | * |
| 48 | */ |
| 49 | |
| 50 | /** |
| 51 | * Implements listener based call back function corresponding to the "revision date" |
| 52 | * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 53 | */ |
| 54 | public final class RevisionDateListener { |
| 55 | |
| 56 | /** |
| 57 | * Creates a new revision date listener. |
| 58 | */ |
| 59 | private RevisionDateListener() { |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * It is called when parser receives an input matching the grammar |
| 64 | * rule (revision date),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 processRevisionDateEntry(TreeWalkListener listener, |
| 71 | GeneratedYangParser.RevisionDateStatementContext ctx) { |
| 72 | // TODO method implementation |
| 73 | } |
| 74 | } |