Vidyashree Rama
Committed by Gerrit Code Review

Module & Sub module grammar issue fix

Change-Id: Ia90b90510233195c5eab7402ebe790014ce137d1
...@@ -79,7 +79,7 @@ public final class ModuleListener { ...@@ -79,7 +79,7 @@ public final class ModuleListener {
79 YangModule yangModule = new YangModule(); 79 YangModule yangModule = new YangModule();
80 yangModule.setName(identifier); 80 yangModule.setName(identifier);
81 81
82 - if (ctx.moduleBody(0).moduleHeaderStatement().yangVersionStatement() == null) { 82 + if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
83 yangModule.setVersion((byte) 1); 83 yangModule.setVersion((byte) 1);
84 } 84 }
85 85
......
...@@ -82,7 +82,7 @@ public final class SubModuleListener { ...@@ -82,7 +82,7 @@ public final class SubModuleListener {
82 YangSubModule yangSubModule = new YangSubModule(); 82 YangSubModule yangSubModule = new YangSubModule();
83 yangSubModule.setName(identifier); 83 yangSubModule.setName(identifier);
84 84
85 - if (ctx.submoduleBody(0).submoduleHeaderStatement().yangVersionStatement() == null) { 85 + if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
86 yangSubModule.setVersion((byte) 1); 86 yangSubModule.setVersion((byte) 1);
87 } 87 }
88 88
......
...@@ -40,7 +40,7 @@ package org.onosproject.yangutils.parser.antlrgencode; ...@@ -40,7 +40,7 @@ package org.onosproject.yangutils.parser.antlrgencode;
40 * "}" optsep 40 * "}" optsep
41 */ 41 */
42 42
43 - moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody* RIGHT_CURLY_BRACE; 43 + moduleStatement : MODULE_KEYWORD identifier LEFT_CURLY_BRACE moduleBody RIGHT_CURLY_BRACE;
44 44
45 moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements; 45 moduleBody : moduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
46 46
...@@ -210,7 +210,7 @@ package org.onosproject.yangutils.parser.antlrgencode; ...@@ -210,7 +210,7 @@ package org.onosproject.yangutils.parser.antlrgencode;
210 * body-stmts 210 * body-stmts
211 * "}" optsep 211 * "}" optsep
212 */ 212 */
213 - subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody* RIGHT_CURLY_BRACE; 213 + subModuleStatement : SUBMODULE_KEYWORD identifier LEFT_CURLY_BRACE submoduleBody RIGHT_CURLY_BRACE;
214 submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements; 214 submoduleBody : submoduleHeaderStatement linkageStatements metaStatements revisionStatements bodyStatements;
215 215
216 /** submodule-header-stmts = 216 /** submodule-header-stmts =
......
...@@ -137,8 +137,8 @@ public class ConfigListenerTest { ...@@ -137,8 +137,8 @@ public class ConfigListenerTest {
137 thrown.expect(ParserException.class); 137 thrown.expect(ParserException.class);
138 thrown.expectMessage("mismatched input 'config' expecting {'augment', 'choice', 'contact', 'container'," 138 thrown.expectMessage("mismatched input 'config' expecting {'augment', 'choice', 'contact', 'container',"
139 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include', " 139 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include', "
140 - + "'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference'," 140 + + "'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
141 - + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 141 + + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
142 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementConfig.yang"); 142 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementConfig.yang");
143 } 143 }
144 144
......
...@@ -97,8 +97,8 @@ public class LeafListListenerTest { ...@@ -97,8 +97,8 @@ public class LeafListListenerTest {
97 thrown.expect(ParserException.class); 97 thrown.expect(ParserException.class);
98 thrown.expectMessage("mismatched input 'leaflist' expecting {'augment', 'choice', 'contact', 'container'," 98 thrown.expectMessage("mismatched input 'leaflist' expecting {'augment', 'choice', 'contact', 'container',"
99 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include'," 99 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
100 - + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference'," 100 + + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
101 - + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 101 + + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
102 YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.yang"); 102 YangNode node = manager.getDataModel("src/test/resources/LeafListInvalidStatement.yang");
103 } 103 }
104 104
......
...@@ -97,8 +97,8 @@ public class LeafListenerTest { ...@@ -97,8 +97,8 @@ public class LeafListenerTest {
97 thrown.expect(ParserException.class); 97 thrown.expect(ParserException.class);
98 thrown.expectMessage("mismatched input 'leafs' expecting {'augment', 'choice', 'contact', 'container'," 98 thrown.expectMessage("mismatched input 'leafs' expecting {'augment', 'choice', 'contact', 'container',"
99 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include'," 99 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
100 - + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference'," 100 + + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
101 - + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 101 + + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
102 YangNode node = manager.getDataModel("src/test/resources/LeafInvalidStatement.yang"); 102 YangNode node = manager.getDataModel("src/test/resources/LeafInvalidStatement.yang");
103 } 103 }
104 104
......
...@@ -150,8 +150,8 @@ public class MandatoryListenerTest { ...@@ -150,8 +150,8 @@ public class MandatoryListenerTest {
150 thrown.expect(ParserException.class); 150 thrown.expect(ParserException.class);
151 thrown.expectMessage("mismatched input 'mandatory' expecting {'augment', 'choice', 'contact', 'container'," 151 thrown.expectMessage("mismatched input 'mandatory' expecting {'augment', 'choice', 'contact', 'container',"
152 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include'," 152 + " 'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
153 - + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference'," 153 + + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference',"
154 - + " 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 154 + + " 'revision', 'rpc', 'typedef', 'uses', '}'}");
155 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementMandatory.yang"); 155 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementMandatory.yang");
156 } 156 }
157 } 157 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -153,8 +153,8 @@ public class StatusListenerTest { ...@@ -153,8 +153,8 @@ public class StatusListenerTest {
153 thrown.expect(ParserException.class); 153 thrown.expect(ParserException.class);
154 thrown.expectMessage("mismatched input 'status' expecting {'augment', 'choice', 'contact', 'container', " 154 thrown.expectMessage("mismatched input 'status' expecting {'augment', 'choice', 'contact', 'container', "
155 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include'," 155 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', 'include',"
156 - + " 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', 'prefix', 'reference', " 156 + + " 'leaf', 'leaf-list', 'list', 'notification', 'organization', 'reference', "
157 - + "'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 157 + + "'revision', 'rpc', 'typedef', 'uses', '}'}");
158 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementStatus.yang"); 158 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementStatus.yang");
159 } 159 }
160 160
......
...@@ -79,8 +79,8 @@ public class UnitsListenerTest { ...@@ -79,8 +79,8 @@ public class UnitsListenerTest {
79 thrown.expect(ParserException.class); 79 thrown.expect(ParserException.class);
80 thrown.expectMessage("mismatched input 'type' expecting {'augment', 'choice', 'contact', 'container', " 80 thrown.expectMessage("mismatched input 'type' expecting {'augment', 'choice', 'contact', 'container', "
81 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', " 81 + "'description', 'extension', 'deviation', 'feature', 'grouping', 'identity', 'import', "
82 - + "'include', 'leaf', 'leaf-list', 'list', 'namespace', 'notification', 'organization', " 82 + + "'include', 'leaf', 'leaf-list', 'list', 'notification', 'organization', "
83 - + "'prefix', 'reference', 'revision', 'rpc', 'typedef', 'uses', 'yang-version', '}'}"); 83 + + "'reference', 'revision', 'rpc', 'typedef', 'uses', '}'}");
84 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementUnits.yang"); 84 YangNode node = manager.getDataModel("src/test/resources/ModuleSubStatementUnits.yang");
85 } 85 }
86 86
......