Vidyashree Rama
Committed by Gerrit Code Review

Module & Sub module grammar issue fix

Change-Id: Ia90b90510233195c5eab7402ebe790014ce137d1
......@@ -79,7 +79,7 @@ public final class ModuleListener {
YangModule yangModule = new YangModule();
yangModule.setName(identifier);
if (ctx.moduleBody(0).moduleHeaderStatement().yangVersionStatement() == null) {
if (ctx.moduleBody().moduleHeaderStatement().yangVersionStatement() == null) {
yangModule.setVersion((byte) 1);
}
......
......@@ -82,7 +82,7 @@ public final class SubModuleListener {
YangSubModule yangSubModule = new YangSubModule();
yangSubModule.setName(identifier);
if (ctx.submoduleBody(0).submoduleHeaderStatement().yangVersionStatement() == null) {
if (ctx.submoduleBody().submoduleHeaderStatement().yangVersionStatement() == null) {
yangSubModule.setVersion((byte) 1);
}
......
......@@ -40,7 +40,7 @@ package org.onosproject.yangutils.parser.antlrgencode;
* "}" 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 @@ package org.onosproject.yangutils.parser.antlrgencode;
* 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 =
......
......@@ -137,8 +137,8 @@ public class ConfigListenerTest {
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");
}
......
......@@ -97,8 +97,8 @@ public class LeafListListenerTest {
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");
}
......
......@@ -97,8 +97,8 @@ public class LeafListenerTest {
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");
}
......
......@@ -150,8 +150,8 @@ public class MandatoryListenerTest {
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
......
......@@ -153,8 +153,8 @@ public class StatusListenerTest {
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");
}
......
......@@ -79,8 +79,8 @@ public class UnitsListenerTest {
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");
}
......