Module & Sub module grammar issue fix

Change-Id: Ia90b90510233195c5eab7402ebe790014ce137d1
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 bc8ee02..d65af88 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
@@ -79,7 +79,7 @@
         YangModule yangModule = new YangModule();
         yangModule.setName(identifier);
 
-        if (ctx.moduleBody(0).moduleHeaderStatement().yangVersionStatement() == null) {
+        if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
             yangModule.setVersion((byte) 1);
         }
 
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 080767a..14bad1e 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
@@ -82,7 +82,7 @@
         YangSubModule yangSubModule = new YangSubModule();
         yangSubModule.setName(identifier);
 
-        if (ctx.submoduleBody(0).submoduleHeaderStatement().yangVersionStatement() == null) {
+        if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
             yangSubModule.setVersion((byte) 1);
         }
 
diff --git a/src/main/resources/GeneratedYang.g4 b/src/main/resources/GeneratedYang.g4
index 9614b21..44b5c51 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;
 
@@ -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 =
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
index bd634bb..fe20cad 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
@@ -137,8 +137,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'config' expecting {'augment', 'choice', 'contact', 'container',"
                 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include', "
-                + "'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference',"
-                + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + "'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+                + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementConfig.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 43abb45..a9add7a 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
@@ -97,8 +97,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'leaflist' expecting {'augment', 'choice', 'contact', 'container',"
                 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference',"
-                + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+                + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.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 554d651..39fd4d7 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
@@ -97,8 +97,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'leafs' expecting {'augment', 'choice', 'contact', 'container',"
                 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference',"
-                + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+                + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/LeafInvalidStatement.yang");
     }
 
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
index c30dee5..05ee69a 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
@@ -150,8 +150,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'mandatory' expecting {'augment', 'choice', 'contact', 'container',"
                 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference',"
-                + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
+                + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementMandatory.yang");
     }
 }
\ No newline at end of file
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
index 1f6aa5f..6850425 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
@@ -153,8 +153,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'status' expecting {'augment', 'choice', 'contact', 'container', "
                 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
-                + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference', "
-                + "'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference', "
+                + "'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementStatus.yang");
     }
 
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
index 500f9a8..71a3042 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
@@ -79,8 +79,8 @@
         thrown.expect(ParserException.class);
         thrown.expectMessage("mismatched input 'type' expecting {'augment', 'choice', 'contact', 'container', "
                 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', "
-                + "'include', 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', "
-                + "'prefix', 'reference', 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}");
+                + "'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', "
+                + "'reference', 'revision', 'rpc', 'typedef', 'uses', '}'}");
         YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementUnits.yang");
     }