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 | * meta-stmts = ;; these stmts can appear in any order |
| 27 | * [organization-stmt stmtsep] |
| 28 | * [contact-stmt stmtsep] |
| 29 | * [description-stmt stmtsep] |
| 30 | * [reference-stmt stmtsep] |
| 31 | * organization-stmt = organization-keyword sep string |
| 32 | * optsep stmtend |
| 33 | * |
| 34 | * ANTLR grammar rule |
| 35 | * meta_stmts : organization_stmt? contact_stmt? description_stmt? reference_stmt? |
| 36 | * | organization_stmt? contact_stmt? reference_stmt? description_stmt? |
| 37 | * | organization_stmt? description_stmt? contact_stmt? reference_stmt? |
| 38 | * | organization_stmt? description_stmt? reference_stmt? contact_stmt? |
| 39 | * | organization_stmt? reference_stmt? contact_stmt? description_stmt? |
| 40 | * | organization_stmt? reference_stmt? description_stmt? contact_stmt? |
| 41 | * | contact_stmt? organization_stmt? description_stmt? reference_stmt? |
| 42 | * | contact_stmt? organization_stmt? reference_stmt? description_stmt? |
| 43 | * | contact_stmt? reference_stmt? organization_stmt? description_stmt? |
| 44 | * | contact_stmt? reference_stmt? description_stmt? organization_stmt? |
| 45 | * | contact_stmt? description_stmt? reference_stmt? organization_stmt? |
| 46 | * | contact_stmt? description_stmt? organization_stmt? reference_stmt? |
| 47 | * | reference_stmt? contact_stmt? organization_stmt? description_stmt? |
| 48 | * | reference_stmt? contact_stmt? description_stmt? organization_stmt? |
| 49 | * | reference_stmt? organization_stmt? contact_stmt? description_stmt? |
| 50 | * | reference_stmt? organization_stmt? description_stmt? contact_stmt? |
| 51 | * | reference_stmt? description_stmt? organization_stmt? contact_stmt? |
| 52 | * | reference_stmt? description_stmt? contact_stmt? organization_stmt? |
| 53 | * | description_stmt? reference_stmt? contact_stmt? organization_stmt? |
| 54 | * | description_stmt? reference_stmt? organization_stmt? contact_stmt? |
| 55 | * | description_stmt? contact_stmt? reference_stmt? organization_stmt? |
| 56 | * | description_stmt? contact_stmt? organization_stmt? reference_stmt? |
| 57 | * | description_stmt? organization_stmt? contact_stmt? reference_stmt? |
| 58 | * | description_stmt? organization_stmt? reference_stmt? contact_stmt? |
| 59 | * ; |
| 60 | * organization_stmt : ORGANIZATION_KEYWORD string STMTEND; |
| 61 | */ |
| 62 | |
| 63 | /** |
| 64 | * Implements listener based call back function corresponding to the "contact" |
| 65 | * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 66 | */ |
| 67 | public final class ContactListener { |
| 68 | |
| 69 | /** |
| 70 | * Creates a new contact listener. |
| 71 | */ |
| 72 | private ContactListener() { |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * It is called when parser receives an input matching the grammar |
| 77 | * rule (contact), perform validations and update the data model |
| 78 | * tree. |
| 79 | * |
| 80 | * @param listener Listener's object. |
| 81 | * @param ctx context object of the grammar rule. |
| 82 | */ |
| 83 | public static void processContactEntry(TreeWalkListener listener, GeneratedYangParser.ContactStatementContext ctx) { |
| 84 | // TODO method implementation |
| 85 | } |
| 86 | } |