[ONOS-4350] Inter file linking implementation and inter-jar linking framework
Change-Id: I71a26ba3e0b9d17261e78a9313fe7f047195932e
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
index 721b9fe..8cac71d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/IncludeListener.java
@@ -72,19 +72,25 @@
* (include), perform validations and update the data model tree.
*
* @param listener Listener's object
- * @param ctx context object of the grammar rule
+ * @param ctx context object of the grammar rule
*/
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(),
- ENTRY);
+ ENTRY);
String identifier = getValidIdentifier(ctx.identifier().getText(), INCLUDE_DATA, ctx);
YangInclude includeNode = new YangInclude();
includeNode.setSubModuleName(identifier);
+ // Set the line number and character position in line for the belongs to.
+ int errorLine = ctx.getStart().getLine();
+ int errorPosition = ctx.getStart().getCharPositionInLine();
+ includeNode.setLineNumber(errorLine);
+ includeNode.setCharPosition(errorPosition);
+
listener.getParsedDataStack().push(includeNode);
}
@@ -93,7 +99,7 @@
* validations and update the data model tree.
*
* @param listener Listener's object
- * @param ctx context object of the grammar rule
+ * @param ctx context object of the grammar rule
*/
public static void processIncludeExit(TreeWalkListener listener, GeneratedYangParser.IncludeStatementContext ctx) {
@@ -106,7 +112,7 @@
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, INCLUDE_DATA, ctx.identifier().getText(),
- EXIT);
+ EXIT);
Parsable tmpNode = listener.getParsedDataStack().peek();
switch (tmpNode.getYangConstructType()) {
@@ -127,7 +133,7 @@
}
} else {
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, INCLUDE_DATA,
- ctx.identifier().getText(), EXIT));
+ ctx.identifier().getText(), EXIT));
}
}
}