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-header-stmts = ;; these stmts can appear in any order |
| 27 | * [yang-version-stmt stmtsep] |
| 28 | * namespace-stmt stmtsep |
| 29 | * prefix-stmt stmtsep |
| 30 | * |
| 31 | * prefix-stmt = prefix-keyword sep prefix-arg-str |
| 32 | * optsep stmtend |
| 33 | * |
| 34 | * ANTLR grammar rule |
| 35 | * module_header_statement : yang_version_stmt? namespace_stmt prefix_stmt |
| 36 | * | yang_version_stmt? prefix_stmt namespace_stmt |
| 37 | * | namespace_stmt yang_version_stmt? prefix_stmt |
| 38 | * | namespace_stmt prefix_stmt yang_version_stmt? |
| 39 | * | prefix_stmt namespace_stmt yang_version_stmt? |
| 40 | * | prefix_stmt yang_version_stmt? namespace_stmt |
| 41 | * ; |
| 42 | * prefix_stmt : PREFIX_KEYWORD IDENTIFIER STMTEND; |
| 43 | */ |
| 44 | |
| 45 | /** |
| 46 | * Implements listener based call back function corresponding to the "prefix" |
| 47 | * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 48 | */ |
| 49 | public final class PrefixListener { |
| 50 | |
| 51 | /** |
| 52 | * Creates a new prefix listener. |
| 53 | */ |
| 54 | private PrefixListener() { |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * It is called when parser receives an input matching the grammar |
| 59 | * rule (prefix),perform validations and update the data model |
| 60 | * tree. |
| 61 | * |
| 62 | * @param listener Listener's object. |
| 63 | * @param ctx context object of the grammar rule. |
| 64 | */ |
| 65 | public static void processPrefixEntry(TreeWalkListener listener, GeneratedYangParser.PrefixStatementContext ctx) { |
| 66 | // TODO method implementation |
| 67 | } |
| 68 | } |