Committed by
Gerrit Code Review
[ONOS-3897] Yang Listener for Enumeration Data Type
Change-Id: If257c73da8fe2dcc2f4111f103967cfcdd7fa273
Showing
16 changed files
with
1121 additions
and
370 deletions
| ... | @@ -20,6 +20,8 @@ import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | ... | @@ -20,6 +20,8 @@ import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 20 | import org.onosproject.yangutils.parser.Parsable; | 20 | import org.onosproject.yangutils.parser.Parsable; |
| 21 | import org.onosproject.yangutils.parser.ParsableDataType; | 21 | import org.onosproject.yangutils.parser.ParsableDataType; |
| 22 | 22 | ||
| 23 | +import java.util.Objects; | ||
| 24 | + | ||
| 23 | /*- | 25 | /*- |
| 24 | * The "ENUM" statement, which is a sub-statement to the "type" | 26 | * The "ENUM" statement, which is a sub-statement to the "type" |
| 25 | * statement, MUST be present if the type is "enumeration". It is | 27 | * statement, MUST be present if the type is "enumeration". It is |
| ... | @@ -188,6 +190,23 @@ public class YangEnum implements YangCommonInfo, Parsable { | ... | @@ -188,6 +190,23 @@ public class YangEnum implements YangCommonInfo, Parsable { |
| 188 | return ParsableDataType.ENUM_DATA; | 190 | return ParsableDataType.ENUM_DATA; |
| 189 | } | 191 | } |
| 190 | 192 | ||
| 193 | + @Override | ||
| 194 | + public boolean equals(Object obj) { | ||
| 195 | + if (this == obj) { | ||
| 196 | + return true; | ||
| 197 | + } | ||
| 198 | + if (obj instanceof YangEnum) { | ||
| 199 | + final YangEnum other = (YangEnum) obj; | ||
| 200 | + return Objects.equals(this.namedValue, other.namedValue); | ||
| 201 | + } | ||
| 202 | + return false; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + @Override | ||
| 206 | + public int hashCode() { | ||
| 207 | + return Objects.hashCode(this.namedValue); | ||
| 208 | + } | ||
| 209 | + | ||
| 191 | /** | 210 | /** |
| 192 | * Validate the data on entering the corresponding parse tree node. | 211 | * Validate the data on entering the corresponding parse tree node. |
| 193 | * | 212 | * | ... | ... |
| ... | @@ -16,13 +16,12 @@ | ... | @@ -16,13 +16,12 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.yangutils.datamodel; | 17 | package org.onosproject.yangutils.datamodel; |
| 18 | 18 | ||
| 19 | -import java.util.HashSet; | ||
| 20 | -import java.util.Set; | ||
| 21 | - | ||
| 22 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | 19 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 23 | import org.onosproject.yangutils.parser.Parsable; | 20 | import org.onosproject.yangutils.parser.Parsable; |
| 24 | import org.onosproject.yangutils.parser.ParsableDataType; | 21 | import org.onosproject.yangutils.parser.ParsableDataType; |
| 25 | -import org.onosproject.yangutils.translator.CachedFileHandle; | 22 | + |
| 23 | +import java.util.HashSet; | ||
| 24 | +import java.util.Set; | ||
| 26 | 25 | ||
| 27 | /* | 26 | /* |
| 28 | * The enumeration built-in type represents values from a set of | 27 | * The enumeration built-in type represents values from a set of |
| ... | @@ -32,20 +31,19 @@ import org.onosproject.yangutils.translator.CachedFileHandle; | ... | @@ -32,20 +31,19 @@ import org.onosproject.yangutils.translator.CachedFileHandle; |
| 32 | /** | 31 | /** |
| 33 | * Maintains the enumeration data type information. | 32 | * Maintains the enumeration data type information. |
| 34 | */ | 33 | */ |
| 35 | -public class YangEnumeration extends YangNode implements Parsable { | 34 | +public class YangEnumeration implements Parsable { |
| 36 | 35 | ||
| 37 | - /** | 36 | + // Enumeration info set. |
| 38 | - * Enumeration info set. | ||
| 39 | - */ | ||
| 40 | private Set<YangEnum> enumSet; | 37 | private Set<YangEnum> enumSet; |
| 41 | 38 | ||
| 39 | + // Enumeration name. | ||
| 40 | + private String enumerationName; | ||
| 41 | + | ||
| 42 | /** | 42 | /** |
| 43 | - * Create an enumeration object. | 43 | + * Creates an enumeration object. |
| 44 | */ | 44 | */ |
| 45 | public YangEnumeration() { | 45 | public YangEnumeration() { |
| 46 | - super(YangNodeType.ENUMERATION_NODE); | ||
| 47 | setEnumSet(new HashSet<YangEnum>()); | 46 | setEnumSet(new HashSet<YangEnum>()); |
| 48 | - | ||
| 49 | } | 47 | } |
| 50 | 48 | ||
| 51 | /** | 49 | /** |
| ... | @@ -67,12 +65,33 @@ public class YangEnumeration extends YangNode implements Parsable { | ... | @@ -67,12 +65,33 @@ public class YangEnumeration extends YangNode implements Parsable { |
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | /** | 67 | /** |
| 70 | - * Add ENUM value. | 68 | + * Add ENUM information. |
| 71 | * | 69 | * |
| 72 | - * @param enumInfo the ENUM value of string | 70 | + * @param enumInfo the ENUM information to be added. |
| 71 | + * @throws DataModelException due to violation in data model rules. | ||
| 73 | */ | 72 | */ |
| 74 | - public void addEnumInfo(YangEnum enumInfo) { | 73 | + public void addEnumInfo(YangEnum enumInfo) throws DataModelException { |
| 74 | + if (!getEnumSet().add(enumInfo)) { | ||
| 75 | + throw new DataModelException("YANG ENUM already exists"); | ||
| 76 | + } | ||
| 77 | + } | ||
| 75 | 78 | ||
| 79 | + /** | ||
| 80 | + * Return enumeration name. | ||
| 81 | + * | ||
| 82 | + * @return the enumeration name | ||
| 83 | + */ | ||
| 84 | + public String getEnumerationName() { | ||
| 85 | + return enumerationName; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Set the enumeration name. | ||
| 90 | + * | ||
| 91 | + * @param enumerationName enumeration name | ||
| 92 | + */ | ||
| 93 | + public void setEnumerationName(String enumerationName) { | ||
| 94 | + this.enumerationName = enumerationName; | ||
| 76 | } | 95 | } |
| 77 | 96 | ||
| 78 | /** | 97 | /** |
| ... | @@ -104,70 +123,4 @@ public class YangEnumeration extends YangNode implements Parsable { | ... | @@ -104,70 +123,4 @@ public class YangEnumeration extends YangNode implements Parsable { |
| 104 | public void validateDataOnExit() throws DataModelException { | 123 | public void validateDataOnExit() throws DataModelException { |
| 105 | // TODO auto-generated method stub, to be implemented by parser | 124 | // TODO auto-generated method stub, to be implemented by parser |
| 106 | } | 125 | } |
| 107 | - | ||
| 108 | - /* (non-Javadoc) | ||
| 109 | - * @see org.onosproject.yangutils.datamodel.YangNode#getName() | ||
| 110 | - */ | ||
| 111 | - @Override | ||
| 112 | - public String getName() { | ||
| 113 | - // TODO Auto-generated method stub | ||
| 114 | - return null; | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - /* (non-Javadoc) | ||
| 118 | - * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String) | ||
| 119 | - */ | ||
| 120 | - @Override | ||
| 121 | - public void setName(String name) { | ||
| 122 | - // TODO Auto-generated method stub | ||
| 123 | - | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | - /* (non-Javadoc) | ||
| 127 | - * @see org.onosproject.yangutils.datamodel.YangNode#getPackage() | ||
| 128 | - */ | ||
| 129 | - @Override | ||
| 130 | - public String getPackage() { | ||
| 131 | - // TODO Auto-generated method stub | ||
| 132 | - return null; | ||
| 133 | - } | ||
| 134 | - | ||
| 135 | - /* (non-Javadoc) | ||
| 136 | - * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String) | ||
| 137 | - */ | ||
| 138 | - @Override | ||
| 139 | - public void setPackage(String pkg) { | ||
| 140 | - // TODO Auto-generated method stub | ||
| 141 | - | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - /* (non-Javadoc) | ||
| 145 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry() | ||
| 146 | - */ | ||
| 147 | - @Override | ||
| 148 | - public void generateJavaCodeEntry() { | ||
| 149 | - // TODO Auto-generated method stub | ||
| 150 | - | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - /* (non-Javadoc) | ||
| 154 | - * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit() | ||
| 155 | - */ | ||
| 156 | - @Override | ||
| 157 | - public void generateJavaCodeExit() { | ||
| 158 | - // TODO Auto-generated method stub | ||
| 159 | - | ||
| 160 | - } | ||
| 161 | - | ||
| 162 | - @Override | ||
| 163 | - public CachedFileHandle getFileHandle() { | ||
| 164 | - // TODO Auto-generated method stub | ||
| 165 | - return null; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - @Override | ||
| 169 | - public void setFileHandle(CachedFileHandle fileHandle) { | ||
| 170 | - // TODO Auto-generated method stub | ||
| 171 | - | ||
| 172 | - } | ||
| 173 | } | 126 | } | ... | ... |
| ... | @@ -215,6 +215,11 @@ public enum ParsableDataType { | ... | @@ -215,6 +215,11 @@ public enum ParsableDataType { |
| 215 | DEFAULT_DATA, | 215 | DEFAULT_DATA, |
| 216 | 216 | ||
| 217 | /** | 217 | /** |
| 218 | + * Identifies the YANG value element parsed data. | ||
| 219 | + */ | ||
| 220 | + VALUE_DATA, | ||
| 221 | + | ||
| 222 | + /** | ||
| 218 | * Identifies the YANG organization parsed data. | 223 | * Identifies the YANG organization parsed data. |
| 219 | */ | 224 | */ |
| 220 | ORGANIZATION_DATA; | 225 | ORGANIZATION_DATA; |
| ... | @@ -228,88 +233,90 @@ public enum ParsableDataType { | ... | @@ -228,88 +233,90 @@ public enum ParsableDataType { |
| 228 | public static String getParsableDataType(ParsableDataType parsableDataType) { | 233 | public static String getParsableDataType(ParsableDataType parsableDataType) { |
| 229 | 234 | ||
| 230 | switch (parsableDataType) { | 235 | switch (parsableDataType) { |
| 231 | - case MODULE_DATA: | 236 | + case MODULE_DATA: |
| 232 | - return "module"; | 237 | + return "module"; |
| 233 | - case SUB_MODULE_DATA: | 238 | + case SUB_MODULE_DATA: |
| 234 | - return "submodule"; | 239 | + return "submodule"; |
| 235 | - case TYPEDEF_DATA: | 240 | + case TYPEDEF_DATA: |
| 236 | - return "typedef"; | 241 | + return "typedef"; |
| 237 | - case TYPE_DATA: | 242 | + case TYPE_DATA: |
| 238 | - return "type"; | 243 | + return "type"; |
| 239 | - case CHOICE_DATA: | 244 | + case CHOICE_DATA: |
| 240 | - return "choice"; | 245 | + return "choice"; |
| 241 | - case CASE_DATA: | 246 | + case CASE_DATA: |
| 242 | - return "case"; | 247 | + return "case"; |
| 243 | - case ENUMERATION_DATA: | 248 | + case ENUMERATION_DATA: |
| 244 | - return "enumeration"; | 249 | + return "enumeration"; |
| 245 | - case GROUPING_DATA: | 250 | + case GROUPING_DATA: |
| 246 | - return "grouping"; | 251 | + return "grouping"; |
| 247 | - case USES_DATA: | 252 | + case USES_DATA: |
| 248 | - return "uses"; | 253 | + return "uses"; |
| 249 | - case AUGMENT_DATA: | 254 | + case AUGMENT_DATA: |
| 250 | - return "augment"; | 255 | + return "augment"; |
| 251 | - case CONTAINER_DATA: | 256 | + case CONTAINER_DATA: |
| 252 | - return "container"; | 257 | + return "container"; |
| 253 | - case LIST_DATA: | 258 | + case LIST_DATA: |
| 254 | - return "list"; | 259 | + return "list"; |
| 255 | - case BELONGS_TO_DATA: | 260 | + case BELONGS_TO_DATA: |
| 256 | - return "belongs-to"; | 261 | + return "belongs-to"; |
| 257 | - case BIT_DATA: | 262 | + case BIT_DATA: |
| 258 | - return "bit"; | 263 | + return "bit"; |
| 259 | - case BITS_DATA: | 264 | + case BITS_DATA: |
| 260 | - return "bits"; | 265 | + return "bits"; |
| 261 | - case ENUM_DATA: | 266 | + case ENUM_DATA: |
| 262 | - return "enum"; | 267 | + return "enum"; |
| 263 | - case IMPORT_DATA: | 268 | + case IMPORT_DATA: |
| 264 | - return "import"; | 269 | + return "import"; |
| 265 | - case INCLUDE_DATA: | 270 | + case INCLUDE_DATA: |
| 266 | - return "include"; | 271 | + return "include"; |
| 267 | - case LEAF_DATA: | 272 | + case LEAF_DATA: |
| 268 | - return "leaf"; | 273 | + return "leaf"; |
| 269 | - case LEAF_LIST_DATA: | 274 | + case LEAF_LIST_DATA: |
| 270 | - return "leaf-list"; | 275 | + return "leaf-list"; |
| 271 | - case MUST_DATA: | 276 | + case MUST_DATA: |
| 272 | - return "must"; | 277 | + return "must"; |
| 273 | - case REVISION_DATA: | 278 | + case REVISION_DATA: |
| 274 | - return "revision"; | 279 | + return "revision"; |
| 275 | - case REVISION_DATE_DATA: | 280 | + case REVISION_DATE_DATA: |
| 276 | - return "revision-date"; | 281 | + return "revision-date"; |
| 277 | - case NAMESPACE_DATA: | 282 | + case NAMESPACE_DATA: |
| 278 | - return "namespace"; | 283 | + return "namespace"; |
| 279 | - case CONTACT_DATA: | 284 | + case CONTACT_DATA: |
| 280 | - return "contact"; | 285 | + return "contact"; |
| 281 | - case CONFIG_DATA: | 286 | + case CONFIG_DATA: |
| 282 | - return "config"; | 287 | + return "config"; |
| 283 | - case DESCRIPTION_DATA: | 288 | + case DESCRIPTION_DATA: |
| 284 | - return "description"; | 289 | + return "description"; |
| 285 | - case KEY_DATA: | 290 | + case KEY_DATA: |
| 286 | - return "key"; | 291 | + return "key"; |
| 287 | - case MANDATORY_DATA: | 292 | + case MANDATORY_DATA: |
| 288 | - return "mandatory"; | 293 | + return "mandatory"; |
| 289 | - case MAX_ELEMENT_DATA: | 294 | + case MAX_ELEMENT_DATA: |
| 290 | - return "max-elements"; | 295 | + return "max-elements"; |
| 291 | - case MIN_ELEMENT_DATA: | 296 | + case MIN_ELEMENT_DATA: |
| 292 | - return "min-elements"; | 297 | + return "min-elements"; |
| 293 | - case PRESENCE_DATA: | 298 | + case PRESENCE_DATA: |
| 294 | - return "presence"; | 299 | + return "presence"; |
| 295 | - case REFERENCE_DATA: | 300 | + case REFERENCE_DATA: |
| 296 | - return "reference"; | 301 | + return "reference"; |
| 297 | - case STATUS_DATA: | 302 | + case STATUS_DATA: |
| 298 | - return "status"; | 303 | + return "status"; |
| 299 | - case UNITS_DATA: | 304 | + case UNITS_DATA: |
| 300 | - return "units"; | 305 | + return "units"; |
| 301 | - case VERSION_DATA: | 306 | + case VERSION_DATA: |
| 302 | - return "version"; | 307 | + return "version"; |
| 303 | - case YANGBASE_DATA: | 308 | + case YANGBASE_DATA: |
| 304 | - return "yangbase"; | 309 | + return "yangbase"; |
| 305 | - case PREFIX_DATA: | 310 | + case PREFIX_DATA: |
| 306 | - return "prefix"; | 311 | + return "prefix"; |
| 307 | - case ORGANIZATION_DATA: | 312 | + case ORGANIZATION_DATA: |
| 308 | - return "organization"; | 313 | + return "organization"; |
| 309 | - case DEFAULT_DATA: | 314 | + case VALUE_DATA: |
| 310 | - return "default"; | 315 | + return "value"; |
| 311 | - default: | 316 | + case DEFAULT_DATA: |
| 312 | - return "yang"; | 317 | + return "default"; |
| 318 | + default: | ||
| 319 | + return "yang"; | ||
| 313 | } | 320 | } |
| 314 | } | 321 | } |
| 315 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 322 | +} | ... | ... |
| ... | @@ -16,8 +16,6 @@ | ... | @@ -16,8 +16,6 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.yangutils.parser.impl; | 17 | package org.onosproject.yangutils.parser.impl; |
| 18 | 18 | ||
| 19 | -import java.util.Stack; | ||
| 20 | - | ||
| 21 | import org.antlr.v4.runtime.ParserRuleContext; | 19 | import org.antlr.v4.runtime.ParserRuleContext; |
| 22 | import org.antlr.v4.runtime.tree.ErrorNode; | 20 | import org.antlr.v4.runtime.tree.ErrorNode; |
| 23 | import org.antlr.v4.runtime.tree.TerminalNode; | 21 | import org.antlr.v4.runtime.tree.TerminalNode; |
| ... | @@ -32,6 +30,8 @@ import org.onosproject.yangutils.parser.impl.listeners.ContactListener; | ... | @@ -32,6 +30,8 @@ import org.onosproject.yangutils.parser.impl.listeners.ContactListener; |
| 32 | import org.onosproject.yangutils.parser.impl.listeners.ContainerListener; | 30 | import org.onosproject.yangutils.parser.impl.listeners.ContainerListener; |
| 33 | import org.onosproject.yangutils.parser.impl.listeners.DefaultListener; | 31 | import org.onosproject.yangutils.parser.impl.listeners.DefaultListener; |
| 34 | import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener; | 32 | import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener; |
| 33 | +import org.onosproject.yangutils.parser.impl.listeners.EnumListener; | ||
| 34 | +import org.onosproject.yangutils.parser.impl.listeners.EnumerationListener; | ||
| 35 | import org.onosproject.yangutils.parser.impl.listeners.ImportListener; | 35 | import org.onosproject.yangutils.parser.impl.listeners.ImportListener; |
| 36 | import org.onosproject.yangutils.parser.impl.listeners.IncludeListener; | 36 | import org.onosproject.yangutils.parser.impl.listeners.IncludeListener; |
| 37 | import org.onosproject.yangutils.parser.impl.listeners.KeyListener; | 37 | import org.onosproject.yangutils.parser.impl.listeners.KeyListener; |
| ... | @@ -54,8 +54,11 @@ import org.onosproject.yangutils.parser.impl.listeners.SubModuleListener; | ... | @@ -54,8 +54,11 @@ import org.onosproject.yangutils.parser.impl.listeners.SubModuleListener; |
| 54 | import org.onosproject.yangutils.parser.impl.listeners.TypeDefListener; | 54 | import org.onosproject.yangutils.parser.impl.listeners.TypeDefListener; |
| 55 | import org.onosproject.yangutils.parser.impl.listeners.TypeListener; | 55 | import org.onosproject.yangutils.parser.impl.listeners.TypeListener; |
| 56 | import org.onosproject.yangutils.parser.impl.listeners.UnitsListener; | 56 | import org.onosproject.yangutils.parser.impl.listeners.UnitsListener; |
| 57 | +import org.onosproject.yangutils.parser.impl.listeners.ValueListener; | ||
| 57 | import org.onosproject.yangutils.parser.impl.listeners.VersionListener; | 58 | import org.onosproject.yangutils.parser.impl.listeners.VersionListener; |
| 58 | 59 | ||
| 60 | +import java.util.Stack; | ||
| 61 | + | ||
| 59 | /** | 62 | /** |
| 60 | * ANTLR generates a parse-tree listener interface that responds to events | 63 | * ANTLR generates a parse-tree listener interface that responds to events |
| 61 | * triggered by the built-in tree walker. The methods in listener are just | 64 | * triggered by the built-in tree walker. The methods in listener are just |
| ... | @@ -128,62 +131,62 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -128,62 +131,62 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 128 | 131 | ||
| 129 | @Override | 132 | @Override |
| 130 | public void enterModuleBody(GeneratedYangParser.ModuleBodyContext ctx) { | 133 | public void enterModuleBody(GeneratedYangParser.ModuleBodyContext ctx) { |
| 131 | - //TODO: implement the method. | 134 | + // TODO: implement the method. |
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | @Override | 137 | @Override |
| 135 | public void exitModuleBody(GeneratedYangParser.ModuleBodyContext ctx) { | 138 | public void exitModuleBody(GeneratedYangParser.ModuleBodyContext ctx) { |
| 136 | - //TODO: implement the method. | 139 | + // TODO: implement the method. |
| 137 | } | 140 | } |
| 138 | 141 | ||
| 139 | @Override | 142 | @Override |
| 140 | public void enterModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) { | 143 | public void enterModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) { |
| 141 | - //TODO: implement the method. | 144 | + // TODO: implement the method. |
| 142 | } | 145 | } |
| 143 | 146 | ||
| 144 | @Override | 147 | @Override |
| 145 | public void exitModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) { | 148 | public void exitModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext ctx) { |
| 146 | - //TODO: implement the method. | 149 | + // TODO: implement the method. |
| 147 | } | 150 | } |
| 148 | 151 | ||
| 149 | @Override | 152 | @Override |
| 150 | public void enterLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) { | 153 | public void enterLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) { |
| 151 | - //TODO: implement the method. | 154 | + // TODO: implement the method. |
| 152 | } | 155 | } |
| 153 | 156 | ||
| 154 | @Override | 157 | @Override |
| 155 | public void exitLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) { | 158 | public void exitLinkageStatements(GeneratedYangParser.LinkageStatementsContext ctx) { |
| 156 | - //TODO: implement the method. | 159 | + // TODO: implement the method. |
| 157 | } | 160 | } |
| 158 | 161 | ||
| 159 | @Override | 162 | @Override |
| 160 | public void enterMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) { | 163 | public void enterMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) { |
| 161 | - //TODO: implement the method. | 164 | + // TODO: implement the method. |
| 162 | } | 165 | } |
| 163 | 166 | ||
| 164 | @Override | 167 | @Override |
| 165 | public void exitMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) { | 168 | public void exitMetaStatements(GeneratedYangParser.MetaStatementsContext ctx) { |
| 166 | - //TODO: implement the method. | 169 | + // TODO: implement the method. |
| 167 | } | 170 | } |
| 168 | 171 | ||
| 169 | @Override | 172 | @Override |
| 170 | public void enterRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) { | 173 | public void enterRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) { |
| 171 | - //TODO: implement the method. | 174 | + // TODO: implement the method. |
| 172 | } | 175 | } |
| 173 | 176 | ||
| 174 | @Override | 177 | @Override |
| 175 | public void exitRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) { | 178 | public void exitRevisionStatements(GeneratedYangParser.RevisionStatementsContext ctx) { |
| 176 | - //TODO: implement the method. | 179 | + // TODO: implement the method. |
| 177 | } | 180 | } |
| 178 | 181 | ||
| 179 | @Override | 182 | @Override |
| 180 | public void enterBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) { | 183 | public void enterBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) { |
| 181 | - //TODO: implement the method. | 184 | + // TODO: implement the method. |
| 182 | } | 185 | } |
| 183 | 186 | ||
| 184 | @Override | 187 | @Override |
| 185 | public void exitBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) { | 188 | public void exitBodyStatements(GeneratedYangParser.BodyStatementsContext ctx) { |
| 186 | - //TODO: implement the method. | 189 | + // TODO: implement the method. |
| 187 | } | 190 | } |
| 188 | 191 | ||
| 189 | @Override | 192 | @Override |
| ... | @@ -193,7 +196,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -193,7 +196,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 193 | 196 | ||
| 194 | @Override | 197 | @Override |
| 195 | public void exitYangVersionStatement(GeneratedYangParser.YangVersionStatementContext ctx) { | 198 | public void exitYangVersionStatement(GeneratedYangParser.YangVersionStatementContext ctx) { |
| 196 | - //TODO: implement the method. | 199 | + // TODO: implement the method. |
| 197 | } | 200 | } |
| 198 | 201 | ||
| 199 | @Override | 202 | @Override |
| ... | @@ -203,7 +206,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -203,7 +206,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 203 | 206 | ||
| 204 | @Override | 207 | @Override |
| 205 | public void exitNamespaceStatement(GeneratedYangParser.NamespaceStatementContext ctx) { | 208 | public void exitNamespaceStatement(GeneratedYangParser.NamespaceStatementContext ctx) { |
| 206 | - //TODO: implement the method. | 209 | + // TODO: implement the method. |
| 207 | } | 210 | } |
| 208 | 211 | ||
| 209 | @Override | 212 | @Override |
| ... | @@ -213,7 +216,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -213,7 +216,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 213 | 216 | ||
| 214 | @Override | 217 | @Override |
| 215 | public void exitPrefixStatement(GeneratedYangParser.PrefixStatementContext ctx) { | 218 | public void exitPrefixStatement(GeneratedYangParser.PrefixStatementContext ctx) { |
| 216 | - //TODO: implement the method. | 219 | + // TODO: implement the method. |
| 217 | } | 220 | } |
| 218 | 221 | ||
| 219 | @Override | 222 | @Override |
| ... | @@ -228,12 +231,12 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -228,12 +231,12 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 228 | 231 | ||
| 229 | @Override | 232 | @Override |
| 230 | public void enterImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) { | 233 | public void enterImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) { |
| 231 | - //TODO: implement the method. | 234 | + // TODO: implement the method. |
| 232 | } | 235 | } |
| 233 | 236 | ||
| 234 | @Override | 237 | @Override |
| 235 | public void exitImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) { | 238 | public void exitImportStatementBody(GeneratedYangParser.ImportStatementBodyContext ctx) { |
| 236 | - //TODO: implement the method. | 239 | + // TODO: implement the method. |
| 237 | } | 240 | } |
| 238 | 241 | ||
| 239 | @Override | 242 | @Override |
| ... | @@ -243,7 +246,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -243,7 +246,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 243 | 246 | ||
| 244 | @Override | 247 | @Override |
| 245 | public void exitRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext ctx) { | 248 | public void exitRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext ctx) { |
| 246 | - //TODO: implement the method. | 249 | + // TODO: implement the method. |
| 247 | } | 250 | } |
| 248 | 251 | ||
| 249 | @Override | 252 | @Override |
| ... | @@ -263,7 +266,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -263,7 +266,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 263 | 266 | ||
| 264 | @Override | 267 | @Override |
| 265 | public void exitOrganizationStatement(GeneratedYangParser.OrganizationStatementContext ctx) { | 268 | public void exitOrganizationStatement(GeneratedYangParser.OrganizationStatementContext ctx) { |
| 266 | - //TODO: implement the method. | 269 | + // TODO: implement the method. |
| 267 | } | 270 | } |
| 268 | 271 | ||
| 269 | @Override | 272 | @Override |
| ... | @@ -273,7 +276,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -273,7 +276,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 273 | 276 | ||
| 274 | @Override | 277 | @Override |
| 275 | public void exitContactStatement(GeneratedYangParser.ContactStatementContext ctx) { | 278 | public void exitContactStatement(GeneratedYangParser.ContactStatementContext ctx) { |
| 276 | - //TODO: implement the method. | 279 | + // TODO: implement the method. |
| 277 | } | 280 | } |
| 278 | 281 | ||
| 279 | @Override | 282 | @Override |
| ... | @@ -283,7 +286,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -283,7 +286,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 283 | 286 | ||
| 284 | @Override | 287 | @Override |
| 285 | public void exitDescriptionStatement(GeneratedYangParser.DescriptionStatementContext ctx) { | 288 | public void exitDescriptionStatement(GeneratedYangParser.DescriptionStatementContext ctx) { |
| 286 | - //TODO: implement the method. | 289 | + // TODO: implement the method. |
| 287 | } | 290 | } |
| 288 | 291 | ||
| 289 | @Override | 292 | @Override |
| ... | @@ -293,7 +296,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -293,7 +296,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 293 | 296 | ||
| 294 | @Override | 297 | @Override |
| 295 | public void exitReferenceStatement(GeneratedYangParser.ReferenceStatementContext ctx) { | 298 | public void exitReferenceStatement(GeneratedYangParser.ReferenceStatementContext ctx) { |
| 296 | - //TODO: implement the method. | 299 | + // TODO: implement the method. |
| 297 | } | 300 | } |
| 298 | 301 | ||
| 299 | @Override | 302 | @Override |
| ... | @@ -308,12 +311,12 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -308,12 +311,12 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 308 | 311 | ||
| 309 | @Override | 312 | @Override |
| 310 | public void enterRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) { | 313 | public void enterRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) { |
| 311 | - //TODO: implement the method. | 314 | + // TODO: implement the method. |
| 312 | } | 315 | } |
| 313 | 316 | ||
| 314 | @Override | 317 | @Override |
| 315 | public void exitRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) { | 318 | public void exitRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext ctx) { |
| 316 | - //TODO: implement the method. | 319 | + // TODO: implement the method. |
| 317 | } | 320 | } |
| 318 | 321 | ||
| 319 | @Override | 322 | @Override |
| ... | @@ -328,22 +331,22 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -328,22 +331,22 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 328 | 331 | ||
| 329 | @Override | 332 | @Override |
| 330 | public void enterSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) { | 333 | public void enterSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) { |
| 331 | - //TODO: implement the method. | 334 | + // TODO: implement the method. |
| 332 | } | 335 | } |
| 333 | 336 | ||
| 334 | @Override | 337 | @Override |
| 335 | public void exitSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) { | 338 | public void exitSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext ctx) { |
| 336 | - //TODO: implement the method. | 339 | + // TODO: implement the method. |
| 337 | } | 340 | } |
| 338 | 341 | ||
| 339 | @Override | 342 | @Override |
| 340 | public void enterSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) { | 343 | public void enterSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) { |
| 341 | - //TODO: implement the method. | 344 | + // TODO: implement the method. |
| 342 | } | 345 | } |
| 343 | 346 | ||
| 344 | @Override | 347 | @Override |
| 345 | public void exitSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) { | 348 | public void exitSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext ctx) { |
| 346 | - //TODO: implement the method. | 349 | + // TODO: implement the method. |
| 347 | } | 350 | } |
| 348 | 351 | ||
| 349 | @Override | 352 | @Override |
| ... | @@ -358,132 +361,132 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -358,132 +361,132 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 358 | 361 | ||
| 359 | @Override | 362 | @Override |
| 360 | public void enterBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) { | 363 | public void enterBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) { |
| 361 | - //TODO: implement the method. | 364 | + // TODO: implement the method. |
| 362 | } | 365 | } |
| 363 | 366 | ||
| 364 | @Override | 367 | @Override |
| 365 | public void exitBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) { | 368 | public void exitBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext ctx) { |
| 366 | - //TODO: implement the method. | 369 | + // TODO: implement the method. |
| 367 | } | 370 | } |
| 368 | 371 | ||
| 369 | @Override | 372 | @Override |
| 370 | public void enterExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) { | 373 | public void enterExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) { |
| 371 | - //TODO: implement the method. | 374 | + // TODO: implement the method. |
| 372 | } | 375 | } |
| 373 | 376 | ||
| 374 | @Override | 377 | @Override |
| 375 | public void exitExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) { | 378 | public void exitExtensionStatement(GeneratedYangParser.ExtensionStatementContext ctx) { |
| 376 | - //TODO: implement the method. | 379 | + // TODO: implement the method. |
| 377 | } | 380 | } |
| 378 | 381 | ||
| 379 | @Override | 382 | @Override |
| 380 | public void enterExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) { | 383 | public void enterExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) { |
| 381 | - //TODO: implement the method. | 384 | + // TODO: implement the method. |
| 382 | } | 385 | } |
| 383 | 386 | ||
| 384 | @Override | 387 | @Override |
| 385 | public void exitExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) { | 388 | public void exitExtensionBody(GeneratedYangParser.ExtensionBodyContext ctx) { |
| 386 | - //TODO: implement the method. | 389 | + // TODO: implement the method. |
| 387 | } | 390 | } |
| 388 | 391 | ||
| 389 | @Override | 392 | @Override |
| 390 | public void enterArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) { | 393 | public void enterArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) { |
| 391 | - //TODO: implement the method. | 394 | + // TODO: implement the method. |
| 392 | } | 395 | } |
| 393 | 396 | ||
| 394 | @Override | 397 | @Override |
| 395 | public void exitArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) { | 398 | public void exitArgumentStatement(GeneratedYangParser.ArgumentStatementContext ctx) { |
| 396 | - //TODO: implement the method. | 399 | + // TODO: implement the method. |
| 397 | } | 400 | } |
| 398 | 401 | ||
| 399 | @Override | 402 | @Override |
| 400 | public void enterArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) { | 403 | public void enterArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) { |
| 401 | - //TODO: implement the method. | 404 | + // TODO: implement the method. |
| 402 | } | 405 | } |
| 403 | 406 | ||
| 404 | @Override | 407 | @Override |
| 405 | public void exitArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) { | 408 | public void exitArgumentBody(GeneratedYangParser.ArgumentBodyContext ctx) { |
| 406 | - //TODO: implement the method. | 409 | + // TODO: implement the method. |
| 407 | } | 410 | } |
| 408 | 411 | ||
| 409 | @Override | 412 | @Override |
| 410 | public void enterYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) { | 413 | public void enterYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) { |
| 411 | - //TODO: implement the method. | 414 | + // TODO: implement the method. |
| 412 | } | 415 | } |
| 413 | 416 | ||
| 414 | @Override | 417 | @Override |
| 415 | public void exitYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) { | 418 | public void exitYinElementStatement(GeneratedYangParser.YinElementStatementContext ctx) { |
| 416 | - //TODO: implement the method. | 419 | + // TODO: implement the method. |
| 417 | } | 420 | } |
| 418 | 421 | ||
| 419 | @Override | 422 | @Override |
| 420 | public void enterIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) { | 423 | public void enterIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) { |
| 421 | - //TODO: implement the method. | 424 | + // TODO: implement the method. |
| 422 | } | 425 | } |
| 423 | 426 | ||
| 424 | @Override | 427 | @Override |
| 425 | public void exitIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) { | 428 | public void exitIdentityStatement(GeneratedYangParser.IdentityStatementContext ctx) { |
| 426 | - //TODO: implement the method. | 429 | + // TODO: implement the method. |
| 427 | } | 430 | } |
| 428 | 431 | ||
| 429 | @Override | 432 | @Override |
| 430 | public void enterIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) { | 433 | public void enterIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) { |
| 431 | - //TODO: implement the method. | 434 | + // TODO: implement the method. |
| 432 | } | 435 | } |
| 433 | 436 | ||
| 434 | @Override | 437 | @Override |
| 435 | public void exitIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) { | 438 | public void exitIdentityBody(GeneratedYangParser.IdentityBodyContext ctx) { |
| 436 | - //TODO: implement the method. | 439 | + // TODO: implement the method. |
| 437 | } | 440 | } |
| 438 | 441 | ||
| 439 | @Override | 442 | @Override |
| 440 | public void enterBaseStatement(GeneratedYangParser.BaseStatementContext ctx) { | 443 | public void enterBaseStatement(GeneratedYangParser.BaseStatementContext ctx) { |
| 441 | - //TODO: implement the method. | 444 | + // TODO: implement the method. |
| 442 | } | 445 | } |
| 443 | 446 | ||
| 444 | @Override | 447 | @Override |
| 445 | public void exitBaseStatement(GeneratedYangParser.BaseStatementContext ctx) { | 448 | public void exitBaseStatement(GeneratedYangParser.BaseStatementContext ctx) { |
| 446 | - //TODO: implement the method. | 449 | + // TODO: implement the method. |
| 447 | } | 450 | } |
| 448 | 451 | ||
| 449 | @Override | 452 | @Override |
| 450 | public void enterFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) { | 453 | public void enterFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) { |
| 451 | - //TODO: implement the method. | 454 | + // TODO: implement the method. |
| 452 | } | 455 | } |
| 453 | 456 | ||
| 454 | @Override | 457 | @Override |
| 455 | public void exitFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) { | 458 | public void exitFeatureStatement(GeneratedYangParser.FeatureStatementContext ctx) { |
| 456 | - //TODO: implement the method. | 459 | + // TODO: implement the method. |
| 457 | } | 460 | } |
| 458 | 461 | ||
| 459 | @Override | 462 | @Override |
| 460 | public void enterFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) { | 463 | public void enterFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) { |
| 461 | - //TODO: implement the method. | 464 | + // TODO: implement the method. |
| 462 | } | 465 | } |
| 463 | 466 | ||
| 464 | @Override | 467 | @Override |
| 465 | public void exitFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) { | 468 | public void exitFeatureBody(GeneratedYangParser.FeatureBodyContext ctx) { |
| 466 | - //TODO: implement the method. | 469 | + // TODO: implement the method. |
| 467 | } | 470 | } |
| 468 | 471 | ||
| 469 | @Override | 472 | @Override |
| 470 | public void enterDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) { | 473 | public void enterDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) { |
| 471 | - //TODO: implement the method. | 474 | + // TODO: implement the method. |
| 472 | } | 475 | } |
| 473 | 476 | ||
| 474 | @Override | 477 | @Override |
| 475 | public void exitDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) { | 478 | public void exitDataDefStatement(GeneratedYangParser.DataDefStatementContext ctx) { |
| 476 | - //TODO: implement the method. | 479 | + // TODO: implement the method. |
| 477 | } | 480 | } |
| 478 | 481 | ||
| 479 | @Override | 482 | @Override |
| 480 | public void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) { | 483 | public void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) { |
| 481 | - //TODO: implement the method. | 484 | + // TODO: implement the method. |
| 482 | } | 485 | } |
| 483 | 486 | ||
| 484 | @Override | 487 | @Override |
| 485 | public void exitIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) { | 488 | public void exitIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) { |
| 486 | - //TODO: implement the method. | 489 | + // TODO: implement the method. |
| 487 | } | 490 | } |
| 488 | 491 | ||
| 489 | @Override | 492 | @Override |
| ... | @@ -493,7 +496,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -493,7 +496,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 493 | 496 | ||
| 494 | @Override | 497 | @Override |
| 495 | public void exitUnitsStatement(GeneratedYangParser.UnitsStatementContext ctx) { | 498 | public void exitUnitsStatement(GeneratedYangParser.UnitsStatementContext ctx) { |
| 496 | - //TODO: implement the method. | 499 | + // TODO: implement the method. |
| 497 | } | 500 | } |
| 498 | 501 | ||
| 499 | @Override | 502 | @Override |
| ... | @@ -513,77 +516,77 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -513,77 +516,77 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 513 | 516 | ||
| 514 | @Override | 517 | @Override |
| 515 | public void exitTypeStatement(GeneratedYangParser.TypeStatementContext ctx) { | 518 | public void exitTypeStatement(GeneratedYangParser.TypeStatementContext ctx) { |
| 516 | - //TODO: implement the method. | 519 | + TypeListener.processTypeExit(this, ctx); |
| 517 | } | 520 | } |
| 518 | 521 | ||
| 519 | @Override | 522 | @Override |
| 520 | public void enterTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) { | 523 | public void enterTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) { |
| 521 | - //TODO: implement the method. | 524 | + // TODO: implement the method. |
| 522 | } | 525 | } |
| 523 | 526 | ||
| 524 | @Override | 527 | @Override |
| 525 | public void exitTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) { | 528 | public void exitTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext ctx) { |
| 526 | - //TODO: implement the method. | 529 | + // TODO: implement the method. |
| 527 | } | 530 | } |
| 528 | 531 | ||
| 529 | @Override | 532 | @Override |
| 530 | public void enterNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) { | 533 | public void enterNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) { |
| 531 | - //TODO: implement the method. | 534 | + // TODO: implement the method. |
| 532 | } | 535 | } |
| 533 | 536 | ||
| 534 | @Override | 537 | @Override |
| 535 | public void exitNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) { | 538 | public void exitNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext ctx) { |
| 536 | - //TODO: implement the method. | 539 | + // TODO: implement the method. |
| 537 | } | 540 | } |
| 538 | 541 | ||
| 539 | @Override | 542 | @Override |
| 540 | public void enterRangeStatement(GeneratedYangParser.RangeStatementContext ctx) { | 543 | public void enterRangeStatement(GeneratedYangParser.RangeStatementContext ctx) { |
| 541 | - //TODO: implement the method. | 544 | + // TODO: implement the method. |
| 542 | } | 545 | } |
| 543 | 546 | ||
| 544 | @Override | 547 | @Override |
| 545 | public void exitRangeStatement(GeneratedYangParser.RangeStatementContext ctx) { | 548 | public void exitRangeStatement(GeneratedYangParser.RangeStatementContext ctx) { |
| 546 | - //TODO: implement the method. | 549 | + // TODO: implement the method. |
| 547 | } | 550 | } |
| 548 | 551 | ||
| 549 | @Override | 552 | @Override |
| 550 | public void enterCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) { | 553 | public void enterCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) { |
| 551 | - //TODO: implement the method. | 554 | + // TODO: implement the method. |
| 552 | } | 555 | } |
| 553 | 556 | ||
| 554 | @Override | 557 | @Override |
| 555 | public void exitCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) { | 558 | public void exitCommonStatements(GeneratedYangParser.CommonStatementsContext ctx) { |
| 556 | - //TODO: implement the method. | 559 | + // TODO: implement the method. |
| 557 | } | 560 | } |
| 558 | 561 | ||
| 559 | @Override | 562 | @Override |
| 560 | public void enterStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) { | 563 | public void enterStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) { |
| 561 | - //TODO: implement the method. | 564 | + // TODO: implement the method. |
| 562 | } | 565 | } |
| 563 | 566 | ||
| 564 | @Override | 567 | @Override |
| 565 | public void exitStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) { | 568 | public void exitStringRestrictions(GeneratedYangParser.StringRestrictionsContext ctx) { |
| 566 | - //TODO: implement the method. | 569 | + // TODO: implement the method. |
| 567 | } | 570 | } |
| 568 | 571 | ||
| 569 | @Override | 572 | @Override |
| 570 | public void enterLengthStatement(GeneratedYangParser.LengthStatementContext ctx) { | 573 | public void enterLengthStatement(GeneratedYangParser.LengthStatementContext ctx) { |
| 571 | - //TODO: implement the method. | 574 | + // TODO: implement the method. |
| 572 | } | 575 | } |
| 573 | 576 | ||
| 574 | @Override | 577 | @Override |
| 575 | public void exitLengthStatement(GeneratedYangParser.LengthStatementContext ctx) { | 578 | public void exitLengthStatement(GeneratedYangParser.LengthStatementContext ctx) { |
| 576 | - //TODO: implement the method. | 579 | + // TODO: implement the method. |
| 577 | } | 580 | } |
| 578 | 581 | ||
| 579 | @Override | 582 | @Override |
| 580 | public void enterPatternStatement(GeneratedYangParser.PatternStatementContext ctx) { | 583 | public void enterPatternStatement(GeneratedYangParser.PatternStatementContext ctx) { |
| 581 | - //TODO: implement the method. | 584 | + // TODO: implement the method. |
| 582 | } | 585 | } |
| 583 | 586 | ||
| 584 | @Override | 587 | @Override |
| 585 | public void exitPatternStatement(GeneratedYangParser.PatternStatementContext ctx) { | 588 | public void exitPatternStatement(GeneratedYangParser.PatternStatementContext ctx) { |
| 586 | - //TODO: implement the method. | 589 | + // TODO: implement the method. |
| 587 | } | 590 | } |
| 588 | 591 | ||
| 589 | @Override | 592 | @Override |
| ... | @@ -593,137 +596,137 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -593,137 +596,137 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 593 | 596 | ||
| 594 | @Override | 597 | @Override |
| 595 | public void exitDefaultStatement(GeneratedYangParser.DefaultStatementContext ctx) { | 598 | public void exitDefaultStatement(GeneratedYangParser.DefaultStatementContext ctx) { |
| 596 | - //TODO: implement the method. | 599 | + // TODO: implement the method. |
| 597 | } | 600 | } |
| 598 | 601 | ||
| 599 | @Override | 602 | @Override |
| 600 | public void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) { | 603 | public void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) { |
| 601 | - //TODO: implement the method. | 604 | + EnumerationListener.processEnumerationEntry(this, ctx); |
| 602 | } | 605 | } |
| 603 | 606 | ||
| 604 | @Override | 607 | @Override |
| 605 | public void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) { | 608 | public void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) { |
| 606 | - //TODO: implement the method. | 609 | + EnumerationListener.processEnumerationExit(this, ctx); |
| 607 | } | 610 | } |
| 608 | 611 | ||
| 609 | @Override | 612 | @Override |
| 610 | public void enterEnumStatement(GeneratedYangParser.EnumStatementContext ctx) { | 613 | public void enterEnumStatement(GeneratedYangParser.EnumStatementContext ctx) { |
| 611 | - //TODO: implement the method. | 614 | + EnumListener.processEnumEntry(this, ctx); |
| 612 | } | 615 | } |
| 613 | 616 | ||
| 614 | @Override | 617 | @Override |
| 615 | public void exitEnumStatement(GeneratedYangParser.EnumStatementContext ctx) { | 618 | public void exitEnumStatement(GeneratedYangParser.EnumStatementContext ctx) { |
| 616 | - //TODO: implement the method. | 619 | + EnumListener.processEnumExit(this, ctx); |
| 617 | } | 620 | } |
| 618 | 621 | ||
| 619 | @Override | 622 | @Override |
| 620 | public void enterEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) { | 623 | public void enterEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) { |
| 621 | - //TODO: implement the method. | 624 | + // TODO: implement the method. |
| 622 | } | 625 | } |
| 623 | 626 | ||
| 624 | @Override | 627 | @Override |
| 625 | public void exitEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) { | 628 | public void exitEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext ctx) { |
| 626 | - //TODO: implement the method. | 629 | + // TODO: implement the method. |
| 627 | } | 630 | } |
| 628 | 631 | ||
| 629 | @Override | 632 | @Override |
| 630 | public void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) { | 633 | public void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) { |
| 631 | - //TODO: implement the method. | 634 | + // TODO: implement the method. |
| 632 | } | 635 | } |
| 633 | 636 | ||
| 634 | @Override | 637 | @Override |
| 635 | public void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) { | 638 | public void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) { |
| 636 | - //TODO: implement the method. | 639 | + // TODO: implement the method. |
| 637 | } | 640 | } |
| 638 | 641 | ||
| 639 | @Override | 642 | @Override |
| 640 | public void enterPathStatement(GeneratedYangParser.PathStatementContext ctx) { | 643 | public void enterPathStatement(GeneratedYangParser.PathStatementContext ctx) { |
| 641 | - //TODO: implement the method. | 644 | + // TODO: implement the method. |
| 642 | } | 645 | } |
| 643 | 646 | ||
| 644 | @Override | 647 | @Override |
| 645 | public void exitPathStatement(GeneratedYangParser.PathStatementContext ctx) { | 648 | public void exitPathStatement(GeneratedYangParser.PathStatementContext ctx) { |
| 646 | - //TODO: implement the method. | 649 | + // TODO: implement the method. |
| 647 | } | 650 | } |
| 648 | 651 | ||
| 649 | @Override | 652 | @Override |
| 650 | public void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) { | 653 | public void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) { |
| 651 | - //TODO: implement the method. | 654 | + // TODO: implement the method. |
| 652 | } | 655 | } |
| 653 | 656 | ||
| 654 | @Override | 657 | @Override |
| 655 | public void exitRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) { | 658 | public void exitRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) { |
| 656 | - //TODO: implement the method. | 659 | + // TODO: implement the method. |
| 657 | } | 660 | } |
| 658 | 661 | ||
| 659 | @Override | 662 | @Override |
| 660 | public void enterInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) { | 663 | public void enterInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) { |
| 661 | - //TODO: implement the method. | 664 | + // TODO: implement the method. |
| 662 | } | 665 | } |
| 663 | 666 | ||
| 664 | @Override | 667 | @Override |
| 665 | public void exitInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) { | 668 | public void exitInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext ctx) { |
| 666 | - //TODO: implement the method. | 669 | + // TODO: implement the method. |
| 667 | } | 670 | } |
| 668 | 671 | ||
| 669 | @Override | 672 | @Override |
| 670 | public void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) { | 673 | public void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) { |
| 671 | - //TODO: implement the method. | 674 | + // TODO: implement the method. |
| 672 | } | 675 | } |
| 673 | 676 | ||
| 674 | @Override | 677 | @Override |
| 675 | public void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) { | 678 | public void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) { |
| 676 | - //TODO: implement the method. | 679 | + // TODO: implement the method. |
| 677 | } | 680 | } |
| 678 | 681 | ||
| 679 | @Override | 682 | @Override |
| 680 | public void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) { | 683 | public void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) { |
| 681 | - //TODO: implement the method. | 684 | + // TODO: implement the method. |
| 682 | } | 685 | } |
| 683 | 686 | ||
| 684 | @Override | 687 | @Override |
| 685 | public void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) { | 688 | public void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) { |
| 686 | - //TODO: implement the method. | 689 | + // TODO: implement the method. |
| 687 | } | 690 | } |
| 688 | 691 | ||
| 689 | @Override | 692 | @Override |
| 690 | public void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) { | 693 | public void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) { |
| 691 | - //TODO: implement the method. | 694 | + // TODO: implement the method. |
| 692 | } | 695 | } |
| 693 | 696 | ||
| 694 | @Override | 697 | @Override |
| 695 | public void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) { | 698 | public void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) { |
| 696 | - //TODO: implement the method. | 699 | + // TODO: implement the method. |
| 697 | } | 700 | } |
| 698 | 701 | ||
| 699 | @Override | 702 | @Override |
| 700 | public void enterBitStatement(GeneratedYangParser.BitStatementContext ctx) { | 703 | public void enterBitStatement(GeneratedYangParser.BitStatementContext ctx) { |
| 701 | - //TODO: implement the method. | 704 | + // TODO: implement the method. |
| 702 | } | 705 | } |
| 703 | 706 | ||
| 704 | @Override | 707 | @Override |
| 705 | public void exitBitStatement(GeneratedYangParser.BitStatementContext ctx) { | 708 | public void exitBitStatement(GeneratedYangParser.BitStatementContext ctx) { |
| 706 | - //TODO: implement the method. | 709 | + // TODO: implement the method. |
| 707 | } | 710 | } |
| 708 | 711 | ||
| 709 | @Override | 712 | @Override |
| 710 | public void enterBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) { | 713 | public void enterBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) { |
| 711 | - //TODO: implement the method. | 714 | + // TODO: implement the method. |
| 712 | } | 715 | } |
| 713 | 716 | ||
| 714 | @Override | 717 | @Override |
| 715 | public void exitBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) { | 718 | public void exitBitBodyStatement(GeneratedYangParser.BitBodyStatementContext ctx) { |
| 716 | - //TODO: implement the method. | 719 | + // TODO: implement the method. |
| 717 | } | 720 | } |
| 718 | 721 | ||
| 719 | @Override | 722 | @Override |
| 720 | public void enterPositionStatement(GeneratedYangParser.PositionStatementContext ctx) { | 723 | public void enterPositionStatement(GeneratedYangParser.PositionStatementContext ctx) { |
| 721 | - //TODO: implement the method. | 724 | + // TODO: implement the method. |
| 722 | } | 725 | } |
| 723 | 726 | ||
| 724 | @Override | 727 | @Override |
| 725 | public void exitPositionStatement(GeneratedYangParser.PositionStatementContext ctx) { | 728 | public void exitPositionStatement(GeneratedYangParser.PositionStatementContext ctx) { |
| 726 | - //TODO: implement the method. | 729 | + // TODO: implement the method. |
| 727 | } | 730 | } |
| 728 | 731 | ||
| 729 | @Override | 732 | @Override |
| ... | @@ -733,7 +736,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -733,7 +736,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 733 | 736 | ||
| 734 | @Override | 737 | @Override |
| 735 | public void exitStatusStatement(GeneratedYangParser.StatusStatementContext ctx) { | 738 | public void exitStatusStatement(GeneratedYangParser.StatusStatementContext ctx) { |
| 736 | - //TODO: implement the method. | 739 | + // TODO: implement the method. |
| 737 | } | 740 | } |
| 738 | 741 | ||
| 739 | @Override | 742 | @Override |
| ... | @@ -743,7 +746,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -743,7 +746,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 743 | 746 | ||
| 744 | @Override | 747 | @Override |
| 745 | public void exitConfigStatement(GeneratedYangParser.ConfigStatementContext ctx) { | 748 | public void exitConfigStatement(GeneratedYangParser.ConfigStatementContext ctx) { |
| 746 | - //TODO: implement the method. | 749 | + // TODO: implement the method. |
| 747 | } | 750 | } |
| 748 | 751 | ||
| 749 | @Override | 752 | @Override |
| ... | @@ -753,7 +756,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -753,7 +756,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 753 | 756 | ||
| 754 | @Override | 757 | @Override |
| 755 | public void exitMandatoryStatement(GeneratedYangParser.MandatoryStatementContext ctx) { | 758 | public void exitMandatoryStatement(GeneratedYangParser.MandatoryStatementContext ctx) { |
| 756 | - //TODO: implement the method. | 759 | + // TODO: implement the method. |
| 757 | } | 760 | } |
| 758 | 761 | ||
| 759 | @Override | 762 | @Override |
| ... | @@ -763,47 +766,47 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -763,47 +766,47 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 763 | 766 | ||
| 764 | @Override | 767 | @Override |
| 765 | public void exitPresenceStatement(GeneratedYangParser.PresenceStatementContext ctx) { | 768 | public void exitPresenceStatement(GeneratedYangParser.PresenceStatementContext ctx) { |
| 766 | - //TODO: implement the method. | 769 | + // TODO: implement the method. |
| 767 | } | 770 | } |
| 768 | 771 | ||
| 769 | @Override | 772 | @Override |
| 770 | public void enterOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) { | 773 | public void enterOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) { |
| 771 | - //TODO: implement the method. | 774 | + // TODO: implement the method. |
| 772 | } | 775 | } |
| 773 | 776 | ||
| 774 | @Override | 777 | @Override |
| 775 | public void exitOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) { | 778 | public void exitOrderedByStatement(GeneratedYangParser.OrderedByStatementContext ctx) { |
| 776 | - //TODO: implement the method. | 779 | + // TODO: implement the method. |
| 777 | } | 780 | } |
| 778 | 781 | ||
| 779 | @Override | 782 | @Override |
| 780 | public void enterMustStatement(GeneratedYangParser.MustStatementContext ctx) { | 783 | public void enterMustStatement(GeneratedYangParser.MustStatementContext ctx) { |
| 781 | - //TODO: implement the method. | 784 | + // TODO: implement the method. |
| 782 | } | 785 | } |
| 783 | 786 | ||
| 784 | @Override | 787 | @Override |
| 785 | public void exitMustStatement(GeneratedYangParser.MustStatementContext ctx) { | 788 | public void exitMustStatement(GeneratedYangParser.MustStatementContext ctx) { |
| 786 | - //TODO: implement the method. | 789 | + // TODO: implement the method. |
| 787 | } | 790 | } |
| 788 | 791 | ||
| 789 | @Override | 792 | @Override |
| 790 | public void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) { | 793 | public void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) { |
| 791 | - //TODO: implement the method. | 794 | + // TODO: implement the method. |
| 792 | } | 795 | } |
| 793 | 796 | ||
| 794 | @Override | 797 | @Override |
| 795 | public void exitErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) { | 798 | public void exitErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) { |
| 796 | - //TODO: implement the method. | 799 | + // TODO: implement the method. |
| 797 | } | 800 | } |
| 798 | 801 | ||
| 799 | @Override | 802 | @Override |
| 800 | public void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) { | 803 | public void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) { |
| 801 | - //TODO: implement the method. | 804 | + // TODO: implement the method. |
| 802 | } | 805 | } |
| 803 | 806 | ||
| 804 | @Override | 807 | @Override |
| 805 | public void exitErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) { | 808 | public void exitErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) { |
| 806 | - //TODO: implement the method. | 809 | + // TODO: implement the method. |
| 807 | } | 810 | } |
| 808 | 811 | ||
| 809 | @Override | 812 | @Override |
| ... | @@ -813,7 +816,7 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -813,7 +816,7 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 813 | 816 | ||
| 814 | @Override | 817 | @Override |
| 815 | public void exitMinElementsStatement(GeneratedYangParser.MinElementsStatementContext ctx) { | 818 | public void exitMinElementsStatement(GeneratedYangParser.MinElementsStatementContext ctx) { |
| 816 | - //TODO: implement the method. | 819 | + // TODO: implement the method. |
| 817 | } | 820 | } |
| 818 | 821 | ||
| 819 | @Override | 822 | @Override |
| ... | @@ -823,37 +826,37 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -823,37 +826,37 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 823 | 826 | ||
| 824 | @Override | 827 | @Override |
| 825 | public void exitMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext ctx) { | 828 | public void exitMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext ctx) { |
| 826 | - //TODO: implement the method. | 829 | + // TODO: implement the method. |
| 827 | } | 830 | } |
| 828 | 831 | ||
| 829 | @Override | 832 | @Override |
| 830 | public void enterMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext ctx) { | 833 | public void enterMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext ctx) { |
| 831 | - //TODO: implement the method. | 834 | + // TODO: implement the method. |
| 832 | } | 835 | } |
| 833 | 836 | ||
| 834 | @Override | 837 | @Override |
| 835 | public void exitMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext ctx) { | 838 | public void exitMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext ctx) { |
| 836 | - //TODO: implement the method. | 839 | + // TODO: implement the method. |
| 837 | } | 840 | } |
| 838 | 841 | ||
| 839 | @Override | 842 | @Override |
| 840 | public void enterValueStatement(GeneratedYangParser.ValueStatementContext ctx) { | 843 | public void enterValueStatement(GeneratedYangParser.ValueStatementContext ctx) { |
| 841 | - //TODO: implement the method. | 844 | + ValueListener.processValueEntry(this, ctx); |
| 842 | } | 845 | } |
| 843 | 846 | ||
| 844 | @Override | 847 | @Override |
| 845 | public void exitValueStatement(GeneratedYangParser.ValueStatementContext ctx) { | 848 | public void exitValueStatement(GeneratedYangParser.ValueStatementContext ctx) { |
| 846 | - //TODO: implement the method. | 849 | + // TODO: implement the method. |
| 847 | } | 850 | } |
| 848 | 851 | ||
| 849 | @Override | 852 | @Override |
| 850 | public void enterGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) { | 853 | public void enterGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) { |
| 851 | - //TODO: implement the method. | 854 | + // TODO: implement the method. |
| 852 | } | 855 | } |
| 853 | 856 | ||
| 854 | @Override | 857 | @Override |
| 855 | public void exitGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) { | 858 | public void exitGroupingStatement(GeneratedYangParser.GroupingStatementContext ctx) { |
| 856 | - //TODO: implement the method. | 859 | + // TODO: implement the method. |
| 857 | } | 860 | } |
| 858 | 861 | ||
| 859 | @Override | 862 | @Override |
| ... | @@ -903,276 +906,276 @@ public class TreeWalkListener implements GeneratedYangListener { | ... | @@ -903,276 +906,276 @@ public class TreeWalkListener implements GeneratedYangListener { |
| 903 | 906 | ||
| 904 | @Override | 907 | @Override |
| 905 | public void exitKeyStatement(GeneratedYangParser.KeyStatementContext ctx) { | 908 | public void exitKeyStatement(GeneratedYangParser.KeyStatementContext ctx) { |
| 906 | - //TODO: implement the method. | 909 | + // TODO: implement the method. |
| 907 | } | 910 | } |
| 908 | 911 | ||
| 909 | @Override | 912 | @Override |
| 910 | public void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) { | 913 | public void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) { |
| 911 | - //TODO: implement the method. | 914 | + // TODO: implement the method. |
| 912 | } | 915 | } |
| 913 | 916 | ||
| 914 | @Override | 917 | @Override |
| 915 | public void exitUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) { | 918 | public void exitUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) { |
| 916 | - //TODO: implement the method. | 919 | + // TODO: implement the method. |
| 917 | } | 920 | } |
| 918 | 921 | ||
| 919 | @Override | 922 | @Override |
| 920 | public void enterChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) { | 923 | public void enterChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) { |
| 921 | - //TODO: implement the method. | 924 | + // TODO: implement the method. |
| 922 | } | 925 | } |
| 923 | 926 | ||
| 924 | @Override | 927 | @Override |
| 925 | public void exitChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) { | 928 | public void exitChoiceStatement(GeneratedYangParser.ChoiceStatementContext ctx) { |
| 926 | - //TODO: implement the method. | 929 | + // TODO: implement the method. |
| 927 | } | 930 | } |
| 928 | 931 | ||
| 929 | @Override | 932 | @Override |
| 930 | public void enterShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) { | 933 | public void enterShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) { |
| 931 | - //TODO: implement the method. | 934 | + // TODO: implement the method. |
| 932 | } | 935 | } |
| 933 | 936 | ||
| 934 | @Override | 937 | @Override |
| 935 | public void exitShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) { | 938 | public void exitShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext ctx) { |
| 936 | - //TODO: implement the method. | 939 | + // TODO: implement the method. |
| 937 | } | 940 | } |
| 938 | 941 | ||
| 939 | @Override | 942 | @Override |
| 940 | public void enterCaseStatement(GeneratedYangParser.CaseStatementContext ctx) { | 943 | public void enterCaseStatement(GeneratedYangParser.CaseStatementContext ctx) { |
| 941 | - //TODO: implement the method. | 944 | + // TODO: implement the method. |
| 942 | } | 945 | } |
| 943 | 946 | ||
| 944 | @Override | 947 | @Override |
| 945 | public void exitCaseStatement(GeneratedYangParser.CaseStatementContext ctx) { | 948 | public void exitCaseStatement(GeneratedYangParser.CaseStatementContext ctx) { |
| 946 | - //TODO: implement the method. | 949 | + // TODO: implement the method. |
| 947 | } | 950 | } |
| 948 | 951 | ||
| 949 | @Override | 952 | @Override |
| 950 | public void enterUsesStatement(GeneratedYangParser.UsesStatementContext ctx) { | 953 | public void enterUsesStatement(GeneratedYangParser.UsesStatementContext ctx) { |
| 951 | - //TODO: implement the method. | 954 | + // TODO: implement the method. |
| 952 | } | 955 | } |
| 953 | 956 | ||
| 954 | @Override | 957 | @Override |
| 955 | public void exitUsesStatement(GeneratedYangParser.UsesStatementContext ctx) { | 958 | public void exitUsesStatement(GeneratedYangParser.UsesStatementContext ctx) { |
| 956 | - //TODO: implement the method. | 959 | + // TODO: implement the method. |
| 957 | } | 960 | } |
| 958 | 961 | ||
| 959 | @Override | 962 | @Override |
| 960 | public void enterRefineStatement(GeneratedYangParser.RefineStatementContext ctx) { | 963 | public void enterRefineStatement(GeneratedYangParser.RefineStatementContext ctx) { |
| 961 | - //TODO: implement the method. | 964 | + // TODO: implement the method. |
| 962 | } | 965 | } |
| 963 | 966 | ||
| 964 | @Override | 967 | @Override |
| 965 | public void exitRefineStatement(GeneratedYangParser.RefineStatementContext ctx) { | 968 | public void exitRefineStatement(GeneratedYangParser.RefineStatementContext ctx) { |
| 966 | - //TODO: implement the method. | 969 | + // TODO: implement the method. |
| 967 | } | 970 | } |
| 968 | 971 | ||
| 969 | @Override | 972 | @Override |
| 970 | public void enterRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) { | 973 | public void enterRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) { |
| 971 | - //TODO: implement the method. | 974 | + // TODO: implement the method. |
| 972 | } | 975 | } |
| 973 | 976 | ||
| 974 | @Override | 977 | @Override |
| 975 | public void exitRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) { | 978 | public void exitRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext ctx) { |
| 976 | - //TODO: implement the method. | 979 | + // TODO: implement the method. |
| 977 | } | 980 | } |
| 978 | 981 | ||
| 979 | @Override | 982 | @Override |
| 980 | public void enterRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) { | 983 | public void enterRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) { |
| 981 | - //TODO: implement the method. | 984 | + // TODO: implement the method. |
| 982 | } | 985 | } |
| 983 | 986 | ||
| 984 | @Override | 987 | @Override |
| 985 | public void exitRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) { | 988 | public void exitRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext ctx) { |
| 986 | - //TODO: implement the method. | 989 | + // TODO: implement the method. |
| 987 | } | 990 | } |
| 988 | 991 | ||
| 989 | @Override | 992 | @Override |
| 990 | public void enterRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) { | 993 | public void enterRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) { |
| 991 | - //TODO: implement the method. | 994 | + // TODO: implement the method. |
| 992 | } | 995 | } |
| 993 | 996 | ||
| 994 | @Override | 997 | @Override |
| 995 | public void exitRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) { | 998 | public void exitRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext ctx) { |
| 996 | - //TODO: implement the method. | 999 | + // TODO: implement the method. |
| 997 | } | 1000 | } |
| 998 | 1001 | ||
| 999 | @Override | 1002 | @Override |
| 1000 | public void enterRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) { | 1003 | public void enterRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) { |
| 1001 | - //TODO: implement the method. | 1004 | + // TODO: implement the method. |
| 1002 | } | 1005 | } |
| 1003 | 1006 | ||
| 1004 | @Override | 1007 | @Override |
| 1005 | public void exitRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) { | 1008 | public void exitRefineListStatements(GeneratedYangParser.RefineListStatementsContext ctx) { |
| 1006 | - //TODO: implement the method. | 1009 | + // TODO: implement the method. |
| 1007 | } | 1010 | } |
| 1008 | 1011 | ||
| 1009 | @Override | 1012 | @Override |
| 1010 | public void enterRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) { | 1013 | public void enterRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) { |
| 1011 | - //TODO: implement the method. | 1014 | + // TODO: implement the method. |
| 1012 | } | 1015 | } |
| 1013 | 1016 | ||
| 1014 | @Override | 1017 | @Override |
| 1015 | public void exitRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) { | 1018 | public void exitRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext ctx) { |
| 1016 | - //TODO: implement the method. | 1019 | + // TODO: implement the method. |
| 1017 | } | 1020 | } |
| 1018 | 1021 | ||
| 1019 | @Override | 1022 | @Override |
| 1020 | public void enterRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) { | 1023 | public void enterRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) { |
| 1021 | - //TODO: implement the method. | 1024 | + // TODO: implement the method. |
| 1022 | } | 1025 | } |
| 1023 | 1026 | ||
| 1024 | @Override | 1027 | @Override |
| 1025 | public void exitRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) { | 1028 | public void exitRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext ctx) { |
| 1026 | - //TODO: implement the method. | 1029 | + // TODO: implement the method. |
| 1027 | } | 1030 | } |
| 1028 | 1031 | ||
| 1029 | @Override | 1032 | @Override |
| 1030 | public void enterUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext ctx) { | 1033 | public void enterUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext ctx) { |
| 1031 | - //TODO: implement the method. | 1034 | + // TODO: implement the method. |
| 1032 | } | 1035 | } |
| 1033 | 1036 | ||
| 1034 | @Override | 1037 | @Override |
| 1035 | public void exitUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext ctx) { | 1038 | public void exitUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext ctx) { |
| 1036 | - //TODO: implement the method. | 1039 | + // TODO: implement the method. |
| 1037 | } | 1040 | } |
| 1038 | 1041 | ||
| 1039 | @Override | 1042 | @Override |
| 1040 | public void enterAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) { | 1043 | public void enterAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) { |
| 1041 | - //TODO: implement the method. | 1044 | + // TODO: implement the method. |
| 1042 | } | 1045 | } |
| 1043 | 1046 | ||
| 1044 | @Override | 1047 | @Override |
| 1045 | public void exitAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) { | 1048 | public void exitAugmentStatement(GeneratedYangParser.AugmentStatementContext ctx) { |
| 1046 | - //TODO: implement the method. | 1049 | + // TODO: implement the method. |
| 1047 | } | 1050 | } |
| 1048 | 1051 | ||
| 1049 | @Override | 1052 | @Override |
| 1050 | public void enterWhenStatement(GeneratedYangParser.WhenStatementContext ctx) { | 1053 | public void enterWhenStatement(GeneratedYangParser.WhenStatementContext ctx) { |
| 1051 | - //TODO: implement the method. | 1054 | + // TODO: implement the method. |
| 1052 | } | 1055 | } |
| 1053 | 1056 | ||
| 1054 | @Override | 1057 | @Override |
| 1055 | public void exitWhenStatement(GeneratedYangParser.WhenStatementContext ctx) { | 1058 | public void exitWhenStatement(GeneratedYangParser.WhenStatementContext ctx) { |
| 1056 | - //TODO: implement the method. | 1059 | + // TODO: implement the method. |
| 1057 | } | 1060 | } |
| 1058 | 1061 | ||
| 1059 | @Override | 1062 | @Override |
| 1060 | public void enterRpcStatement(GeneratedYangParser.RpcStatementContext ctx) { | 1063 | public void enterRpcStatement(GeneratedYangParser.RpcStatementContext ctx) { |
| 1061 | - //TODO: implement the method. | 1064 | + // TODO: implement the method. |
| 1062 | } | 1065 | } |
| 1063 | 1066 | ||
| 1064 | @Override | 1067 | @Override |
| 1065 | public void exitRpcStatement(GeneratedYangParser.RpcStatementContext ctx) { | 1068 | public void exitRpcStatement(GeneratedYangParser.RpcStatementContext ctx) { |
| 1066 | - //TODO: implement the method. | 1069 | + // TODO: implement the method. |
| 1067 | } | 1070 | } |
| 1068 | 1071 | ||
| 1069 | @Override | 1072 | @Override |
| 1070 | public void enterInputStatement(GeneratedYangParser.InputStatementContext ctx) { | 1073 | public void enterInputStatement(GeneratedYangParser.InputStatementContext ctx) { |
| 1071 | - //TODO: implement the method. | 1074 | + // TODO: implement the method. |
| 1072 | } | 1075 | } |
| 1073 | 1076 | ||
| 1074 | @Override | 1077 | @Override |
| 1075 | public void exitInputStatement(GeneratedYangParser.InputStatementContext ctx) { | 1078 | public void exitInputStatement(GeneratedYangParser.InputStatementContext ctx) { |
| 1076 | - //TODO: implement the method. | 1079 | + // TODO: implement the method. |
| 1077 | } | 1080 | } |
| 1078 | 1081 | ||
| 1079 | @Override | 1082 | @Override |
| 1080 | public void enterOutputStatement(GeneratedYangParser.OutputStatementContext ctx) { | 1083 | public void enterOutputStatement(GeneratedYangParser.OutputStatementContext ctx) { |
| 1081 | - //TODO: implement the method. | 1084 | + // TODO: implement the method. |
| 1082 | } | 1085 | } |
| 1083 | 1086 | ||
| 1084 | @Override | 1087 | @Override |
| 1085 | public void exitOutputStatement(GeneratedYangParser.OutputStatementContext ctx) { | 1088 | public void exitOutputStatement(GeneratedYangParser.OutputStatementContext ctx) { |
| 1086 | - //TODO: implement the method. | 1089 | + // TODO: implement the method. |
| 1087 | } | 1090 | } |
| 1088 | 1091 | ||
| 1089 | @Override | 1092 | @Override |
| 1090 | public void enterNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) { | 1093 | public void enterNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) { |
| 1091 | - //TODO: implement the method. | 1094 | + // TODO: implement the method. |
| 1092 | } | 1095 | } |
| 1093 | 1096 | ||
| 1094 | @Override | 1097 | @Override |
| 1095 | public void exitNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) { | 1098 | public void exitNotificationStatement(GeneratedYangParser.NotificationStatementContext ctx) { |
| 1096 | - //TODO: implement the method. | 1099 | + // TODO: implement the method. |
| 1097 | } | 1100 | } |
| 1098 | 1101 | ||
| 1099 | @Override | 1102 | @Override |
| 1100 | public void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) { | 1103 | public void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) { |
| 1101 | - //TODO: implement the method. | 1104 | + // TODO: implement the method. |
| 1102 | } | 1105 | } |
| 1103 | 1106 | ||
| 1104 | @Override | 1107 | @Override |
| 1105 | public void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) { | 1108 | public void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) { |
| 1106 | - //TODO: implement the method. | 1109 | + // TODO: implement the method. |
| 1107 | } | 1110 | } |
| 1108 | 1111 | ||
| 1109 | @Override | 1112 | @Override |
| 1110 | public void enterDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) { | 1113 | public void enterDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) { |
| 1111 | - //TODO: implement the method. | 1114 | + // TODO: implement the method. |
| 1112 | } | 1115 | } |
| 1113 | 1116 | ||
| 1114 | @Override | 1117 | @Override |
| 1115 | public void exitDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) { | 1118 | public void exitDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext ctx) { |
| 1116 | - //TODO: implement the method. | 1119 | + // TODO: implement the method. |
| 1117 | } | 1120 | } |
| 1118 | 1121 | ||
| 1119 | @Override | 1122 | @Override |
| 1120 | public void enterDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) { | 1123 | public void enterDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) { |
| 1121 | - //TODO: implement the method. | 1124 | + // TODO: implement the method. |
| 1122 | } | 1125 | } |
| 1123 | 1126 | ||
| 1124 | @Override | 1127 | @Override |
| 1125 | public void exitDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) { | 1128 | public void exitDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext ctx) { |
| 1126 | - //TODO: implement the method. | 1129 | + // TODO: implement the method. |
| 1127 | } | 1130 | } |
| 1128 | 1131 | ||
| 1129 | @Override | 1132 | @Override |
| 1130 | public void enterDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) { | 1133 | public void enterDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) { |
| 1131 | - //TODO: implement the method. | 1134 | + // TODO: implement the method. |
| 1132 | } | 1135 | } |
| 1133 | 1136 | ||
| 1134 | @Override | 1137 | @Override |
| 1135 | public void exitDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) { | 1138 | public void exitDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext ctx) { |
| 1136 | - //TODO: implement the method. | 1139 | + // TODO: implement the method. |
| 1137 | } | 1140 | } |
| 1138 | 1141 | ||
| 1139 | @Override | 1142 | @Override |
| 1140 | public void enterDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) { | 1143 | public void enterDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) { |
| 1141 | - //TODO: implement the method. | 1144 | + // TODO: implement the method. |
| 1142 | } | 1145 | } |
| 1143 | 1146 | ||
| 1144 | @Override | 1147 | @Override |
| 1145 | public void exitDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) { | 1148 | public void exitDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext ctx) { |
| 1146 | - //TODO: implement the method. | 1149 | + // TODO: implement the method. |
| 1147 | } | 1150 | } |
| 1148 | 1151 | ||
| 1149 | @Override | 1152 | @Override |
| 1150 | public void enterString(GeneratedYangParser.StringContext ctx) { | 1153 | public void enterString(GeneratedYangParser.StringContext ctx) { |
| 1151 | - //TODO: implement the method. | 1154 | + // TODO: implement the method. |
| 1152 | } | 1155 | } |
| 1153 | 1156 | ||
| 1154 | @Override | 1157 | @Override |
| 1155 | public void exitString(GeneratedYangParser.StringContext ctx) { | 1158 | public void exitString(GeneratedYangParser.StringContext ctx) { |
| 1156 | - //TODO: implement the method. | 1159 | + // TODO: implement the method. |
| 1157 | } | 1160 | } |
| 1158 | 1161 | ||
| 1159 | @Override | 1162 | @Override |
| 1160 | public void visitTerminal(TerminalNode terminalNode) { | 1163 | public void visitTerminal(TerminalNode terminalNode) { |
| 1161 | - //TODO: implement the method. | 1164 | + // TODO: implement the method. |
| 1162 | } | 1165 | } |
| 1163 | 1166 | ||
| 1164 | @Override | 1167 | @Override |
| 1165 | public void visitErrorNode(ErrorNode errorNode) { | 1168 | public void visitErrorNode(ErrorNode errorNode) { |
| 1166 | - //TODO: implement the method. | 1169 | + // TODO: implement the method. |
| 1167 | } | 1170 | } |
| 1168 | 1171 | ||
| 1169 | @Override | 1172 | @Override |
| 1170 | public void enterEveryRule(ParserRuleContext parserRuleContext) { | 1173 | public void enterEveryRule(ParserRuleContext parserRuleContext) { |
| 1171 | - //TODO: implement the method. | 1174 | + // TODO: implement the method. |
| 1172 | } | 1175 | } |
| 1173 | 1176 | ||
| 1174 | @Override | 1177 | @Override |
| 1175 | public void exitEveryRule(ParserRuleContext parserRuleContext) { | 1178 | public void exitEveryRule(ParserRuleContext parserRuleContext) { |
| 1176 | - //TODO: implement the method. | 1179 | + // TODO: implement the method. |
| 1177 | } | 1180 | } |
| 1178 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1181 | +} | ... | ... |
utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2014-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 | +/* | ||
| 20 | + * Reference: RFC6020 and YANG ANTLR Grammar | ||
| 21 | + * | ||
| 22 | + * ABNF grammar as per RFC6020 | ||
| 23 | + * enum-stmt = enum-keyword sep string optsep | ||
| 24 | + * (";" / | ||
| 25 | + * "{" stmtsep | ||
| 26 | + * ;; these stmts can appear in any order | ||
| 27 | + * [value-stmt stmtsep] | ||
| 28 | + * [status-stmt stmtsep] | ||
| 29 | + * [description-stmt stmtsep] | ||
| 30 | + * [reference-stmt stmtsep] | ||
| 31 | + * "}") | ||
| 32 | + * | ||
| 33 | + * ANTLR grammar rule | ||
| 34 | + * enumStatement : ENUM_KEYWORD string (STMTEND | LEFT_CURLY_BRACE enumStatementBody RIGHT_CURLY_BRACE); | ||
| 35 | + * | ||
| 36 | + * enumStatementBody : valueStatement? statusStatement? descriptionStatement? referenceStatement? | ||
| 37 | + * | valueStatement? statusStatement? referenceStatement? descriptionStatement? | ||
| 38 | + * | valueStatement? descriptionStatement? statusStatement? referenceStatement? | ||
| 39 | + * | valueStatement? descriptionStatement? referenceStatement? statusStatement? | ||
| 40 | + * | valueStatement? referenceStatement? statusStatement? descriptionStatement? | ||
| 41 | + * | valueStatement? referenceStatement? descriptionStatement? statusStatement? | ||
| 42 | + * | statusStatement? valueStatement? descriptionStatement? referenceStatement? | ||
| 43 | + * | statusStatement? valueStatement? referenceStatement? descriptionStatement? | ||
| 44 | + * | statusStatement? descriptionStatement? descriptionStatement? valueStatement? | ||
| 45 | + * | statusStatement? descriptionStatement? valueStatement? descriptionStatement? | ||
| 46 | + * | statusStatement? referenceStatement? valueStatement? descriptionStatement? | ||
| 47 | + * | statusStatement? referenceStatement? descriptionStatement? valueStatement? | ||
| 48 | + * | descriptionStatement? valueStatement? statusStatement? referenceStatement? | ||
| 49 | + * | descriptionStatement? valueStatement? referenceStatement? statusStatement? | ||
| 50 | + * | descriptionStatement? statusStatement? valueStatement? referenceStatement? | ||
| 51 | + * | descriptionStatement? statusStatement? referenceStatement? valueStatement? | ||
| 52 | + * | descriptionStatement? referenceStatement? valueStatement? statusStatement? | ||
| 53 | + * | descriptionStatement? referenceStatement? statusStatement? valueStatement? | ||
| 54 | + * | referenceStatement? valueStatement? descriptionStatement? statusStatement? | ||
| 55 | + * | referenceStatement? valueStatement? statusStatement? descriptionStatement? | ||
| 56 | + * | referenceStatement? statusStatement? descriptionStatement? valueStatement? | ||
| 57 | + * | referenceStatement? statusStatement? valueStatement? descriptionStatement? | ||
| 58 | + * | referenceStatement? descriptionStatement? valueStatement? statusStatement? | ||
| 59 | + * | referenceStatement? descriptionStatement? statusStatement? valueStatement? | ||
| 60 | + * ; | ||
| 61 | + */ | ||
| 62 | + | ||
| 63 | +import org.onosproject.yangutils.datamodel.YangEnum; | ||
| 64 | +import org.onosproject.yangutils.datamodel.YangEnumeration; | ||
| 65 | +import org.onosproject.yangutils.datamodel.exceptions.DataModelException; | ||
| 66 | +import org.onosproject.yangutils.parser.Parsable; | ||
| 67 | +import static org.onosproject.yangutils.parser.ParsableDataType.ENUM_DATA; | ||
| 68 | +import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | ||
| 69 | +import org.onosproject.yangutils.parser.exceptions.ParserException; | ||
| 70 | +import org.onosproject.yangutils.parser.impl.TreeWalkListener; | ||
| 71 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; | ||
| 72 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; | ||
| 73 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage; | ||
| 74 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; | ||
| 75 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.DUPLICATE_ENTRY; | ||
| 76 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; | ||
| 77 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER; | ||
| 78 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | ||
| 79 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; | ||
| 80 | + | ||
| 81 | +/** | ||
| 82 | + * Implements listener based call back function corresponding to the "enum" rule | ||
| 83 | + * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. | ||
| 84 | + */ | ||
| 85 | +public final class EnumListener { | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * Creates a new enum listener. | ||
| 89 | + */ | ||
| 90 | + private EnumListener() { | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * It is called when parser enters grammar rule (enum), it perform | ||
| 95 | + * validations and updates the data model tree. | ||
| 96 | + * | ||
| 97 | + * @param listener listener's object. | ||
| 98 | + * @param ctx context object of the grammar rule. | ||
| 99 | + */ | ||
| 100 | + public static void processEnumEntry(TreeWalkListener listener, GeneratedYangParser.EnumStatementContext ctx) { | ||
| 101 | + | ||
| 102 | + // Check for stack to be non empty. | ||
| 103 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), ENTRY); | ||
| 104 | + | ||
| 105 | + YangEnum enumNode = new YangEnum(); | ||
| 106 | + enumNode.setNamedValue(ctx.string().getText()); | ||
| 107 | + listener.getParsedDataStack().push(enumNode); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * It is called when parser exits from grammar rule (enum), it perform | ||
| 112 | + * validations and update the data model tree. | ||
| 113 | + * | ||
| 114 | + * @param listener Listener's object. | ||
| 115 | + * @param ctx context object of the grammar rule. | ||
| 116 | + */ | ||
| 117 | + public static void processEnumExit(TreeWalkListener listener, GeneratedYangParser.EnumStatementContext ctx) { | ||
| 118 | + | ||
| 119 | + // Check for stack to be non empty. | ||
| 120 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT); | ||
| 121 | + | ||
| 122 | + Parsable tmpEnumNode = listener.getParsedDataStack().peek(); | ||
| 123 | + if (tmpEnumNode instanceof YangEnum) { | ||
| 124 | + listener.getParsedDataStack().pop(); | ||
| 125 | + | ||
| 126 | + // Check for stack to be non empty. | ||
| 127 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT); | ||
| 128 | + | ||
| 129 | + Parsable tmpNode = listener.getParsedDataStack().peek(); | ||
| 130 | + switch (tmpNode.getParsableDataType()) { | ||
| 131 | + case ENUMERATION_DATA: { | ||
| 132 | + YangEnumeration yangEnumeration = (YangEnumeration) tmpNode; | ||
| 133 | + if ((ctx.enumStatementBody() == null) || (ctx.enumStatementBody().valueStatement() == null)) { | ||
| 134 | + int maxValue = 0; | ||
| 135 | + boolean isValuePresent = false; | ||
| 136 | + | ||
| 137 | + for (YangEnum curEnum : yangEnumeration.getEnumSet()) { | ||
| 138 | + if (maxValue <= curEnum.getValue()) { | ||
| 139 | + maxValue = curEnum.getValue(); | ||
| 140 | + isValuePresent = true; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + if (isValuePresent) { | ||
| 144 | + maxValue++; | ||
| 145 | + } | ||
| 146 | + ((YangEnum) tmpEnumNode).setValue(maxValue); | ||
| 147 | + } | ||
| 148 | + try { | ||
| 149 | + yangEnumeration.addEnumInfo((YangEnum) tmpEnumNode); | ||
| 150 | + } catch (DataModelException e) { | ||
| 151 | + ParserException parserException = new ParserException(constructExtendedListenerErrorMessage( | ||
| 152 | + DUPLICATE_ENTRY, ENUM_DATA, ctx.string().getText(), EXIT, e.getMessage())); | ||
| 153 | + parserException.setLine(ctx.string().STRING(0).getSymbol().getLine()); | ||
| 154 | + parserException.setCharPosition(ctx.string().STRING(0).getSymbol().getCharPositionInLine()); | ||
| 155 | + throw parserException; | ||
| 156 | + } | ||
| 157 | + break; | ||
| 158 | + } | ||
| 159 | + default: | ||
| 160 | + throw new ParserException( | ||
| 161 | + constructListenerErrorMessage(INVALID_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT)); | ||
| 162 | + } | ||
| 163 | + } else { | ||
| 164 | + throw new ParserException( | ||
| 165 | + constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT)); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2014-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 | +/* | ||
| 20 | + * Reference: RFC6020 and YANG ANTLR Grammar | ||
| 21 | + * | ||
| 22 | + * ABNF grammar as per RFC6020 | ||
| 23 | + * type-body-stmts = numerical-restrictions / | ||
| 24 | + * decimal64-specification / | ||
| 25 | + * string-restrictions / | ||
| 26 | + * enum-specification / | ||
| 27 | + * leafref-specification / | ||
| 28 | + * identityref-specification / | ||
| 29 | + * instance-identifier-specification / | ||
| 30 | + * bits-specification / | ||
| 31 | + * union-specification | ||
| 32 | + * | ||
| 33 | + * enum-specification = 1*(enum-stmt stmtsep) | ||
| 34 | + * | ||
| 35 | + * ANTLR grammar rule | ||
| 36 | + * | ||
| 37 | + * typeBodyStatements : numericalRestrictions | stringRestrictions | enumSpecification | ||
| 38 | + * | leafrefSpecification | identityrefSpecification | instanceIdentifierSpecification | ||
| 39 | + * | bitsSpecification | unionSpecification; | ||
| 40 | + * | ||
| 41 | + * enumSpecification : enumStatement+; | ||
| 42 | + */ | ||
| 43 | + | ||
| 44 | +import org.onosproject.yangutils.datamodel.YangEnumeration; | ||
| 45 | +import org.onosproject.yangutils.datamodel.YangLeaf; | ||
| 46 | +import org.onosproject.yangutils.datamodel.YangLeafList; | ||
| 47 | +import org.onosproject.yangutils.datamodel.YangType; | ||
| 48 | +import org.onosproject.yangutils.parser.Parsable; | ||
| 49 | +import static org.onosproject.yangutils.parser.ParsableDataType.ENUMERATION_DATA; | ||
| 50 | +import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA; | ||
| 51 | +import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | ||
| 52 | +import org.onosproject.yangutils.parser.exceptions.ParserException; | ||
| 53 | +import org.onosproject.yangutils.parser.impl.TreeWalkListener; | ||
| 54 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; | ||
| 55 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; | ||
| 56 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; | ||
| 57 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; | ||
| 58 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER; | ||
| 59 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | ||
| 60 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; | ||
| 61 | + | ||
| 62 | +/** | ||
| 63 | + * Implements listener based call back function corresponding to the | ||
| 64 | + * "enumeration" rule defined in ANTLR grammar file for corresponding ABNF rule | ||
| 65 | + * in RFC 6020. | ||
| 66 | + */ | ||
| 67 | +public final class EnumerationListener { | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * Creates a new enumeration listener. | ||
| 71 | + */ | ||
| 72 | + private EnumerationListener() { | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * It is called when parser enters grammar rule (enumeration), it perform | ||
| 77 | + * validations and updates the data model tree. | ||
| 78 | + * | ||
| 79 | + * @param listener listener's object. | ||
| 80 | + * @param ctx context object of the grammar rule. | ||
| 81 | + */ | ||
| 82 | + public static void processEnumerationEntry(TreeWalkListener listener, | ||
| 83 | + GeneratedYangParser.EnumSpecificationContext ctx) { | ||
| 84 | + | ||
| 85 | + // Check for stack to be non empty. | ||
| 86 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY); | ||
| 87 | + | ||
| 88 | + if (listener.getParsedDataStack().peek() instanceof YangType) { | ||
| 89 | + YangEnumeration enumerationNode = new YangEnumeration(); | ||
| 90 | + Parsable typeData = listener.getParsedDataStack().pop(); | ||
| 91 | + | ||
| 92 | + // Check for stack to be non empty. | ||
| 93 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", ENTRY); | ||
| 94 | + | ||
| 95 | + Parsable tmpData = listener.getParsedDataStack().peek(); | ||
| 96 | + | ||
| 97 | + switch (tmpData.getParsableDataType()) { | ||
| 98 | + case LEAF_DATA: | ||
| 99 | + enumerationNode.setEnumerationName(((YangLeaf) tmpData).getLeafName()); | ||
| 100 | + break; | ||
| 101 | + case LEAF_LIST_DATA: | ||
| 102 | + enumerationNode.setEnumerationName(((YangLeafList) tmpData).getLeafName()); | ||
| 103 | + break; | ||
| 104 | + // TODO typedef, union, deviate. | ||
| 105 | + default: | ||
| 106 | + throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA, | ||
| 107 | + ((YangType) typeData).getDataTypeName(), ENTRY)); | ||
| 108 | + } | ||
| 109 | + listener.getParsedDataStack().push(typeData); | ||
| 110 | + listener.getParsedDataStack().push(enumerationNode); | ||
| 111 | + } else { | ||
| 112 | + throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", ENTRY)); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * It is called when parser exits from grammar rule (enumeration), it | ||
| 118 | + * perform validations and update the data model tree. | ||
| 119 | + * | ||
| 120 | + * @param listener Listener's object. | ||
| 121 | + * @param ctx context object of the grammar rule. | ||
| 122 | + */ | ||
| 123 | + public static void processEnumerationExit(TreeWalkListener listener, | ||
| 124 | + GeneratedYangParser.EnumSpecificationContext ctx) { | ||
| 125 | + | ||
| 126 | + // Check for stack to be non empty. | ||
| 127 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT); | ||
| 128 | + | ||
| 129 | + Parsable tmpEnumerationNode = listener.getParsedDataStack().peek(); | ||
| 130 | + if (tmpEnumerationNode instanceof YangEnumeration) { | ||
| 131 | + listener.getParsedDataStack().pop(); | ||
| 132 | + | ||
| 133 | + // Check for stack to be non empty. | ||
| 134 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, ENUMERATION_DATA, "", EXIT); | ||
| 135 | + | ||
| 136 | + Parsable tmpNode = listener.getParsedDataStack().peek(); | ||
| 137 | + switch (tmpNode.getParsableDataType()) { | ||
| 138 | + case TYPE_DATA: { | ||
| 139 | + YangType typeNode = (YangType) tmpNode; | ||
| 140 | + typeNode.setDataTypeExtendedInfo((YangEnumeration) tmpEnumerationNode); | ||
| 141 | + break; | ||
| 142 | + } | ||
| 143 | + default: | ||
| 144 | + throw new ParserException( | ||
| 145 | + constructListenerErrorMessage(INVALID_HOLDER, ENUMERATION_DATA, "", EXIT)); | ||
| 146 | + } | ||
| 147 | + } else { | ||
| 148 | + throw new ParserException( | ||
| 149 | + constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUMERATION_DATA, "", EXIT)); | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | +} |
| ... | @@ -21,18 +21,18 @@ import org.onosproject.yangutils.datamodel.YangLeaf; | ... | @@ -21,18 +21,18 @@ import org.onosproject.yangutils.datamodel.YangLeaf; |
| 21 | import org.onosproject.yangutils.datamodel.YangLeafList; | 21 | import org.onosproject.yangutils.datamodel.YangLeafList; |
| 22 | import org.onosproject.yangutils.datamodel.YangType; | 22 | import org.onosproject.yangutils.datamodel.YangType; |
| 23 | import org.onosproject.yangutils.parser.Parsable; | 23 | import org.onosproject.yangutils.parser.Parsable; |
| 24 | +import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA; | ||
| 24 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | 25 | import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; |
| 25 | import org.onosproject.yangutils.parser.exceptions.ParserException; | 26 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
| 26 | import org.onosproject.yangutils.parser.impl.TreeWalkListener; | 27 | import org.onosproject.yangutils.parser.impl.TreeWalkListener; |
| 27 | - | ||
| 28 | -import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA; | ||
| 29 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; | 28 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; |
| 29 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; | ||
| 30 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; | 30 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; |
| 31 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; | 31 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; |
| 32 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER; | ||
| 32 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | 33 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; |
| 33 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; | 34 | import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; |
| 34 | 35 | ||
| 35 | - | ||
| 36 | /* | 36 | /* |
| 37 | * Reference: RFC6020 and YANG ANTLR Grammar | 37 | * Reference: RFC6020 and YANG ANTLR Grammar |
| 38 | * | 38 | * |
| ... | @@ -48,8 +48,8 @@ import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidati | ... | @@ -48,8 +48,8 @@ import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidati |
| 48 | */ | 48 | */ |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | - * Implements listener based call back function corresponding to the "type" | 51 | + * Implements listener based call back function corresponding to the "type" rule |
| 52 | - * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. | 52 | + * defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. |
| 53 | */ | 53 | */ |
| 54 | public final class TypeListener { | 54 | public final class TypeListener { |
| 55 | 55 | ||
| ... | @@ -60,15 +60,14 @@ public final class TypeListener { | ... | @@ -60,15 +60,14 @@ public final class TypeListener { |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /** | 62 | /** |
| 63 | - * It is called when parser receives an input matching the grammar | 63 | + * It is called when parser receives an input matching the grammar rule |
| 64 | - * rule (type), performs validation and updates the data model | 64 | + * (type), performs validation and updates the data model tree. |
| 65 | - * tree. | ||
| 66 | * | 65 | * |
| 67 | * @param listener listener's object. | 66 | * @param listener listener's object. |
| 68 | * @param ctx context object of the grammar rule. | 67 | * @param ctx context object of the grammar rule. |
| 69 | */ | 68 | */ |
| 70 | public static void processTypeEntry(TreeWalkListener listener, | 69 | public static void processTypeEntry(TreeWalkListener listener, |
| 71 | - GeneratedYangParser.TypeStatementContext ctx) { | 70 | + GeneratedYangParser.TypeStatementContext ctx) { |
| 72 | 71 | ||
| 73 | // Check for stack to be non empty. | 72 | // Check for stack to be non empty. |
| 74 | checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPE_DATA, ctx.string().getText(), ENTRY); | 73 | checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPE_DATA, ctx.string().getText(), ENTRY); |
| ... | @@ -78,21 +77,46 @@ public final class TypeListener { | ... | @@ -78,21 +77,46 @@ public final class TypeListener { |
| 78 | type.setDataTypeName(ctx.string().getText()); | 77 | type.setDataTypeName(ctx.string().getText()); |
| 79 | type.setDataType(yangDataTypes); | 78 | type.setDataType(yangDataTypes); |
| 80 | 79 | ||
| 80 | + listener.getParsedDataStack().push(type); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * It is called when parser exits from grammar rule (type), it perform | ||
| 85 | + * validations and update the data model tree. | ||
| 86 | + * | ||
| 87 | + * @param listener Listener's object. | ||
| 88 | + * @param ctx context object of the grammar rule. | ||
| 89 | + */ | ||
| 90 | + public static void processTypeExit(TreeWalkListener listener, | ||
| 91 | + GeneratedYangParser.TypeStatementContext ctx) { | ||
| 92 | + | ||
| 93 | + // Check for stack to be non empty. | ||
| 94 | + checkStackIsNotEmpty(listener, MISSING_CURRENT_HOLDER, TYPE_DATA, ctx.string().getText(), EXIT); | ||
| 95 | + | ||
| 96 | + Parsable type = listener.getParsedDataStack().pop(); | ||
| 97 | + if (!(type instanceof YangType)) { | ||
| 98 | + throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA, | ||
| 99 | + ctx.string().getText(), EXIT)); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + // Check for stack to be non empty. | ||
| 103 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPE_DATA, ctx.string().getText(), EXIT); | ||
| 104 | + | ||
| 81 | Parsable tmpData = listener.getParsedDataStack().peek(); | 105 | Parsable tmpData = listener.getParsedDataStack().peek(); |
| 82 | switch (tmpData.getParsableDataType()) { | 106 | switch (tmpData.getParsableDataType()) { |
| 83 | case LEAF_DATA: | 107 | case LEAF_DATA: |
| 84 | YangLeaf leaf = (YangLeaf) tmpData; | 108 | YangLeaf leaf = (YangLeaf) tmpData; |
| 85 | - leaf.setDataType(type); | 109 | + leaf.setDataType((YangType) type); |
| 86 | break; | 110 | break; |
| 87 | case LEAF_LIST_DATA: | 111 | case LEAF_LIST_DATA: |
| 88 | YangLeafList leafList = (YangLeafList) tmpData; | 112 | YangLeafList leafList = (YangLeafList) tmpData; |
| 89 | - leafList.setDataType(type); | 113 | + leafList.setDataType((YangType) type); |
| 90 | break; | 114 | break; |
| 91 | case TYPEDEF_DATA: //TODO | 115 | case TYPEDEF_DATA: //TODO |
| 92 | break; | 116 | break; |
| 93 | default: | 117 | default: |
| 94 | throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA, | 118 | throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, TYPE_DATA, |
| 95 | - ctx.string().getText(), ENTRY)); | 119 | + ctx.string().getText(), EXIT)); |
| 96 | } | 120 | } |
| 97 | } | 121 | } |
| 98 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 122 | +} | ... | ... |
utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ValueListener.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2014-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 | +/* | ||
| 20 | + * Reference: RFC6020 and YANG ANTLR Grammar | ||
| 21 | + * | ||
| 22 | + * ABNF grammar as per RFC6020 | ||
| 23 | + * value-stmt = value-keyword sep integer-value stmtend | ||
| 24 | + * | ||
| 25 | + * ANTLR grammar rule | ||
| 26 | + * valueStatement : VALUE_KEYWORD ((MINUS INTEGER) | INTEGER) STMTEND; | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +import org.onosproject.yangutils.datamodel.YangEnum; | ||
| 30 | +import org.onosproject.yangutils.datamodel.YangEnumeration; | ||
| 31 | +import org.onosproject.yangutils.parser.Parsable; | ||
| 32 | +import static org.onosproject.yangutils.parser.ParsableDataType.VALUE_DATA; | ||
| 33 | +import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; | ||
| 34 | +import org.onosproject.yangutils.parser.exceptions.ParserException; | ||
| 35 | +import org.onosproject.yangutils.parser.impl.TreeWalkListener; | ||
| 36 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; | ||
| 37 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT; | ||
| 38 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; | ||
| 39 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; | ||
| 40 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; | ||
| 41 | +import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty; | ||
| 42 | + | ||
| 43 | +/** | ||
| 44 | + * Implements listener based call back function corresponding to the "value" | ||
| 45 | + * rule defined in ANTLR grammar file for corresponding ABNF rule in RFC 6020. | ||
| 46 | + */ | ||
| 47 | +public final class ValueListener { | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Creates a new value listener. | ||
| 51 | + */ | ||
| 52 | + private ValueListener() { | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * It is called when parser receives an input matching the grammar rule | ||
| 57 | + * (value), perform validations and update the data model tree. | ||
| 58 | + * | ||
| 59 | + * @param listener Listener's object. | ||
| 60 | + * @param ctx context object of the grammar rule. | ||
| 61 | + */ | ||
| 62 | + public static void processValueEntry(TreeWalkListener listener, GeneratedYangParser.ValueStatementContext ctx) { | ||
| 63 | + | ||
| 64 | + // Check for stack to be non empty. | ||
| 65 | + checkStackIsNotEmpty(listener, MISSING_HOLDER, VALUE_DATA, ctx.INTEGER().getText(), ENTRY); | ||
| 66 | + | ||
| 67 | + // Obtain the node of the stack. | ||
| 68 | + Parsable tmpNode = listener.getParsedDataStack().peek(); | ||
| 69 | + switch (tmpNode.getParsableDataType()) { | ||
| 70 | + case ENUM_DATA: { | ||
| 71 | + YangEnum enumNode = (YangEnum) tmpNode; | ||
| 72 | + if (!isEnumValueValid(listener, ctx)) { | ||
| 73 | + ParserException parserException = new ParserException("Input version not supported"); | ||
| 74 | + parserException.setLine(ctx.INTEGER().getSymbol().getLine()); | ||
| 75 | + parserException.setCharPosition(ctx.INTEGER().getSymbol().getCharPositionInLine()); | ||
| 76 | + throw parserException; | ||
| 77 | + } | ||
| 78 | + enumNode.setValue(Integer.valueOf(ctx.INTEGER().getText())); | ||
| 79 | + break; | ||
| 80 | + } | ||
| 81 | + default: | ||
| 82 | + throw new ParserException( | ||
| 83 | + constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.INTEGER().getText(), ENTRY)); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * Validates ENUM value uniqueness. | ||
| 89 | + * | ||
| 90 | + * @param listener Listener's object. | ||
| 91 | + * @param ctx context object of the grammar rule. | ||
| 92 | + * @return validation result | ||
| 93 | + */ | ||
| 94 | + private static boolean isEnumValueValid(TreeWalkListener listener, GeneratedYangParser.ValueStatementContext ctx) { | ||
| 95 | + Parsable enumNode = listener.getParsedDataStack().pop(); | ||
| 96 | + Parsable tmpNode = listener.getParsedDataStack().peek(); | ||
| 97 | + switch (tmpNode.getParsableDataType()) { | ||
| 98 | + case ENUMERATION_DATA: { | ||
| 99 | + YangEnumeration yangEnumeration = (YangEnumeration) tmpNode; | ||
| 100 | + for (YangEnum curEnum : yangEnumeration.getEnumSet()) { | ||
| 101 | + if (Integer.valueOf(ctx.INTEGER().getText()) == curEnum.getValue()) { | ||
| 102 | + listener.getParsedDataStack().push(enumNode); | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + listener.getParsedDataStack().push(enumNode); | ||
| 107 | + return true; | ||
| 108 | + } | ||
| 109 | + default: | ||
| 110 | + listener.getParsedDataStack().push(enumNode); | ||
| 111 | + throw new ParserException( | ||
| 112 | + constructListenerErrorMessage(INVALID_HOLDER, VALUE_DATA, ctx.INTEGER().getText(), EXIT)); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | +} |
| ... | @@ -21,22 +21,26 @@ package org.onosproject.yangutils.parser.impl.parserutils; | ... | @@ -21,22 +21,26 @@ package org.onosproject.yangutils.parser.impl.parserutils; |
| 21 | */ | 21 | */ |
| 22 | public enum ListenerErrorType { | 22 | public enum ListenerErrorType { |
| 23 | /** | 23 | /** |
| 24 | - * Represents the parent holder in parsable stack for given YANG construct is invalid. | 24 | + * Represents the parent holder in parsable stack for given YANG construct |
| 25 | + * is invalid. | ||
| 25 | */ | 26 | */ |
| 26 | INVALID_HOLDER(), | 27 | INVALID_HOLDER(), |
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | - * Represents the parent holder in parsable stack for given YANG construct is missing. | 30 | + * Represents the parent holder in parsable stack for given YANG construct |
| 31 | + * is missing. | ||
| 30 | */ | 32 | */ |
| 31 | MISSING_HOLDER(), | 33 | MISSING_HOLDER(), |
| 32 | 34 | ||
| 33 | /** | 35 | /** |
| 34 | - * Represents the current holder in parsable stack for given YANG construct is missing. | 36 | + * Represents the current holder in parsable stack for given YANG construct |
| 37 | + * is missing. | ||
| 35 | */ | 38 | */ |
| 36 | MISSING_CURRENT_HOLDER(), | 39 | MISSING_CURRENT_HOLDER(), |
| 37 | 40 | ||
| 38 | /** | 41 | /** |
| 39 | - * Represents that the child in parsable stack for given YANG construct is invalid. | 42 | + * Represents that the child in parsable stack for given YANG construct is |
| 43 | + * invalid. | ||
| 40 | */ | 44 | */ |
| 41 | INVALID_CHILD(), | 45 | INVALID_CHILD(), |
| 42 | 46 | ||
| ... | @@ -46,6 +50,11 @@ public enum ListenerErrorType { | ... | @@ -46,6 +50,11 @@ public enum ListenerErrorType { |
| 46 | INVALID_CARDINALITY(), | 50 | INVALID_CARDINALITY(), |
| 47 | 51 | ||
| 48 | /** | 52 | /** |
| 53 | + * Represents that the entry is duplicate. | ||
| 54 | + */ | ||
| 55 | + DUPLICATE_ENTRY(), | ||
| 56 | + | ||
| 57 | + /** | ||
| 49 | * Represents that some of earlier parsed data is not handled correctly. | 58 | * Represents that some of earlier parsed data is not handled correctly. |
| 50 | */ | 59 | */ |
| 51 | UNHANDLED_PARSED_DATA(); | 60 | UNHANDLED_PARSED_DATA(); |
| ... | @@ -59,20 +68,22 @@ public enum ListenerErrorType { | ... | @@ -59,20 +68,22 @@ public enum ListenerErrorType { |
| 59 | public static String getErrorType(ListenerErrorType errorType) { | 68 | public static String getErrorType(ListenerErrorType errorType) { |
| 60 | 69 | ||
| 61 | switch (errorType) { | 70 | switch (errorType) { |
| 62 | - case INVALID_HOLDER: | 71 | + case INVALID_HOLDER: |
| 63 | - return "Invalid holder for"; | 72 | + return "Invalid holder for"; |
| 64 | - case MISSING_HOLDER: | 73 | + case MISSING_HOLDER: |
| 65 | - return "Missing holder at"; | 74 | + return "Missing holder at"; |
| 66 | - case MISSING_CURRENT_HOLDER: | 75 | + case MISSING_CURRENT_HOLDER: |
| 67 | - return "Missing"; | 76 | + return "Missing"; |
| 68 | - case INVALID_CHILD: | 77 | + case INVALID_CHILD: |
| 69 | - return "Invalid child in"; | 78 | + return "Invalid child in"; |
| 70 | - case INVALID_CARDINALITY: | 79 | + case INVALID_CARDINALITY: |
| 71 | - return "Invalid cardinality in"; | 80 | + return "Invalid cardinality in"; |
| 72 | - case UNHANDLED_PARSED_DATA: | 81 | + case DUPLICATE_ENTRY: |
| 73 | - return "Unhandled parsed data at"; | 82 | + return "Duplicate"; |
| 74 | - default: | 83 | + case UNHANDLED_PARSED_DATA: |
| 75 | - return "Problem in"; | 84 | + return "Unhandled parsed data at"; |
| 85 | + default: | ||
| 86 | + return "Problem in"; | ||
| 76 | } | 87 | } |
| 77 | } | 88 | } |
| 78 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 89 | +} | ... | ... |
utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2014-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 static org.hamcrest.MatcherAssert.assertThat; | ||
| 20 | +import static org.hamcrest.core.Is.is; | ||
| 21 | +import org.junit.Test; | ||
| 22 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
| 23 | +import org.onosproject.yangutils.datamodel.YangEnum; | ||
| 24 | +import org.onosproject.yangutils.datamodel.YangEnumeration; | ||
| 25 | +import org.onosproject.yangutils.datamodel.YangLeaf; | ||
| 26 | +import org.onosproject.yangutils.datamodel.YangModule; | ||
| 27 | +import org.onosproject.yangutils.datamodel.YangNode; | ||
| 28 | +import org.onosproject.yangutils.datamodel.YangNodeType; | ||
| 29 | +import org.onosproject.yangutils.parser.exceptions.ParserException; | ||
| 30 | +import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | ||
| 31 | + | ||
| 32 | +import java.io.IOException; | ||
| 33 | +import java.util.ListIterator; | ||
| 34 | +import java.util.Set; | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * Test cases for enum listener. | ||
| 38 | + */ | ||
| 39 | +public class EnumListenerTest { | ||
| 40 | + | ||
| 41 | + private final YangUtilsParserManager manager = new YangUtilsParserManager(); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Checks enum statement without value. | ||
| 45 | + */ | ||
| 46 | + @Test | ||
| 47 | + public void processEnumTypeStatement() throws IOException, ParserException { | ||
| 48 | + | ||
| 49 | + YangNode node = manager.getDataModel("src/test/resources/EnumTypeStatement.yang"); | ||
| 50 | + | ||
| 51 | + // Check whether the data model tree returned is of type module. | ||
| 52 | + assertThat((node instanceof YangModule), is(true)); | ||
| 53 | + | ||
| 54 | + // Check whether the node type is set properly to module. | ||
| 55 | + assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); | ||
| 56 | + | ||
| 57 | + // Check whether the module name is set correctly. | ||
| 58 | + YangModule yangNode = (YangModule) node; | ||
| 59 | + assertThat(yangNode.getName(), is("Test")); | ||
| 60 | + | ||
| 61 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); | ||
| 62 | + YangLeaf leafInfo = leafIterator.next(); | ||
| 63 | + | ||
| 64 | + assertThat(leafInfo.getLeafName(), is("speed")); | ||
| 65 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration")); | ||
| 66 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION)); | ||
| 67 | + assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumerationName(), | ||
| 68 | + is("speed")); | ||
| 69 | + | ||
| 70 | + Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet(); | ||
| 71 | + for (YangEnum tmp : enumSet) { | ||
| 72 | + if (tmp.getNamedValue().equals("10m")) { | ||
| 73 | + assertThat(tmp.getValue(), is(0)); | ||
| 74 | + } else if (tmp.getNamedValue().equals("100m")) { | ||
| 75 | + assertThat(tmp.getValue(), is(1)); | ||
| 76 | + } else if (tmp.getNamedValue().equals("auto")) { | ||
| 77 | + assertThat(tmp.getValue(), is(2)); | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | +} |
utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ValueListenerTest.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2014-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 static org.hamcrest.MatcherAssert.assertThat; | ||
| 20 | +import static org.hamcrest.core.Is.is; | ||
| 21 | +import org.junit.Test; | ||
| 22 | +import org.onosproject.yangutils.datamodel.YangDataTypes; | ||
| 23 | +import org.onosproject.yangutils.datamodel.YangEnum; | ||
| 24 | +import org.onosproject.yangutils.datamodel.YangEnumeration; | ||
| 25 | +import org.onosproject.yangutils.datamodel.YangLeaf; | ||
| 26 | +import org.onosproject.yangutils.datamodel.YangModule; | ||
| 27 | +import org.onosproject.yangutils.datamodel.YangNode; | ||
| 28 | +import org.onosproject.yangutils.datamodel.YangNodeType; | ||
| 29 | +import org.onosproject.yangutils.parser.exceptions.ParserException; | ||
| 30 | +import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; | ||
| 31 | + | ||
| 32 | +import java.io.IOException; | ||
| 33 | +import java.util.ListIterator; | ||
| 34 | +import java.util.Set; | ||
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * Test cases for value listener. | ||
| 38 | + */ | ||
| 39 | +public class ValueListenerTest { | ||
| 40 | + | ||
| 41 | + private final YangUtilsParserManager manager = new YangUtilsParserManager(); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Checks explicitly configured value. | ||
| 45 | + */ | ||
| 46 | + @Test | ||
| 47 | + public void processValueStatement() throws IOException, ParserException { | ||
| 48 | + | ||
| 49 | + YangNode node = manager.getDataModel("src/test/resources/ValueStatement.yang"); | ||
| 50 | + | ||
| 51 | + // Check whether the data model tree returned is of type module. | ||
| 52 | + assertThat((node instanceof YangModule), is(true)); | ||
| 53 | + | ||
| 54 | + // Check whether the node type is set properly to module. | ||
| 55 | + assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); | ||
| 56 | + | ||
| 57 | + // Check whether the module name is set correctly. | ||
| 58 | + YangModule yangNode = (YangModule) node; | ||
| 59 | + assertThat(yangNode.getName(), is("Test")); | ||
| 60 | + | ||
| 61 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); | ||
| 62 | + YangLeaf leafInfo = leafIterator.next(); | ||
| 63 | + | ||
| 64 | + assertThat(leafInfo.getLeafName(), is("speed")); | ||
| 65 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration")); | ||
| 66 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION)); | ||
| 67 | + assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumerationName(), | ||
| 68 | + is("speed")); | ||
| 69 | + | ||
| 70 | + Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet(); | ||
| 71 | + for (YangEnum tmp : enumSet) { | ||
| 72 | + if (tmp.getNamedValue().equals("10m")) { | ||
| 73 | + assertThat(tmp.getValue(), is(10)); | ||
| 74 | + } else if (tmp.getNamedValue().equals("100m")) { | ||
| 75 | + assertThat(tmp.getValue(), is(100)); | ||
| 76 | + } else if (tmp.getNamedValue().equals("auto")) { | ||
| 77 | + assertThat(tmp.getValue(), is(1000)); | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * Checks explicit value and auto generated value. | ||
| 84 | + */ | ||
| 85 | + @Test | ||
| 86 | + public void processValueAndAutoStatement() throws IOException, ParserException { | ||
| 87 | + | ||
| 88 | + YangNode node = manager.getDataModel("src/test/resources/ValueAndAutoStatement.yang"); | ||
| 89 | + | ||
| 90 | + // Check whether the data model tree returned is of type module. | ||
| 91 | + assertThat((node instanceof YangModule), is(true)); | ||
| 92 | + | ||
| 93 | + // Check whether the node type is set properly to module. | ||
| 94 | + assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); | ||
| 95 | + | ||
| 96 | + // Check whether the module name is set correctly. | ||
| 97 | + YangModule yangNode = (YangModule) node; | ||
| 98 | + assertThat(yangNode.getName(), is("Test")); | ||
| 99 | + | ||
| 100 | + ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); | ||
| 101 | + YangLeaf leafInfo = leafIterator.next(); | ||
| 102 | + | ||
| 103 | + assertThat(leafInfo.getLeafName(), is("speed")); | ||
| 104 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("enumeration")); | ||
| 105 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.ENUMERATION)); | ||
| 106 | + assertThat(((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumerationName(), | ||
| 107 | + is("speed")); | ||
| 108 | + | ||
| 109 | + Set<YangEnum> enumSet = ((YangEnumeration) leafInfo.getDataType().getDataTypeExtendedInfo()).getEnumSet(); | ||
| 110 | + for (YangEnum tmp : enumSet) { | ||
| 111 | + if (tmp.getNamedValue().equals("10m")) { | ||
| 112 | + assertThat(tmp.getValue(), is(10)); | ||
| 113 | + } else if (tmp.getNamedValue().equals("100m")) { | ||
| 114 | + assertThat(tmp.getValue(), is(11)); | ||
| 115 | + } else if (tmp.getNamedValue().equals("auto")) { | ||
| 116 | + assertThat(tmp.getValue(), is(1000)); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * Checks explicit value should not be repeated. | ||
| 123 | + */ | ||
| 124 | + @Test(expected = ParserException.class) | ||
| 125 | + public void processValueDuplication() throws IOException, ParserException { | ||
| 126 | + | ||
| 127 | + YangNode node = manager.getDataModel("src/test/resources/ValueDuplication.yang"); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * Checks explicit or auto generated value should not be repeated. | ||
| 132 | + */ | ||
| 133 | + @Test(expected = ParserException.class) | ||
| 134 | + public void processValueExplicitAndAutoDuplication() throws IOException, ParserException { | ||
| 135 | + | ||
| 136 | + YangNode node = manager.getDataModel("src/test/resources/ValueExplicitAndAutoDuplication.yang"); | ||
| 137 | + } | ||
| 138 | +} |
-
Please register or login to post a comment