Identifier issue fix for module, list, container, leaf, leaf-list, prefix + date agr string for revision fix
Change-Id: Id9d596512f35b54f6359d361402bcd0180b71678
diff --git a/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java b/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
index 236a65b..107c2f1 100644
--- a/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
@@ -27,7 +27,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* yangfile.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterYangfile(GeneratedYangParser.YangfileContext currentContext);
@@ -35,7 +35,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* yangfile.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitYangfile(GeneratedYangParser.YangfileContext currentContext);
@@ -43,7 +43,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* moduleStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterModuleStatement(GeneratedYangParser.ModuleStatementContext currentContext);
@@ -51,7 +51,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* moduleStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitModuleStatement(GeneratedYangParser.ModuleStatementContext currentContext);
@@ -59,7 +59,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* moduleBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterModuleBody(GeneratedYangParser.ModuleBodyContext currentContext);
@@ -67,7 +67,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* moduleBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitModuleBody(GeneratedYangParser.ModuleBodyContext currentContext);
@@ -75,7 +75,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* moduleHeaderStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext currentContext);
@@ -83,7 +83,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* moduleHeaderStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitModuleHeaderStatement(GeneratedYangParser.ModuleHeaderStatementContext currentContext);
@@ -91,7 +91,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* linkageStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterLinkageStatements(GeneratedYangParser.LinkageStatementsContext currentContext);
@@ -99,7 +99,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* linkageStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitLinkageStatements(GeneratedYangParser.LinkageStatementsContext currentContext);
@@ -107,7 +107,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* metaStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMetaStatements(GeneratedYangParser.MetaStatementsContext currentContext);
@@ -115,7 +115,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* metaStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMetaStatements(GeneratedYangParser.MetaStatementsContext currentContext);
@@ -123,7 +123,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRevisionStatements(GeneratedYangParser.RevisionStatementsContext currentContext);
@@ -131,7 +131,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRevisionStatements(GeneratedYangParser.RevisionStatementsContext currentContext);
@@ -139,7 +139,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* bodyStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBodyStatements(GeneratedYangParser.BodyStatementsContext currentContext);
@@ -147,7 +147,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* bodyStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBodyStatements(GeneratedYangParser.BodyStatementsContext currentContext);
@@ -155,7 +155,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* yangVersionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterYangVersionStatement(GeneratedYangParser.YangVersionStatementContext currentContext);
@@ -163,7 +163,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* yangVersionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitYangVersionStatement(GeneratedYangParser.YangVersionStatementContext currentContext);
@@ -171,7 +171,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* namespaceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterNamespaceStatement(GeneratedYangParser.NamespaceStatementContext currentContext);
@@ -179,7 +179,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* namespaceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitNamespaceStatement(GeneratedYangParser.NamespaceStatementContext currentContext);
@@ -187,7 +187,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* prefixStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterPrefixStatement(GeneratedYangParser.PrefixStatementContext currentContext);
@@ -195,7 +195,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* prefixStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitPrefixStatement(GeneratedYangParser.PrefixStatementContext currentContext);
@@ -203,7 +203,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* importStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterImportStatement(GeneratedYangParser.ImportStatementContext currentContext);
@@ -211,7 +211,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* importStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitImportStatement(GeneratedYangParser.ImportStatementContext currentContext);
@@ -219,7 +219,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* importStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterImportStatementBody(GeneratedYangParser.ImportStatementBodyContext currentContext);
@@ -227,7 +227,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* importStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitImportStatementBody(GeneratedYangParser.ImportStatementBodyContext currentContext);
@@ -235,7 +235,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* revisionDateStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext currentContext);
@@ -243,7 +243,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* revisionDateStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRevisionDateStatement(GeneratedYangParser.RevisionDateStatementContext currentContext);
@@ -251,7 +251,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* includeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterIncludeStatement(GeneratedYangParser.IncludeStatementContext currentContext);
@@ -259,7 +259,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* includeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitIncludeStatement(GeneratedYangParser.IncludeStatementContext currentContext);
@@ -267,7 +267,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* organizationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterOrganizationStatement(GeneratedYangParser.OrganizationStatementContext currentContext);
@@ -275,7 +275,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* organizationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitOrganizationStatement(GeneratedYangParser.OrganizationStatementContext currentContext);
@@ -283,7 +283,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* contactStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterContactStatement(GeneratedYangParser.ContactStatementContext currentContext);
@@ -291,7 +291,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* contactStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitContactStatement(GeneratedYangParser.ContactStatementContext currentContext);
@@ -299,7 +299,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* descriptionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDescriptionStatement(GeneratedYangParser.DescriptionStatementContext currentContext);
@@ -307,7 +307,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* descriptionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDescriptionStatement(GeneratedYangParser.DescriptionStatementContext currentContext);
@@ -315,7 +315,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* referenceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterReferenceStatement(GeneratedYangParser.ReferenceStatementContext currentContext);
@@ -323,7 +323,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* referenceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitReferenceStatement(GeneratedYangParser.ReferenceStatementContext currentContext);
@@ -331,7 +331,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRevisionStatement(GeneratedYangParser.RevisionStatementContext currentContext);
@@ -339,7 +339,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRevisionStatement(GeneratedYangParser.RevisionStatementContext currentContext);
@@ -347,7 +347,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext currentContext);
@@ -355,7 +355,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* revisionStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRevisionStatementBody(GeneratedYangParser.RevisionStatementBodyContext currentContext);
@@ -363,7 +363,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* subModuleStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterSubModuleStatement(GeneratedYangParser.SubModuleStatementContext currentContext);
@@ -371,7 +371,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* subModuleStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitSubModuleStatement(GeneratedYangParser.SubModuleStatementContext currentContext);
@@ -379,7 +379,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* submoduleBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext currentContext);
@@ -387,7 +387,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* submoduleBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitSubmoduleBody(GeneratedYangParser.SubmoduleBodyContext currentContext);
@@ -395,7 +395,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* submoduleHeaderStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext currentContext);
@@ -403,7 +403,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* submoduleHeaderStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitSubmoduleHeaderStatement(GeneratedYangParser.SubmoduleHeaderStatementContext currentContext);
@@ -411,7 +411,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* belongstoStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBelongstoStatement(GeneratedYangParser.BelongstoStatementContext currentContext);
@@ -419,7 +419,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* belongstoStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBelongstoStatement(GeneratedYangParser.BelongstoStatementContext currentContext);
@@ -427,7 +427,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* belongstoStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext currentContext);
@@ -435,7 +435,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* belongstoStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBelongstoStatementBody(GeneratedYangParser.BelongstoStatementBodyContext currentContext);
@@ -443,7 +443,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* extensionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterExtensionStatement(GeneratedYangParser.ExtensionStatementContext currentContext);
@@ -451,7 +451,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* extensionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitExtensionStatement(GeneratedYangParser.ExtensionStatementContext currentContext);
@@ -459,7 +459,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* extensionBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterExtensionBody(GeneratedYangParser.ExtensionBodyContext currentContext);
@@ -467,7 +467,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* extensionBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitExtensionBody(GeneratedYangParser.ExtensionBodyContext currentContext);
@@ -475,7 +475,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* argumentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterArgumentStatement(GeneratedYangParser.ArgumentStatementContext currentContext);
@@ -483,7 +483,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* argumentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitArgumentStatement(GeneratedYangParser.ArgumentStatementContext currentContext);
@@ -491,7 +491,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* argumentBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterArgumentBody(GeneratedYangParser.ArgumentBodyContext currentContext);
@@ -499,7 +499,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* argumentBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitArgumentBody(GeneratedYangParser.ArgumentBodyContext currentContext);
@@ -507,7 +507,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* yinElementStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterYinElementStatement(GeneratedYangParser.YinElementStatementContext currentContext);
@@ -515,7 +515,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* yinElementStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitYinElementStatement(GeneratedYangParser.YinElementStatementContext currentContext);
@@ -523,7 +523,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* identityStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterIdentityStatement(GeneratedYangParser.IdentityStatementContext currentContext);
@@ -531,7 +531,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* identityStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitIdentityStatement(GeneratedYangParser.IdentityStatementContext currentContext);
@@ -539,7 +539,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* identityBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterIdentityBody(GeneratedYangParser.IdentityBodyContext currentContext);
@@ -547,7 +547,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* identityBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitIdentityBody(GeneratedYangParser.IdentityBodyContext currentContext);
@@ -555,7 +555,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* baseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBaseStatement(GeneratedYangParser.BaseStatementContext currentContext);
@@ -563,7 +563,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* baseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBaseStatement(GeneratedYangParser.BaseStatementContext currentContext);
@@ -571,7 +571,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* featureStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterFeatureStatement(GeneratedYangParser.FeatureStatementContext currentContext);
@@ -579,7 +579,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* featureStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitFeatureStatement(GeneratedYangParser.FeatureStatementContext currentContext);
@@ -587,7 +587,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* featureBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterFeatureBody(GeneratedYangParser.FeatureBodyContext currentContext);
@@ -595,7 +595,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* featureBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitFeatureBody(GeneratedYangParser.FeatureBodyContext currentContext);
@@ -603,7 +603,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* dataDefStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDataDefStatement(GeneratedYangParser.DataDefStatementContext currentContext);
@@ -611,7 +611,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* dataDefStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDataDefStatement(GeneratedYangParser.DataDefStatementContext currentContext);
@@ -619,7 +619,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* ifFeatureStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext currentContext);
@@ -627,7 +627,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* ifFeatureStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext currentContext);
@@ -635,7 +635,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* unitsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterUnitsStatement(GeneratedYangParser.UnitsStatementContext currentContext);
@@ -643,7 +643,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* unitsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitUnitsStatement(GeneratedYangParser.UnitsStatementContext currentContext);
@@ -651,7 +651,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* typedefStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterTypedefStatement(GeneratedYangParser.TypedefStatementContext currentContext);
@@ -659,7 +659,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* typedefStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitTypedefStatement(GeneratedYangParser.TypedefStatementContext currentContext);
@@ -667,7 +667,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* typeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterTypeStatement(GeneratedYangParser.TypeStatementContext currentContext);
@@ -675,7 +675,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* typeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitTypeStatement(GeneratedYangParser.TypeStatementContext currentContext);
@@ -683,7 +683,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* typeBodyStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext currentContext);
@@ -691,7 +691,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* typeBodyStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitTypeBodyStatements(GeneratedYangParser.TypeBodyStatementsContext currentContext);
@@ -699,7 +699,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* numericalRestrictions.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext currentContext);
@@ -707,7 +707,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* numericalRestrictions.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitNumericalRestrictions(GeneratedYangParser.NumericalRestrictionsContext currentContext);
@@ -715,7 +715,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* rangeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRangeStatement(GeneratedYangParser.RangeStatementContext currentContext);
@@ -723,7 +723,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* rangeStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRangeStatement(GeneratedYangParser.RangeStatementContext currentContext);
@@ -731,7 +731,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* commonStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterCommonStatements(GeneratedYangParser.CommonStatementsContext currentContext);
@@ -739,7 +739,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* commonStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitCommonStatements(GeneratedYangParser.CommonStatementsContext currentContext);
@@ -747,7 +747,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* stringRestrictions.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterStringRestrictions(GeneratedYangParser.StringRestrictionsContext currentContext);
@@ -755,7 +755,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* stringRestrictions.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitStringRestrictions(GeneratedYangParser.StringRestrictionsContext currentContext);
@@ -763,7 +763,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* lengthStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterLengthStatement(GeneratedYangParser.LengthStatementContext currentContext);
@@ -771,7 +771,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* lengthStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitLengthStatement(GeneratedYangParser.LengthStatementContext currentContext);
@@ -779,7 +779,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* patternStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterPatternStatement(GeneratedYangParser.PatternStatementContext currentContext);
@@ -787,7 +787,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* patternStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitPatternStatement(GeneratedYangParser.PatternStatementContext currentContext);
@@ -795,7 +795,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* defaultStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDefaultStatement(GeneratedYangParser.DefaultStatementContext currentContext);
@@ -803,7 +803,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* defaultStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDefaultStatement(GeneratedYangParser.DefaultStatementContext currentContext);
@@ -811,7 +811,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* enumSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext currentContext);
@@ -819,7 +819,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* enumSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext currentContext);
@@ -827,7 +827,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* enumStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterEnumStatement(GeneratedYangParser.EnumStatementContext currentContext);
@@ -835,7 +835,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* enumStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitEnumStatement(GeneratedYangParser.EnumStatementContext currentContext);
@@ -843,7 +843,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* enumStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext currentContext);
@@ -851,7 +851,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* enumStatementBody.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitEnumStatementBody(GeneratedYangParser.EnumStatementBodyContext currentContext);
@@ -859,7 +859,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* leafrefSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext currentContext);
@@ -867,7 +867,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* leafrefSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext currentContext);
@@ -875,7 +875,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* pathStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterPathStatement(GeneratedYangParser.PathStatementContext currentContext);
@@ -883,7 +883,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* pathStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitPathStatement(GeneratedYangParser.PathStatementContext currentContext);
@@ -891,7 +891,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* requireInstanceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext currentContext);
@@ -899,7 +899,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* requireInstanceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext currentContext);
@@ -907,7 +907,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* instanceIdentifierSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterInstanceIdentifierSpecification(
GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext);
@@ -916,7 +916,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* instanceIdentifierSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext);
@@ -924,7 +924,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* identityrefSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext currentContext);
@@ -932,7 +932,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* identityrefSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext currentContext);
@@ -940,7 +940,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* unionSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext currentContext);
@@ -948,7 +948,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* unionSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext currentContext);
@@ -956,7 +956,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* bitsSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext currentContext);
@@ -964,7 +964,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* bitsSpecification.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext currentContext);
@@ -972,7 +972,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* bitStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBitStatement(GeneratedYangParser.BitStatementContext currentContext);
@@ -980,7 +980,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* bitStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBitStatement(GeneratedYangParser.BitStatementContext currentContext);
@@ -988,7 +988,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* bitBodyStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterBitBodyStatement(GeneratedYangParser.BitBodyStatementContext currentContext);
@@ -996,7 +996,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* bitBodyStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitBitBodyStatement(GeneratedYangParser.BitBodyStatementContext currentContext);
@@ -1004,7 +1004,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* positionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterPositionStatement(GeneratedYangParser.PositionStatementContext currentContext);
@@ -1012,7 +1012,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* positionStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitPositionStatement(GeneratedYangParser.PositionStatementContext currentContext);
@@ -1020,7 +1020,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* statusStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterStatusStatement(GeneratedYangParser.StatusStatementContext currentContext);
@@ -1028,7 +1028,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* statusStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitStatusStatement(GeneratedYangParser.StatusStatementContext currentContext);
@@ -1036,7 +1036,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* configStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterConfigStatement(GeneratedYangParser.ConfigStatementContext currentContext);
@@ -1044,7 +1044,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* configStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitConfigStatement(GeneratedYangParser.ConfigStatementContext currentContext);
@@ -1052,7 +1052,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* mandatoryStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMandatoryStatement(GeneratedYangParser.MandatoryStatementContext currentContext);
@@ -1060,7 +1060,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* mandatoryStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMandatoryStatement(GeneratedYangParser.MandatoryStatementContext currentContext);
@@ -1068,7 +1068,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* presenceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterPresenceStatement(GeneratedYangParser.PresenceStatementContext currentContext);
@@ -1076,7 +1076,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* presenceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitPresenceStatement(GeneratedYangParser.PresenceStatementContext currentContext);
@@ -1084,7 +1084,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* orderedByStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterOrderedByStatement(GeneratedYangParser.OrderedByStatementContext currentContext);
@@ -1092,7 +1092,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* orderedByStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitOrderedByStatement(GeneratedYangParser.OrderedByStatementContext currentContext);
@@ -1100,7 +1100,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* mustStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMustStatement(GeneratedYangParser.MustStatementContext currentContext);
@@ -1108,7 +1108,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* mustStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMustStatement(GeneratedYangParser.MustStatementContext currentContext);
@@ -1116,7 +1116,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* errorMessageStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext currentContext);
@@ -1124,7 +1124,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* errorMessageStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext currentContext);
@@ -1132,7 +1132,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* errorAppTagStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext currentContext);
@@ -1140,7 +1140,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* errorAppTagStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext currentContext);
@@ -1148,7 +1148,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* minElementsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMinElementsStatement(GeneratedYangParser.MinElementsStatementContext currentContext);
@@ -1156,7 +1156,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* minElementsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMinElementsStatement(GeneratedYangParser.MinElementsStatementContext currentContext);
@@ -1164,7 +1164,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* maxElementsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext currentContext);
@@ -1172,7 +1172,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* maxElementsStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext currentContext);
@@ -1180,7 +1180,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* maxValueArgument.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext currentContext);
@@ -1188,7 +1188,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* maxValueArgument.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitMaxValueArgument(GeneratedYangParser.MaxValueArgumentContext currentContext);
@@ -1196,7 +1196,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* valueStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterValueStatement(GeneratedYangParser.ValueStatementContext currentContext);
@@ -1204,7 +1204,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* valueStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitValueStatement(GeneratedYangParser.ValueStatementContext currentContext);
@@ -1212,7 +1212,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* groupingStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterGroupingStatement(GeneratedYangParser.GroupingStatementContext currentContext);
@@ -1220,7 +1220,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* groupingStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitGroupingStatement(GeneratedYangParser.GroupingStatementContext currentContext);
@@ -1228,7 +1228,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* containerStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterContainerStatement(GeneratedYangParser.ContainerStatementContext currentContext);
@@ -1236,7 +1236,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* containerStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitContainerStatement(GeneratedYangParser.ContainerStatementContext currentContext);
@@ -1244,7 +1244,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* leafStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterLeafStatement(GeneratedYangParser.LeafStatementContext currentContext);
@@ -1252,7 +1252,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* leafStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitLeafStatement(GeneratedYangParser.LeafStatementContext currentContext);
@@ -1260,7 +1260,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* leafListStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterLeafListStatement(GeneratedYangParser.LeafListStatementContext currentContext);
@@ -1268,7 +1268,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* leafListStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitLeafListStatement(GeneratedYangParser.LeafListStatementContext currentContext);
@@ -1276,7 +1276,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* listStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterListStatement(GeneratedYangParser.ListStatementContext currentContext);
@@ -1284,7 +1284,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* listStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitListStatement(GeneratedYangParser.ListStatementContext currentContext);
@@ -1292,7 +1292,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* keyStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterKeyStatement(GeneratedYangParser.KeyStatementContext currentContext);
@@ -1300,7 +1300,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* keyStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitKeyStatement(GeneratedYangParser.KeyStatementContext currentContext);
@@ -1308,7 +1308,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* uniqueStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext currentContext);
@@ -1316,7 +1316,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* uniqueStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitUniqueStatement(GeneratedYangParser.UniqueStatementContext currentContext);
@@ -1324,7 +1324,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* choiceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterChoiceStatement(GeneratedYangParser.ChoiceStatementContext currentContext);
@@ -1332,7 +1332,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* choiceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitChoiceStatement(GeneratedYangParser.ChoiceStatementContext currentContext);
@@ -1340,7 +1340,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* shortCaseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext currentContext);
@@ -1348,7 +1348,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* shortCaseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitShortCaseStatement(GeneratedYangParser.ShortCaseStatementContext currentContext);
@@ -1356,7 +1356,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* caseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterCaseStatement(GeneratedYangParser.CaseStatementContext currentContext);
@@ -1364,7 +1364,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* caseStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitCaseStatement(GeneratedYangParser.CaseStatementContext currentContext);
@@ -1372,7 +1372,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* usesStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterUsesStatement(GeneratedYangParser.UsesStatementContext currentContext);
@@ -1380,7 +1380,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* usesStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitUsesStatement(GeneratedYangParser.UsesStatementContext currentContext);
@@ -1388,7 +1388,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineStatement(GeneratedYangParser.RefineStatementContext currentContext);
@@ -1396,7 +1396,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineStatement(GeneratedYangParser.RefineStatementContext currentContext);
@@ -1404,7 +1404,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineContainerStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext currentContext);
@@ -1412,7 +1412,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineContainerStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineContainerStatements(GeneratedYangParser.RefineContainerStatementsContext currentContext);
@@ -1420,7 +1420,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineLeafStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext currentContext);
@@ -1428,7 +1428,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineLeafStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineLeafStatements(GeneratedYangParser.RefineLeafStatementsContext currentContext);
@@ -1436,7 +1436,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineLeafListStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext currentContext);
@@ -1444,7 +1444,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineLeafListStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineLeafListStatements(GeneratedYangParser.RefineLeafListStatementsContext currentContext);
@@ -1452,7 +1452,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineListStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineListStatements(GeneratedYangParser.RefineListStatementsContext currentContext);
@@ -1460,7 +1460,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineListStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineListStatements(GeneratedYangParser.RefineListStatementsContext currentContext);
@@ -1468,7 +1468,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineChoiceStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext currentContext);
@@ -1476,7 +1476,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineChoiceStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineChoiceStatements(GeneratedYangParser.RefineChoiceStatementsContext currentContext);
@@ -1484,7 +1484,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* refineCaseStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext currentContext);
@@ -1492,7 +1492,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* refineCaseStatements.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRefineCaseStatements(GeneratedYangParser.RefineCaseStatementsContext currentContext);
@@ -1500,7 +1500,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* usesAugmentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext currentContext);
@@ -1508,7 +1508,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* usesAugmentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitUsesAugmentStatement(GeneratedYangParser.UsesAugmentStatementContext currentContext);
@@ -1516,7 +1516,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* augmentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterAugmentStatement(GeneratedYangParser.AugmentStatementContext currentContext);
@@ -1524,7 +1524,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* augmentStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitAugmentStatement(GeneratedYangParser.AugmentStatementContext currentContext);
@@ -1532,7 +1532,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* whenStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterWhenStatement(GeneratedYangParser.WhenStatementContext currentContext);
@@ -1540,7 +1540,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* whenStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitWhenStatement(GeneratedYangParser.WhenStatementContext currentContext);
@@ -1548,7 +1548,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* rpcStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterRpcStatement(GeneratedYangParser.RpcStatementContext currentContext);
@@ -1556,7 +1556,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* rpcStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitRpcStatement(GeneratedYangParser.RpcStatementContext currentContext);
@@ -1564,7 +1564,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* inputStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterInputStatement(GeneratedYangParser.InputStatementContext currentContext);
@@ -1572,7 +1572,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* inputStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitInputStatement(GeneratedYangParser.InputStatementContext currentContext);
@@ -1580,7 +1580,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* outputStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterOutputStatement(GeneratedYangParser.OutputStatementContext currentContext);
@@ -1588,7 +1588,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* outputStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitOutputStatement(GeneratedYangParser.OutputStatementContext currentContext);
@@ -1596,7 +1596,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* notificationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterNotificationStatement(GeneratedYangParser.NotificationStatementContext currentContext);
@@ -1604,7 +1604,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* notificationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitNotificationStatement(GeneratedYangParser.NotificationStatementContext currentContext);
@@ -1612,7 +1612,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* deviationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext currentContext);
@@ -1620,7 +1620,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* deviationStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext currentContext);
@@ -1628,7 +1628,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* deviateNotSupportedStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext currentContext);
@@ -1636,7 +1636,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* deviateNotSupportedStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDeviateNotSupportedStatement(GeneratedYangParser.DeviateNotSupportedStatementContext currentContext);
@@ -1644,7 +1644,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* deviateAddStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext currentContext);
@@ -1652,7 +1652,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* deviateAddStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDeviateAddStatement(GeneratedYangParser.DeviateAddStatementContext currentContext);
@@ -1660,7 +1660,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* deviateDeleteStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext currentContext);
@@ -1668,7 +1668,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* deviateDeleteStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDeviateDeleteStatement(GeneratedYangParser.DeviateDeleteStatementContext currentContext);
@@ -1676,7 +1676,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* deviateReplaceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext currentContext);
@@ -1684,7 +1684,7 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* deviateReplaceStatement.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitDeviateReplaceStatement(GeneratedYangParser.DeviateReplaceStatementContext currentContext);
@@ -1692,7 +1692,7 @@
* Enter a parse tree produced by GeneratedYangParser for grammar rule
* string.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void enterString(GeneratedYangParser.StringContext currentContext);
@@ -1700,7 +1700,40 @@
* Exit a parse tree produced by GeneratedYangParser for grammar rule
* string.
*
- * @param currentContext current context in the parsed tree.
+ * @param currentContext current context in the parsed tree
*/
void exitString(GeneratedYangParser.StringContext currentContext);
+
+ /**
+ * Enter a parse tree produced by GeneratedYangParser for grammar rule
+ * identifier.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void enterIdentifier(GeneratedYangParser.IdentifierContext currentContext);
+
+ /**
+ * Exit a parse tree produced by GeneratedYangParser for grammar rule
+ * identifier.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void exitIdentifier(GeneratedYangParser.IdentifierContext currentContext);
+
+
+ /**
+ * Enter a parse tree produced by GeneratedYangParser for grammar rule
+ * dateArgumentString.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void enterDateArgumentString(GeneratedYangParser.DateArgumentStringContext currentContext);
+
+ /**
+ * Exit a parse tree produced by GeneratedYangParser for grammar rule
+ * dateArgumentString.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void exitDateArgumentString(GeneratedYangParser.DateArgumentStringContext currentContext);
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
index e615d13..7027dc0 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
@@ -1163,6 +1163,26 @@
}
@Override
+ public void enterIdentifier(GeneratedYangParser.IdentifierContext ctx) {
+ // TODO: implement the method.
+ }
+
+ @Override
+ public void exitIdentifier(GeneratedYangParser.IdentifierContext ctx) {
+ // TODO: implement the method.
+ }
+
+ @Override
+ public void enterDateArgumentString(GeneratedYangParser.DateArgumentStringContext ctx) {
+ // TODO: implement the method.
+ }
+
+ @Override
+ public void exitDateArgumentString(GeneratedYangParser.DateArgumentStringContext ctx) {
+ // TODO: implement the method.
+ }
+
+ @Override
public void visitTerminal(TerminalNode terminalNode) {
// TODO: implement the method.
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java
index c938190..92b1ee9 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BelongsToListener.java
@@ -22,6 +22,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -50,7 +52,7 @@
* submodule_header_statement : yang_version_stmt? belongs_to_stmt
* | belongs_to_stmt yang_version_stmt?
* ;
- * belongs_to_stmt : BELONGS_TO_KEYWORD IDENTIFIER LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
+ * belongs_to_stmt : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongs_to_stmt_body RIGHT_CURLY_BRACE;
* belongs_to_stmt_body : prefix_stmt;
*/
@@ -78,11 +80,13 @@
GeneratedYangParser.BelongstoStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
ENTRY);
+ String identifier = getValidIdentifier(ctx.identifier().getText(), BELONGS_TO_DATA, ctx);
+
YangBelongsTo belongstoNode = new YangBelongsTo();
- belongstoNode.setBelongsToModuleName(ctx.IDENTIFIER().getText());
+ belongstoNode.setBelongsToModuleName(identifier);
// Push belongsto into the stack.
listener.getParsedDataStack().push(belongstoNode);
@@ -99,7 +103,7 @@
GeneratedYangParser.BelongstoStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA, ctx.identifier().getText(),
EXIT);
Parsable tmpBelongstoNode = listener.getParsedDataStack().peek();
@@ -108,7 +112,7 @@
// Check for stack to be empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, BELONGS_TO_DATA,
- ctx.IDENTIFIER().getText(), EXIT);
+ ctx.identifier().getText(), EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
switch (tmpNode.getYangConstructType()) {
@@ -119,12 +123,12 @@
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, BELONGS_TO_DATA,
- ctx.IDENTIFIER().getText(),
+ ctx.identifier().getText(),
EXIT));
}
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BELONGS_TO_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java
index b13b3b1..7f15f4e 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/BitListener.java
@@ -32,7 +32,7 @@
* "}")
*
* ANTLR grammar rule
- * bitStatement : BIT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
+ * bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
*
* bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
* | positionStatement? statusStatement? referenceStatement? descriptionStatement?
@@ -65,10 +65,12 @@
import org.onosproject.yangutils.datamodel.YangBits;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.parser.Parsable;
-import static org.onosproject.yangutils.utils.YangConstructType.BIT_DATA;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
+import static org.onosproject.yangutils.utils.YangConstructType.BIT_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
@@ -102,10 +104,12 @@
GeneratedYangParser.BitStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), BIT_DATA, ctx);
YangBit bitNode = new YangBit();
- bitNode.setBitName(ctx.IDENTIFIER().getText());
+ bitNode.setBitName(identifier);
listener.getParsedDataStack().push(bitNode);
}
@@ -120,14 +124,14 @@
GeneratedYangParser.BitStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
Parsable tmpBitNode = listener.getParsedDataStack().peek();
if (tmpBitNode instanceof YangBit) {
listener.getParsedDataStack().pop();
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
switch (tmpNode.getYangConstructType()) {
@@ -152,20 +156,20 @@
yangBits.addBitInfo((YangBit) tmpBitNode);
} catch (DataModelException e) {
ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
- INVALID_CONTENT, BIT_DATA, ctx.IDENTIFIER().getText(), EXIT, e.getMessage()));
- parserException.setLine(ctx.IDENTIFIER().getSymbol().getLine());
- parserException.setCharPosition(ctx.IDENTIFIER().getSymbol().getCharPositionInLine());
+ INVALID_CONTENT, BIT_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
break;
}
default:
throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, BIT_DATA, ctx.IDENTIFIER().getText(), EXIT));
+ constructListenerErrorMessage(INVALID_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
}
} else {
throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BIT_DATA, ctx.IDENTIFIER().getText(), EXIT));
+ constructListenerErrorMessage(MISSING_CURRENT_HOLDER, BIT_DATA, ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java
index 1f23449..6cdf77b 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListener.java
@@ -25,6 +25,9 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
@@ -34,7 +37,6 @@
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
-import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.validateCardinality;
import static org.onosproject.yangutils.utils.YangConstructType.CONFIG_DATA;
@@ -66,7 +68,7 @@
* "}")
*
* ANTLR grammar rule
- * containerStatement : CONTAINER_KEYWORD IDENTIFIER
+ * containerStatement : CONTAINER_KEYWORD identifier
* (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
* presenceStatement | configStatement | statusStatement | descriptionStatement |
* referenceStatement | typedefStatement | groupingStatement
@@ -96,19 +98,20 @@
GeneratedYangParser.ContainerStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), CONTAINER_DATA, ctx);
// Validate sub statement cardinality.
validateSubStatementsCardinality(ctx);
// Check for identifier collision
- int line = ctx.IDENTIFIER().getSymbol().getLine();
- int charPositionInLine = ctx.IDENTIFIER().getSymbol().getCharPositionInLine();
- String identifierName = ctx.IDENTIFIER().getText();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifierName, CONTAINER_DATA);
+ int line = ctx.getStart().getLine();
+ int charPositionInLine = ctx.getStart().getCharPositionInLine();
+ detectCollidingChildUtil(listener, line, charPositionInLine, identifier, CONTAINER_DATA);
YangContainer container = new YangContainer();
- container.setName(ctx.IDENTIFIER().getText());
+ container.setName(identifier);
/*
* If "config" is not specified, the default is the same as the parent
@@ -127,12 +130,12 @@
curNode.addChild(container);
} catch (DataModelException e) {
throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- CONTAINER_DATA, ctx.IDENTIFIER().getText(), ENTRY, e.getMessage()));
+ CONTAINER_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
}
listener.getParsedDataStack().push(container);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, CONTAINER_DATA,
- ctx.IDENTIFIER().getText(), ENTRY));
+ ctx.identifier().getText(), ENTRY));
}
}
@@ -147,7 +150,7 @@
GeneratedYangParser.ContainerStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, CONTAINER_DATA, ctx.identifier().getText(), EXIT);
if (listener.getParsedDataStack().peek() instanceof YangContainer) {
YangContainer yangContainer = (YangContainer) listener.getParsedDataStack().peek();
@@ -155,12 +158,12 @@
yangContainer.validateDataOnExit();
} catch (DataModelException e) {
throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- CONTAINER_DATA, ctx.IDENTIFIER().getText(), EXIT, e.getMessage()));
+ CONTAINER_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
}
listener.getParsedDataStack().pop();
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, CONTAINER_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
@@ -171,11 +174,11 @@
*/
private static void validateSubStatementsCardinality(GeneratedYangParser.ContainerStatementContext ctx) {
- validateCardinality(ctx.presenceStatement(), PRESENCE_DATA, CONTAINER_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.configStatement(), CONFIG_DATA, CONTAINER_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, CONTAINER_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, CONTAINER_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.statusStatement(), STATUS_DATA, CONTAINER_DATA, ctx.IDENTIFIER().getText());
+ validateCardinality(ctx.presenceStatement(), PRESENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.configStatement(), CONFIG_DATA, CONTAINER_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, CONTAINER_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, CONTAINER_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.statusStatement(), STATUS_DATA, CONTAINER_DATA, ctx.identifier().getText());
// TODO when, grouping, typedef.
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java
index bd120ad..f34bd30 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ImportListener.java
@@ -23,6 +23,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -49,7 +51,7 @@
* ANTLR grammar rule
* linkage_stmts : (import_stmt
* | include_stmt)*;
- * import_stmt : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE import_stmt_body
+ * import_stmt : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE import_stmt_body
* RIGHT_CURLY_BRACE;
* import_stmt_body : prefix_stmt revision_date_stmt?;
*/
@@ -76,10 +78,12 @@
public static void processImportEntry(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), IMPORT_DATA, ctx);
YangImport importNode = new YangImport();
- importNode.setModuleName(ctx.IDENTIFIER().getText());
+ importNode.setModuleName(identifier);
// Push import node to the stack.
listener.getParsedDataStack().push(importNode);
@@ -95,14 +99,14 @@
public static void processImportExit(TreeWalkListener listener, GeneratedYangParser.ImportStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(), EXIT);
Parsable tmpImportNode = listener.getParsedDataStack().peek();
if (tmpImportNode instanceof YangImport) {
listener.getParsedDataStack().pop();
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, IMPORT_DATA, ctx.identifier().getText(),
EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
@@ -119,12 +123,12 @@
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, IMPORT_DATA,
- ctx.IDENTIFIER().getText(),
+ ctx.identifier().getText(),
EXIT));
}
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, IMPORT_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
index 6e28ada..b9325da 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
@@ -23,6 +23,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -49,7 +51,7 @@
* ANTLR grammar rule
* linkage_stmts : (import_stmt
* | include_stmt)*;
- * include_stmt : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
+ * include_stmt : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
* revision_date_stmt? RIGHT_CURLY_BRACE);
*/
@@ -75,11 +77,13 @@
public static void processIncludeEntry(TreeWalkListener listener, GeneratedYangParser.IncludeStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
ENTRY);
+ String identifier = getValidIdentifier(ctx.identifier().getText(), INCLUDE_DATA, ctx);
+
YangInclude includeNode = new YangInclude();
- includeNode.setSubModuleName(ctx.IDENTIFIER().getText());
+ includeNode.setSubModuleName(identifier);
listener.getParsedDataStack().push(includeNode);
}
@@ -94,14 +98,14 @@
public static void processIncludeExit(TreeWalkListener listener, GeneratedYangParser.IncludeStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(), EXIT);
Parsable tmpIncludeNode = listener.getParsedDataStack().peek();
if (tmpIncludeNode instanceof YangInclude) {
listener.getParsedDataStack().pop();
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
@@ -118,12 +122,12 @@
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, INCLUDE_DATA,
- ctx.IDENTIFIER().getText(),
+ ctx.identifier().getText(),
EXIT));
}
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INCLUDE_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
index 896e8ec..0a867cc 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
@@ -22,6 +22,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
@@ -64,7 +66,7 @@
* "}"
*
* ANTLR grammar rule
- * leafListStatement : LEAF_LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement |
+ * leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement |
* typeStatement | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement |
* orderedByStatement | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
*/
@@ -92,19 +94,20 @@
GeneratedYangParser.LeafListStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_LIST_DATA, ctx);
// Validate sub statement cardinality.
validateSubStatementsCardinality(ctx);
// Check for identifier collision
- int line = ctx.IDENTIFIER().getSymbol().getLine();
- int charPositionInLine = ctx.IDENTIFIER().getSymbol().getCharPositionInLine();
- String identifierName = ctx.IDENTIFIER().getText();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifierName, LEAF_LIST_DATA);
+ int line = ctx.getStart().getLine();
+ int charPositionInLine = ctx.getStart().getCharPositionInLine();
+ detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_LIST_DATA);
YangLeafList leafList = new YangLeafList();
- leafList.setLeafName(ctx.IDENTIFIER().getText());
+ leafList.setLeafName(identifier);
Parsable tmpData = listener.getParsedDataStack().peek();
YangLeavesHolder leaves;
@@ -114,7 +117,7 @@
leaves.addLeafList(leafList);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_LIST_DATA,
- ctx.IDENTIFIER().getText(), ENTRY));
+ ctx.identifier().getText(), ENTRY));
}
listener.getParsedDataStack().push(leafList);
}
@@ -130,31 +133,31 @@
GeneratedYangParser.LeafListStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_LIST_DATA, ctx.identifier().getText(), EXIT);
if (listener.getParsedDataStack().peek() instanceof YangLeafList) {
listener.getParsedDataStack().pop();
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_LIST_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
/**
* Validates the cardinality of leaf-list sub-statements as per grammar.
*
- * @param ctx context object of the grammar rule.
+ * @param ctx context object of the grammar rule
*/
private static void validateSubStatementsCardinality(GeneratedYangParser.LeafListStatementContext ctx) {
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.unitsStatement(), UNITS_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.configStatement(), CONFIG_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.statusStatement(), STATUS_DATA, LEAF_LIST_DATA, ctx.IDENTIFIER().getText());
+ validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.unitsStatement(), UNITS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.configStatement(), CONFIG_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.statusStatement(), STATUS_DATA, LEAF_LIST_DATA, ctx.identifier().getText());
//TODO ordered by
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
index 226f621..4573764 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
@@ -26,6 +26,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
@@ -66,7 +68,7 @@
* "}"
*
* ANTLR grammar rule
- * leafStatement : LEAF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement |
+ * leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement |
* unitsStatement | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement |
* descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
*/
@@ -94,19 +96,20 @@
GeneratedYangParser.LeafStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), LEAF_DATA, ctx);
// Validate sub statement cardinality.
validateSubStatementsCardinality(ctx);
// Check for identifier collision
- int line = ctx.IDENTIFIER().getSymbol().getLine();
- int charPositionInLine = ctx.IDENTIFIER().getSymbol().getCharPositionInLine();
- String identifierName = ctx.IDENTIFIER().getText();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifierName, LEAF_DATA);
+ int line = ctx.getStart().getLine();
+ int charPositionInLine = ctx.getStart().getCharPositionInLine();
+ detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LEAF_DATA);
YangLeaf leaf = new YangLeaf();
- leaf.setLeafName(ctx.IDENTIFIER().getText());
+ leaf.setLeafName(identifier);
Parsable tmpData = listener.getParsedDataStack().peek();
YangLeavesHolder leaves;
@@ -116,7 +119,7 @@
leaves.addLeaf(leaf);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_DATA,
- ctx.IDENTIFIER().getText(), ENTRY));
+ ctx.identifier().getText(), ENTRY));
}
listener.getParsedDataStack().push(leaf);
@@ -126,37 +129,37 @@
* It is called when parser exits from grammar rule (leaf), performs
* validation and updates the data model tree.
*
- * @param listener listener's object.
- * @param ctx context object of the grammar rule.
+ * @param listener listener's object
+ * @param ctx context object of the grammar rule
*/
public static void processLeafExit(TreeWalkListener listener,
GeneratedYangParser.LeafStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LEAF_DATA, ctx.identifier().getText(), EXIT);
if (listener.getParsedDataStack().peek() instanceof YangLeaf) {
listener.getParsedDataStack().pop();
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LEAF_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
/**
* Validates the cardinality of leaf sub-statements as per grammar.
*
- * @param ctx context object of the grammar rule.
+ * @param ctx context object of the grammar rule
*/
private static void validateSubStatementsCardinality(GeneratedYangParser.LeafStatementContext ctx) {
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.unitsStatement(), UNITS_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.configStatement(), CONFIG_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.mandatoryStatement(), MANDATORY_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.statusStatement(), STATUS_DATA, LEAF_DATA, ctx.IDENTIFIER().getText());
+ validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.unitsStatement(), UNITS_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.configStatement(), CONFIG_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.mandatoryStatement(), MANDATORY_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LEAF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.statusStatement(), STATUS_DATA, LEAF_DATA, ctx.identifier().getText());
//TODO when.
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java
index d71186e..50f2fd5 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ListListener.java
@@ -27,6 +27,7 @@
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerCollisionDetector.detectCollidingChildUtil;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
@@ -74,7 +75,7 @@
* "}"
*
* ANTLR grammar rule
- * listStatement : LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
+ * listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement |
* keyStatement | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement |
* orderedByStatement | statusStatement | descriptionStatement | referenceStatement | typedefStatement |
* groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
@@ -104,19 +105,20 @@
YangNode curNode;
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), LIST_DATA, ctx);
// Validate sub statement cardinality.
validateSubStatementsCardinality(ctx);
// Check for identifier collision
- int line = ctx.IDENTIFIER().getSymbol().getLine();
- int charPositionInLine = ctx.IDENTIFIER().getSymbol().getCharPositionInLine();
- String identifierName = ctx.IDENTIFIER().getText();
- detectCollidingChildUtil(listener, line, charPositionInLine, identifierName, LIST_DATA);
+ int line = ctx.getStart().getLine();
+ int charPositionInLine = ctx.getStart().getCharPositionInLine();
+ detectCollidingChildUtil(listener, line, charPositionInLine, identifier, LIST_DATA);
YangList yangList = new YangList();
- yangList.setName(ctx.IDENTIFIER().getText());
+ yangList.setName(identifier);
/*
* If "config" is not specified, the default is the same as the parent
@@ -135,12 +137,12 @@
curNode.addChild(yangList);
} catch (DataModelException e) {
throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- LIST_DATA, ctx.IDENTIFIER().getText(), ENTRY, e.getMessage()));
+ LIST_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
}
listener.getParsedDataStack().push(yangList);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LIST_DATA,
- ctx.IDENTIFIER().getText(), ENTRY));
+ ctx.identifier().getText(), ENTRY));
}
}
@@ -154,7 +156,7 @@
public static void processListExit(TreeWalkListener listener,
GeneratedYangParser.ListStatementContext ctx) {
- checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, LIST_DATA, ctx.identifier().getText(), EXIT);
if (listener.getParsedDataStack().peek() instanceof YangList) {
YangList yangList = (YangList) listener.getParsedDataStack().peek();
@@ -162,12 +164,12 @@
yangList.validateDataOnExit();
} catch (DataModelException e) {
throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- LIST_DATA, ctx.IDENTIFIER().getText(), EXIT, e.getMessage()));
+ LIST_DATA, ctx.identifier().getText(), EXIT, e.getMessage()));
}
listener.getParsedDataStack().pop();
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, LIST_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
@@ -178,14 +180,14 @@
*/
private static void validateSubStatementsCardinality(GeneratedYangParser.ListStatementContext ctx) {
- validateCardinality(ctx.keyStatement(), KEY_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.configStatement(), CONFIG_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.statusStatement(), STATUS_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
- validateCardinalityNonNull(ctx.dataDefStatement(), DATA_DEF_DATA, LIST_DATA, ctx.IDENTIFIER().getText());
+ validateCardinality(ctx.keyStatement(), KEY_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.configStatement(), CONFIG_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.maxElementsStatement(), MAX_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.minElementsStatement(), MIN_ELEMENT_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.statusStatement(), STATUS_DATA, LIST_DATA, ctx.identifier().getText());
+ validateCardinalityNonNull(ctx.dataDefStatement(), DATA_DEF_DATA, LIST_DATA, ctx.identifier().getText());
//TODO when, typedef, grouping, unique
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
index f4f6ef5..bc8ee02 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListener.java
@@ -20,6 +20,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -45,7 +47,7 @@
* "}" optsep
*
* ANTLR grammar rule
- * module_stmt : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
+ * module_stmt : MODULE_KEYWORD identifier LEFT_CURLY_BRACE module_body* RIGHT_CURLY_BRACE;
*/
/**
@@ -70,10 +72,12 @@
public static void processModuleEntry(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) {
// Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, MODULE_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsEmpty(listener, INVALID_HOLDER, MODULE_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), MODULE_DATA, ctx);
YangModule yangModule = new YangModule();
- yangModule.setName(ctx.IDENTIFIER().getText());
+ yangModule.setName(identifier);
if (ctx.moduleBody(0).moduleHeaderStatement().yangVersionStatement() == null) {
yangModule.setVersion((byte) 1);
@@ -92,11 +96,11 @@
public static void processModuleExit(TreeWalkListener listener, GeneratedYangParser.ModuleStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, MODULE_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, MODULE_DATA, ctx.identifier().getText(), EXIT);
if (!(listener.getParsedDataStack().peek() instanceof YangModule)) {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, MODULE_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java
index 43e600b..a4a094b 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PositionListener.java
@@ -30,7 +30,7 @@
* zero-integer-value = 1*DIGIT
*
* ANTLR grammar rule
- * positionStatement : POSITION_KEYWORD INTEGER STMTEND;
+ * positionStatement : POSITION_KEYWORD string STMTEND;
*/
import org.onosproject.yangutils.datamodel.YangBit;
@@ -44,6 +44,7 @@
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
import static org.onosproject.yangutils.utils.YangConstructType.POSITION_DATA;
@@ -73,25 +74,27 @@
GeneratedYangParser.PositionStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.INTEGER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.string().getText(), ENTRY);
+
+ String position = removeQuotesAndHandleConcat(ctx.string().getText());
// Obtain the node of the stack.
Parsable tmpNode = listener.getParsedDataStack().peek();
switch (tmpNode.getYangConstructType()) {
case BIT_DATA: {
YangBit bitNode = (YangBit) tmpNode;
- if (!isBitPositionValid(listener, ctx)) {
+ if (!isBitPositionValid(listener, ctx, position)) {
ParserException parserException = new ParserException(errMsg);
- parserException.setLine(ctx.INTEGER().getSymbol().getLine());
- parserException.setCharPosition(ctx.INTEGER().getSymbol().getCharPositionInLine());
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
- bitNode.setPosition(Integer.valueOf(ctx.INTEGER().getText()));
+ bitNode.setPosition(Integer.valueOf(position));
break;
}
default:
throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.INTEGER().getText(), ENTRY));
+ constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.string().getText(), ENTRY));
}
}
@@ -103,13 +106,13 @@
* @return validation result
*/
private static boolean isBitPositionValid(TreeWalkListener listener,
- GeneratedYangParser.PositionStatementContext ctx) {
+ GeneratedYangParser.PositionStatementContext ctx, String position) {
Parsable bitNode = listener.getParsedDataStack().pop();
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.INTEGER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, POSITION_DATA, ctx.string().getText(), ENTRY);
- if (Integer.valueOf(ctx.INTEGER().getText()) < 0) {
+ if (Integer.valueOf(position) < 0) {
errMsg = "YANG file error: Negative value of position is invalid.";
listener.getParsedDataStack().push(bitNode);
return false;
@@ -120,7 +123,7 @@
case BITS_DATA: {
YangBits yangBits = (YangBits) tmpNode;
for (YangBit curBit : yangBits.getBitSet()) {
- if (Integer.valueOf(ctx.INTEGER().getText()) == curBit.getPosition()) {
+ if (Integer.valueOf(position) == curBit.getPosition()) {
errMsg = "YANG file error: Duplicate value of position is invalid.";
listener.getParsedDataStack().push(bitNode);
return false;
@@ -132,7 +135,7 @@
default:
listener.getParsedDataStack().push(bitNode);
throw new ParserException(
- constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.INTEGER().getText(), ENTRY));
+ constructListenerErrorMessage(INVALID_HOLDER, POSITION_DATA, ctx.string().getText(), ENTRY));
}
}
}
\ No newline at end of file
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java
index e59cda0..1fbe6dd 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListener.java
@@ -24,6 +24,7 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.utils.YangConstructType.PREFIX_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -51,7 +52,7 @@
* | prefix_stmt namespace_stmt yang_version_stmt?
* | prefix_stmt yang_version_stmt? namespace_stmt
* ;
- * prefix_stmt : PREFIX_KEYWORD IDENTIFIER STMTEND;
+ * prefix_stmt : PREFIX_KEYWORD identifier STMTEND;
*/
/**
@@ -76,29 +77,31 @@
public static void processPrefixEntry(TreeWalkListener listener, GeneratedYangParser.PrefixStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, PREFIX_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, PREFIX_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), PREFIX_DATA, ctx);
// Obtain the node of the stack.
Parsable tmpNode = listener.getParsedDataStack().peek();
switch (tmpNode.getYangConstructType()) {
case MODULE_DATA: {
YangModule module = (YangModule) tmpNode;
- module.setPrefix(ctx.IDENTIFIER().getText());
+ module.setPrefix(identifier);
break;
}
case IMPORT_DATA: {
YangImport importNode = (YangImport) tmpNode;
- importNode.setPrefixId(ctx.IDENTIFIER().getText());
+ importNode.setPrefixId(identifier);
break;
}
case BELONGS_TO_DATA: {
YangBelongsTo belongstoNode = (YangBelongsTo) tmpNode;
- belongstoNode.setPrefix(ctx.IDENTIFIER().getText());
+ belongstoNode.setPrefix(identifier);
break;
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, PREFIX_DATA,
- ctx.IDENTIFIER().getText(), ENTRY));
+ ctx.identifier().getText(), ENTRY));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java
index 03f1cb1..f5c4993 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListener.java
@@ -16,10 +16,6 @@
package org.onosproject.yangutils.parser.impl.listeners;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
import org.onosproject.yangutils.datamodel.YangImport;
import org.onosproject.yangutils.datamodel.YangInclude;
import org.onosproject.yangutils.parser.Parsable;
@@ -27,6 +23,8 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.isDateValid;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
@@ -86,13 +84,14 @@
GeneratedYangParser.RevisionDateStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATE_DATA, ctx.DATE_ARG().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATE_DATA, ctx.dateArgumentString().getText(),
ENTRY);
- if (!isDateValid(ctx.DATE_ARG().getText())) {
+ String date = removeQuotesAndHandleConcat(ctx.dateArgumentString().getText());
+ if (!isDateValid(date)) {
ParserException parserException = new ParserException("YANG file error: Input date is not correct");
- parserException.setLine(ctx.DATE_ARG().getSymbol().getLine());
- parserException.setCharPosition(ctx.DATE_ARG().getSymbol().getCharPositionInLine());
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
@@ -101,42 +100,17 @@
switch (tmpNode.getYangConstructType()) {
case IMPORT_DATA: {
YangImport importNode = (YangImport) tmpNode;
- importNode.setRevision(ctx.DATE_ARG().getText());
+ importNode.setRevision(date);
break;
}
case INCLUDE_DATA: {
YangInclude includeNode = (YangInclude) tmpNode;
- includeNode.setRevision(ctx.DATE_ARG().getText());
+ includeNode.setRevision(date);
break;
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATE_DATA,
- ctx.DATE_ARG().getText(), ENTRY));
+ ctx.dateArgumentString().getText(), ENTRY));
}
}
-
- /**
- * Validates the revision date.
- *
- * @param dateToValidate input revision date
- * @return validation result, true for success, false for failure
- */
- private static boolean isDateValid(String dateToValidate) {
-
- if (dateToValidate == null) {
- return false;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- sdf.setLenient(false);
-
- try {
- //if not valid, it will throw ParseException
- Date date = sdf.parse(dateToValidate);
- System.out.println(date);
- } catch (ParseException e) {
- return false;
- }
- return true;
- }
}
\ No newline at end of file
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java
index 32675cd..dd29457 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListener.java
@@ -24,6 +24,8 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.isDateValid;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
@@ -33,10 +35,6 @@
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
/*
* Reference: RFC6020 and YANG ANTLR Grammar
*
@@ -88,7 +86,7 @@
GeneratedYangParser.RevisionStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.DATE_ARG().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), ENTRY);
// Validate for reverse chronological order of revision & for revision
// value.
@@ -97,15 +95,16 @@
// TODO to be implemented.
}
- if (!isDateValid(ctx.DATE_ARG().getText())) {
+ String date = removeQuotesAndHandleConcat(ctx.dateArgumentString().getText());
+ if (!isDateValid(date)) {
ParserException parserException = new ParserException("YANG file error: Input date is not correct");
- parserException.setLine(ctx.DATE_ARG().getSymbol().getLine());
- parserException.setCharPosition(ctx.DATE_ARG().getSymbol().getCharPositionInLine());
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
YangRevision revisionNode = new YangRevision();
- revisionNode.setRevDate(ctx.DATE_ARG().getText());
+ revisionNode.setRevDate(date);
listener.getParsedDataStack().push(revisionNode);
}
@@ -121,14 +120,14 @@
ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.DATE_ARG().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(), EXIT);
Parsable tmpRevisionNode = listener.getParsedDataStack().peek();
if (tmpRevisionNode instanceof YangRevision) {
listener.getParsedDataStack().pop();
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.DATE_ARG().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, REVISION_DATA, ctx.dateArgumentString().getText(),
EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
@@ -145,12 +144,12 @@
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, REVISION_DATA,
- ctx.DATE_ARG().getText(),
+ ctx.dateArgumentString().getText(),
EXIT));
}
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, REVISION_DATA,
- ctx.DATE_ARG().getText(), EXIT));
+ ctx.dateArgumentString().getText(), EXIT));
}
}
@@ -166,29 +165,4 @@
// TODO to be implemented
return true;
}
-
- /**
- * Validates the revision date.
- *
- * @param dateToValidate input revision date
- * @return validation result, true for success, false for failure
- */
- private static boolean isDateValid(String dateToValidate) {
-
- if (dateToValidate == null) {
- return false;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- sdf.setLenient(false);
-
- try {
- //if not valid, it will throw ParseException
- Date date = sdf.parse(dateToValidate);
- System.out.println(date);
- } catch (ParseException e) {
- return false;
- }
- return true;
- }
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
index 4f8a64e..080767a 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListener.java
@@ -20,6 +20,8 @@
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -45,7 +47,7 @@
* "}" optsep
*
* ANTLR grammar rule
- * submodule_stmt : SUBMODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE submodule_body* RIGHT_CURLY_BRACE;
+ * submodule_stmt : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submodule_body* RIGHT_CURLY_BRACE;
* submodule_body : submodule_header_statement linkage_stmts meta_stmts revision_stmts body_stmts;
*/
@@ -72,11 +74,13 @@
GeneratedYangParser.SubModuleStatementContext ctx) {
// Check if stack is empty.
- checkStackIsEmpty(listener, INVALID_HOLDER, SUB_MODULE_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsEmpty(listener, INVALID_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
ENTRY);
+ String identifier = getValidIdentifier(ctx.identifier().getText(), SUB_MODULE_DATA, ctx);
+
YangSubModule yangSubModule = new YangSubModule();
- yangSubModule.setName(ctx.IDENTIFIER().getText());
+ yangSubModule.setName(identifier);
if (ctx.submoduleBody(0).submoduleHeaderStatement().yangVersionStatement() == null) {
yangSubModule.setVersion((byte) 1);
@@ -96,12 +100,12 @@
GeneratedYangParser.SubModuleStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, SUB_MODULE_DATA, ctx.IDENTIFIER().getText(),
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, SUB_MODULE_DATA, ctx.identifier().getText(),
EXIT);
if (!(listener.getParsedDataStack().peek() instanceof YangSubModule)) {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, SUB_MODULE_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
index d2af63e..4622ccf 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
@@ -42,7 +42,7 @@
* "}"
*
* ANTLR grammar rule
- * typedefStatement : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
+ * typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
* (typeStatement | unitsStatement | defaultStatement | statusStatement
* | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
*/
@@ -62,6 +62,7 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.getValidIdentifier;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
@@ -105,7 +106,9 @@
GeneratedYangParser.TypedefStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.IDENTIFIER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), ENTRY);
+
+ String identifier = getValidIdentifier(ctx.identifier().getText(), TYPEDEF_DATA, ctx);
// Validate sub statement cardinality.
validateSubStatementsCardinality(ctx);
@@ -116,7 +119,7 @@
*/
YangType<YangDerivedType> derivedType = new YangType<YangDerivedType>();
derivedType.setDataType(YangDataTypes.DERIVED);
- derivedType.setDataTypeName(ctx.IDENTIFIER().getText());
+ derivedType.setDataTypeName(identifier);
YangTypeDef typeDefNode = new YangTypeDef();
typeDefNode.setDerivedType(derivedType);
@@ -133,12 +136,12 @@
curNode.addChild(typeDefNode);
} catch (DataModelException e) {
throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
- TYPEDEF_DATA, ctx.IDENTIFIER().getText(), ENTRY, e.getMessage()));
+ TYPEDEF_DATA, ctx.identifier().getText(), ENTRY, e.getMessage()));
}
listener.getParsedDataStack().push(typeDefNode);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER,
- TYPEDEF_DATA, ctx.IDENTIFIER().getText(), ENTRY));
+ TYPEDEF_DATA, ctx.identifier().getText(), ENTRY));
}
}
@@ -153,7 +156,7 @@
GeneratedYangParser.TypedefStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.IDENTIFIER().getText(), EXIT);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, TYPEDEF_DATA, ctx.identifier().getText(), EXIT);
if (listener.getParsedDataStack().peek() instanceof YangTypeDef) {
YangTypeDef typeDefNode = (YangTypeDef) listener.getParsedDataStack().peek();
@@ -161,13 +164,13 @@
typeDefNode.validateDataOnExit();
} catch (DataModelException e) {
throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, TYPEDEF_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
listener.getParsedDataStack().pop();
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA,
- ctx.IDENTIFIER().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
@@ -178,11 +181,11 @@
*/
private static void validateSubStatementsCardinality(GeneratedYangParser.TypedefStatementContext ctx) {
- validateCardinality(ctx.unitsStatement(), UNITS_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.defaultStatement(), DEFAULT_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
- validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
- validateCardinality(ctx.statusStatement(), STATUS_DATA, TYPEDEF_DATA, ctx.IDENTIFIER().getText());
+ validateCardinality(ctx.unitsStatement(), UNITS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.defaultStatement(), DEFAULT_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+ validateCardinalityEqualsOne(ctx.typeStatement(), TYPE_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.descriptionStatement(), DESCRIPTION_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.referenceStatement(), REFERENCE_DATA, TYPEDEF_DATA, ctx.identifier().getText());
+ validateCardinality(ctx.statusStatement(), STATUS_DATA, TYPEDEF_DATA, ctx.identifier().getText());
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
index 9b9a388..f8d5361 100644
--- a/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
@@ -23,6 +23,7 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
import static org.onosproject.yangutils.utils.YangConstructType.VERSION_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
@@ -59,7 +60,7 @@
* submodule_header_statement : yang_version_stmt? belongs_to_stmt
* | belongs_to_stmt yang_version_stmt?
* ;
- * yang_version_stmt : YANG_VERSION_KEYWORD INTEGER STMTEND;
+ * yang_version_stmt : YANG_VERSION_KEYWORD string STMTEND;
*/
/**
@@ -85,13 +86,13 @@
GeneratedYangParser.YangVersionStatementContext ctx) {
// Check for stack to be non empty.
- checkStackIsNotEmpty(listener, MISSING_HOLDER, VERSION_DATA, ctx.INTEGER().getText(), ENTRY);
+ checkStackIsNotEmpty(listener, MISSING_HOLDER, VERSION_DATA, ctx.string().getText(), ENTRY);
- Integer version = Integer.valueOf(ctx.INTEGER().getText());
- if (!isVersionValid(version)) {
+ String version = removeQuotesAndHandleConcat(ctx.string().getText());
+ if (!isVersionValid(Integer.valueOf(version))) {
ParserException parserException = new ParserException("YANG file error: Input version not supported");
- parserException.setLine(ctx.INTEGER().getSymbol().getLine());
- parserException.setCharPosition(ctx.INTEGER().getSymbol().getCharPositionInLine());
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
@@ -110,7 +111,7 @@
}
default:
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, VERSION_DATA,
- ctx.INTEGER().getText(), ENTRY));
+ ctx.string().getText(), ENTRY));
}
}
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java b/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
new file mode 100644
index 0000000..41b2418
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerUtil.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.parser.impl.parserutils;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.regex.Pattern;
+import org.onosproject.yangutils.utils.YangConstructType;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+
+/**
+ * It's a utility for listener.
+ */
+public final class ListenerUtil {
+ private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("[a-zA-Z_][a-zA-Z0-9_.-]*");
+ private static final String PLUS = "+";
+ private static final int IDENTIFIER_LENGTH = 64;
+
+ /**
+ * Creates a new listener util.
+ */
+ private ListenerUtil() {
+ }
+
+ /**
+ * Removes doubles quotes and concatenates if string has plus symbol.
+ *
+ * @param yangStringData string from yang file
+ * @return concatenated string after removing double quotes
+ */
+ public static String removeQuotesAndHandleConcat(String yangStringData) {
+
+ yangStringData = yangStringData.replace("\"", "");
+ String[] tmpData = yangStringData.split(Pattern.quote(PLUS));
+ StringBuilder builder = new StringBuilder();
+ for (String yangString : tmpData) {
+ builder.append(yangString);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Validates identifier and returns concatenated string if string contains plus symbol.
+ *
+ * @param identifier string from yang file
+ * @param yangConstruct yang construct for creating error message
+ * @param ctx yang construct's context to get the line number and character position
+ * @return concatenated string after removing double quotes
+ */
+ public static String getValidIdentifier(String identifier, YangConstructType yangConstruct, ParserRuleContext ctx) {
+
+ String identifierString = removeQuotesAndHandleConcat(identifier);
+ ParserException parserException;
+
+ if (identifierString.length() > IDENTIFIER_LENGTH) {
+ parserException = new ParserException("YANG file error : " +
+ YangConstructType.getYangConstructType(yangConstruct) + " name " + identifierString + " is " +
+ "greater than 64 characters.");
+ } else if (!IDENTIFIER_PATTERN.matcher(identifierString).matches()) {
+ parserException = new ParserException("YANG file error : " +
+ YangConstructType.getYangConstructType(yangConstruct) + " name " + identifierString + " is not " +
+ "valid.");
+ } else {
+ return identifierString;
+ }
+
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+ throw parserException;
+ }
+
+ /**
+ * Validates the revision date.
+ *
+ * @param dateToValidate input revision date
+ * @return validation result, true for success, false for failure
+ */
+ public static boolean isDateValid(String dateToValidate) {
+
+ if (dateToValidate == null || !dateToValidate.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}")) {
+ return false;
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ sdf.setLenient(false);
+
+ try {
+ //if not valid, it will throw ParseException
+ sdf.parse(dateToValidate);
+ } catch (ParseException e) {
+ return false;
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/GeneratedYang.g4 b/src/main/resources/GeneratedYang.g4
index b3272bc..9614b21 100644
--- a/src/main/resources/GeneratedYang.g4
+++ b/src/main/resources/GeneratedYang.g4
@@ -40,7 +40,7 @@
* "}" optsep
*/
- moduleStatement : MODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE moduleBody* RIGHT_CURLY_BRACE;
+ moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody* RIGHT_CURLY_BRACE;
moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
@@ -135,7 +135,7 @@
* optsep stmtend
*/
- yangVersionStatement : YANG_VERSION_KEYWORD INTEGER STMTEND;
+ yangVersionStatement : YANG_VERSION_KEYWORD string STMTEND;
/**
@@ -148,7 +148,7 @@
* prefix-stmt = prefix-keyword sep prefix-arg-str
* optsep stmtend
*/
- prefixStatement : PREFIX_KEYWORD IDENTIFIER STMTEND;
+ prefixStatement : PREFIX_KEYWORD identifier STMTEND;
/**
* import-stmt = import-keyword sep identifier-arg-str optsep
@@ -157,12 +157,12 @@
* [revision-date-stmt stmtsep]
* "}"
*/
- importStatement : IMPORT_KEYWORD IDENTIFIER LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
+ importStatement : IMPORT_KEYWORD identifier LEFT_CURLY_BRACE importStatementBody RIGHT_CURLY_BRACE;
importStatementBody : prefixStatement revisionDateStatement?;
// revision-date-stmt = revision-date-keyword sep revision-date stmtend
- revisionDateStatement : REVISION_DATE_KEYWORD DATE_ARG STMTEND;
+ revisionDateStatement : REVISION_DATE_KEYWORD dateArgumentString STMTEND;
/**
* include-stmt = include-keyword sep identifier-arg-str optsep
@@ -171,7 +171,7 @@
* [revision-date-stmt stmtsep]
* "}")
*/
- includeStatement : INCLUDE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
+ includeStatement : INCLUDE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE revisionDateStatement? RIGHT_CURLY_BRACE);
/**
* organization-stmt = organization-keyword sep string
@@ -196,7 +196,7 @@
* [reference-stmt stmtsep]
* "}")
*/
- revisionStatement : REVISION_KEYWORD DATE_ARG (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
+ revisionStatement : REVISION_KEYWORD dateArgumentString (STMTEND | LEFT_CURLY_BRACE revisionStatementBody RIGHT_CURLY_BRACE);
revisionStatementBody : descriptionStatement? referenceStatement?;
/**
@@ -210,7 +210,7 @@
* body-stmts
* "}" optsep
*/
- subModuleStatement : SUBMODULE_KEYWORD IDENTIFIER LEFT_CURLY_BRACE submoduleBody* RIGHT_CURLY_BRACE;
+ subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody* RIGHT_CURLY_BRACE;
submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
/** submodule-header-stmts =
@@ -229,7 +229,7 @@
* prefix-stmt stmtsep
* "}"
*/
- belongstoStatement : BELONGS_TO_KEYWORD IDENTIFIER LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
+ belongstoStatement : BELONGS_TO_KEYWORD identifier LEFT_CURLY_BRACE belongstoStatementBody RIGHT_CURLY_BRACE;
belongstoStatementBody : prefixStatement;
/**
@@ -243,7 +243,7 @@
* [reference-stmt stmtsep]
* "}")
*/
- extensionStatement : EXTENSION_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
+ extensionStatement : EXTENSION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE extensionBody RIGHT_CURLY_BRACE);
extensionBody : argumentStatement? statusStatement? descriptionStatement? referenceStatement?
| argumentStatement? statusStatement? referenceStatement? descriptionStatement?
| argumentStatement? descriptionStatement? statusStatement? referenceStatement?
@@ -277,7 +277,7 @@
* [yin-element-stmt stmtsep]
* "}")
*/
- argumentStatement : ARGUMENT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
+ argumentStatement : ARGUMENT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE argumentBody RIGHT_CURLY_BRACE);
argumentBody : yinElementStatement?;
/**
@@ -297,7 +297,7 @@
* [reference-stmt stmtsep]
* "}")
*/
- identityStatement : IDENTITY_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
+ identityStatement : IDENTITY_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE identityBody RIGHT_CURLY_BRACE);
identityBody : baseStatement? statusStatement? descriptionStatement? referenceStatement?
| baseStatement? statusStatement? referenceStatement? descriptionStatement?
| baseStatement? descriptionStatement? statusStatement? referenceStatement?
@@ -410,7 +410,7 @@
* "}"
* TODO : 0..1 occurance to be validated in listener
*/
- typedefStatement : TYPEDEF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE
+ typedefStatement : TYPEDEF_KEYWORD identifier LEFT_CURLY_BRACE
(typeStatement | unitsStatement | defaultStatement | statusStatement | descriptionStatement | referenceStatement)*
RIGHT_CURLY_BRACE;
@@ -622,7 +622,7 @@
* "}"
* "}")
*/
- bitStatement : BIT_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
+ bitStatement : BIT_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE bitBodyStatement RIGHT_CURLY_BRACE);
bitBodyStatement : positionStatement? statusStatement? descriptionStatement? referenceStatement?
| positionStatement? statusStatement? referenceStatement? descriptionStatement?
@@ -657,7 +657,7 @@
* position-value-arg >
* position-value-arg = non-negative-integer-value
*/
- positionStatement : POSITION_KEYWORD INTEGER STMTEND;
+ positionStatement : POSITION_KEYWORD string STMTEND;
/**
* status-stmt = status-keyword sep status-arg-str stmtend
@@ -771,7 +771,7 @@
* "}")
* TODO : 0..1 occurance to be checked in listener
*/
- groupingStatement : GROUPING_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE
+ groupingStatement : GROUPING_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE
(statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
| dataDefStatement)* RIGHT_CURLY_BRACE);
@@ -794,7 +794,7 @@
* "}")
* TODO : 0..1 occurance to be checked in listener
*/
- containerStatement : CONTAINER_KEYWORD IDENTIFIER
+ containerStatement : CONTAINER_KEYWORD identifier
(STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
| statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
| dataDefStatement)* RIGHT_CURLY_BRACE);
@@ -817,7 +817,7 @@
* "}"
* TODO : 0..1 occurance to be checked in listener
*/
- leafStatement : LEAF_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
+ leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
| mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement | descriptionStatement
| referenceStatement)* RIGHT_CURLY_BRACE;
@@ -840,7 +840,7 @@
* "}"
* TODO : 0..1 occurance to be checked in listener
*/
- leafListStatement : LEAF_LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
+ leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
| unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
| statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
@@ -866,7 +866,7 @@
* "}"
* TODO : 0..1 occurance to be checked in listener
*/
- listStatement : LIST_KEYWORD IDENTIFIER LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
+ listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
| uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
| descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
@@ -897,7 +897,7 @@
* "}")
* TODO : 0..1 occurance to be checked in listener
*/
- choiceStatement : CHOICE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
+ choiceStatement : CHOICE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | defaultStatement
| configStatement | mandatoryStatement | statusStatement | descriptionStatement | referenceStatement | shortCaseStatement
| caseStatement)* RIGHT_CURLY_BRACE);
@@ -924,7 +924,7 @@
* "}")
* TODO : 0..1 occurance to be checked in listener
*/
- caseStatement : CASE_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
+ caseStatement : CASE_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | statusStatement
| descriptionStatement | referenceStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
/**
@@ -1095,7 +1095,7 @@
* "}")
* TODO : 0..1 occurance to be checked in listener
*/
- rpcStatement : RPC_KEYWORD IDENTIFIER (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
+ rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
| referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
/**
@@ -1223,3 +1223,9 @@
string : STRING (PLUS STRING)*
| IDENTIFIER
| INTEGER;
+
+ identifier : STRING (PLUS STRING)*
+ | IDENTIFIER;
+
+ dateArgumentString : DATE_ARG
+ | STRING (PLUS STRING)*;
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
index 961e902..eeb85bb 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
@@ -226,7 +226,7 @@
@Test
public void processContainerInvalidIdentifier() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '1valid' expecting IDENTIFIER");
+ thrown.expectMessage("YANG file error : container name 1valid is not valid.");
YangNode node = manager.getDataModel("src/test/resources/ContainerInvalidIdentifier.yang");
}
}
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
index afa48da..43abb45 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
@@ -85,7 +85,7 @@
@Test
public void processLeafListInvalidIdentifier() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '1invalid-interval' expecting IDENTIFIER");
+ thrown.expectMessage("YANG file error : leaf-list name 1invalid-interval is not valid.");
YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidIdentifier.yang");
}
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
index 40afc03..554d651 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
@@ -85,7 +85,7 @@
@Test
public void processLeafInvalidIdentifier() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '1invalid-interval' expecting IDENTIFIER");
+ thrown.expectMessage("YANG file error : leaf name 1invalid-interval is not valid.");
YangNode node = manager.getDataModel("src/test/resources/LeafInvalidIdentifier.yang");
}
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
index aa770a6..99d40dd 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
@@ -205,7 +205,7 @@
@Test
public void processListInvalidIdentifier() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("mismatched input '1valid' expecting IDENTIFIER");
+ thrown.expectMessage("YANG file error : list name 1valid is not valid.");
YangNode node = manager.getDataModel("src/test/resources/ListInvalidIdentifier.yang");
}
}
\ No newline at end of file
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java
index ab7242a..66d8e9a 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ModuleListenerTest.java
@@ -16,7 +16,9 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
@@ -35,6 +37,9 @@
private final YangUtilsParserManager manager = new YangUtilsParserManager();
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
/**
* Checks if module listener updates the data model root node.
*/
@@ -62,4 +67,15 @@
YangNode node = manager.getDataModel("src/test/resources/ModuleWithInvalidIdentifier.yang");
}
+
+ /**
+ * Checks whether exception is thrown when module length is greater than 64 characters.
+ */
+ @Test
+ public void processModuleInvalidIdentifierLength() throws IOException, ParserException {
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : module name Testttttttttttttttttttttttttttttttttttttttttttttttttttt" +
+ "tttttttttt is greater than 64 characters.");
+ YangNode node = manager.getDataModel("src/test/resources/ModuleInvalidIdentifierLength.yang");
+ }
}
\ No newline at end of file
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java
index 7033ddd..e0e2ab0 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PositionListenerTest.java
@@ -80,6 +80,45 @@
}
/**
+ * Checks position value with double quotes.
+ */
+ @Test
+ public void processPositionWithDoubleQuotes() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/PositionWithDoubleQuotes.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("mybits"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("bits"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.BITS));
+ assertThat(((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitsName(),
+ is("mybits"));
+
+ Set<YangBit> bitSet = ((YangBits) leafInfo.getDataType().getDataTypeExtendedInfo()).getBitSet();
+ for (YangBit tmp : bitSet) {
+ if (tmp.getBitName().equals("disable-nagle")) {
+ assertThat(tmp.getPosition(), is(0));
+ } else if (tmp.getBitName().equals("auto-sense-speed")) {
+ assertThat(tmp.getPosition(), is(1));
+ } else if (tmp.getBitName().equals("Ten-Mb-only")) {
+ assertThat(tmp.getPosition(), is(2));
+ }
+ }
+ }
+
+ /**
* Checks explicit value and auto generated value.
*/
@Test
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java
index b090bd0..3d7ff5c 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/PrefixListenerTest.java
@@ -56,6 +56,16 @@
}
/**
+ * Checks prefix value with double quotes.
+ */
+ @Test
+ public void processPrefixWithDoubleQuotes() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/PrefixWithDoubleQuotes.yang");
+ assertThat(((YangModule) node).getPrefix(), is("On"));
+ }
+
+ /**
* Checks that prefix should be present just once.
*/
@Test(expected = ParserException.class)
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java
index 7ebcc85..7f19219 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionDateListenerTest.java
@@ -53,21 +53,29 @@
}
/**
- * Checks revision date should not be in quotes inside include.
+ * Checks revision date in quotes inside include.
*/
- @Test(expected = ParserException.class)
+ @Test
public void processRevisionDateInQuotesAtInclude() throws IOException, ParserException {
YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtInclude.yang");
+ // Checks for the version value in data model tree.
+ assertThat(((YangModule) node).getImportList().get(0).getRevision(), is("2015-02-03"));
+ assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is("2016-02-03"));
+ assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is("2014-02-03"));
}
/**
- * Checks revision date should not be in quotes inside import.
+ * Checks revision date in quotes inside import.
*/
- @Test(expected = ParserException.class)
+ @Test
public void processRevisionDateInQuotesAtImport() throws IOException, ParserException {
YangNode node = manager.getDataModel("src/test/resources/RevisionDateInQuotesAtImport.yang");
+ // Checks for the version value in data model tree.
+ assertThat(((YangModule) node).getImportList().get(0).getRevision(), is("2015-02-03"));
+ assertThat(((YangModule) node).getIncludeList().get(0).getRevision(), is("2016-02-03"));
+ assertThat(((YangModule) node).getIncludeList().get(1).getRevision(), is("2014-02-03"));
}
/**
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java
index 07df80c..324fe1e 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/VersionListenerTest.java
@@ -56,6 +56,18 @@
}
/**
+ * Checks version in double quotes.
+ */
+ @Test
+ public void processValidVersionWithDoubleQuotes() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/ValidVersionWithDoubleQuotes.yang");
+
+ // Checks for the version value in data model tree.
+ assertThat(((YangModule) node).getVersion(), is((byte) 1));
+ }
+
+ /**
* Checks if version which is optional paramater is not present.
*/
@Test
diff --git a/src/test/resources/ModuleInvalidIdentifierLength.yang b/src/test/resources/ModuleInvalidIdentifierLength.yang
new file mode 100644
index 0000000..fac16bc
--- /dev/null
+++ b/src/test/resources/ModuleInvalidIdentifierLength.yang
@@ -0,0 +1,5 @@
+module Testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}
diff --git a/src/test/resources/PositionWithDoubleQuotes.yang b/src/test/resources/PositionWithDoubleQuotes.yang
new file mode 100644
index 0000000..0c9d358
--- /dev/null
+++ b/src/test/resources/PositionWithDoubleQuotes.yang
@@ -0,0 +1,18 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf mybits {
+ type bits {
+ bit disable-nagle {
+ position "0";
+ }
+ bit auto-sense-speed {
+ position "1";
+ }
+ bit Ten-Mb-only {
+ position "2";
+ }
+ }
+ }
+}
diff --git a/src/test/resources/PrefixWithDoubleQuotes.yang b/src/test/resources/PrefixWithDoubleQuotes.yang
new file mode 100644
index 0000000..e9590f1
--- /dev/null
+++ b/src/test/resources/PrefixWithDoubleQuotes.yang
@@ -0,0 +1,17 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix "On";
+import ietf {
+prefix On2;
+revision-date 2015-02-03;
+}
+include itut {
+revision-date 2016-02-03;
+}
+include sdn {
+revision-date 2014-02-03;
+}
+contact "Test";
+organization "ONOS";
+}
diff --git a/src/test/resources/ValidVersionWithDoubleQuotes.yang b/src/test/resources/ValidVersionWithDoubleQuotes.yang
new file mode 100644
index 0000000..a2c718a
--- /dev/null
+++ b/src/test/resources/ValidVersionWithDoubleQuotes.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version "1";
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix On;
+}