Vidyashree Rama | fe971cb | 2016-02-12 18:44:12 +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 | * leaf-list-stmt = leaf-list-keyword sep identifier-arg-str optsep |
| 27 | * "{" stmtsep |
| 28 | * ;; these stmts can appear in any order |
| 29 | * [when-stmt stmtsep] |
| 30 | * *(if-feature-stmt stmtsep) |
| 31 | * type-stmt stmtsep |
| 32 | * [units-stmt stmtsep] |
| 33 | * *(must-stmt stmtsep) |
| 34 | * [config-stmt stmtsep] |
| 35 | * [min-elements-stmt stmtsep] |
| 36 | * [max-elements-stmt stmtsep] |
| 37 | * [ordered-by-stmt stmtsep] |
| 38 | * [status-stmt stmtsep] |
| 39 | * [description-stmt stmtsep] |
| 40 | * [reference-stmt stmtsep] |
| 41 | * "}" |
| 42 | * |
| 43 | * ANTLR grammar rule |
| 44 | * leafListStatement : LEAF_LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | |
| 45 | * typeStatement | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | |
| 46 | * orderedByStatement | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE; |
| 47 | */ |
| 48 | |
| 49 | /** |
| 50 | * Implements listener based call back function corresponding to the "leaf-list" |
| 51 | * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 52 | */ |
| 53 | public final class LeafListListener { |
| 54 | |
| 55 | /** |
| 56 | * Creates a new leaf list listener. |
| 57 | */ |
| 58 | private LeafListListener() { |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * It is called when parser receives an input matching the grammar |
| 63 | * rule (leaf-list), performs validation and updates the data model |
| 64 | * tree. |
| 65 | * |
| 66 | * @param listener listener's object. |
| 67 | * @param ctx context object of the grammar rule. |
| 68 | */ |
| 69 | public static void processLeafListEntry(TreeWalkListener listener, |
| 70 | GeneratedYangParser.LeafListStatementContext ctx) { |
| 71 | // TODO method implementation |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * It is called when parser exits from grammar rule (leaf-list), it performs |
| 76 | * validation and updates the data model tree. |
| 77 | * |
| 78 | * @param listener listener's object. |
| 79 | * @param ctx context object of the grammar rule. |
| 80 | */ |
| 81 | public static void processLeafListExit(TreeWalkListener listener, |
| 82 | GeneratedYangParser.LeafListStatementContext ctx) { |
| 83 | // TODO method implementation |
| 84 | } |
| 85 | } |