Identifier issue fix for module, list, container, leaf, leaf-list, prefix + date agr string for revision fix
Change-Id: Id9d596512f35b54f6359d361402bcd0180b71678
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
index 9b9a388..f8d5361 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/VersionListener.java
+++ b/utils/yangutils/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));
}
}