use of org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.Import_statementContext in project legend-pure by finos.
the class AntlrContextToM3CoreInstance method imports.
private ImportGroup imports(ImportsContext ctx) {
MutableList<Import> imports = Lists.mutable.empty();
int importGroupStartLine = -1;
int importGroupStartColumn = -1;
int importGroupEndLine = -1;
int importGroupEndColumn = -1;
for (Import_statementContext isCtx : ctx.import_statement()) {
Import _import = ImportInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(isCtx.getStart(), isCtx.packagePath().getStart(), isCtx.STAR().getSymbol()), this.packageToString(isCtx.packagePath()));
imports.add(_import);
SourceInformation sourceInfo = _import.getSourceInformation();
if (importGroupStartLine == -1) {
importGroupStartLine = sourceInfo.getStartLine();
importGroupStartColumn = sourceInfo.getStartColumn();
importGroupEndLine = sourceInfo.getEndLine();
importGroupEndColumn = sourceInfo.getEndColumn();
}
if (importGroupStartLine > sourceInfo.getStartLine()) {
importGroupStartLine = sourceInfo.getStartLine();
importGroupStartColumn = sourceInfo.getStartColumn();
}
if (importGroupEndLine < sourceInfo.getEndLine()) {
importGroupEndLine = sourceInfo.getEndLine();
importGroupEndColumn = sourceInfo.getEndColumn();
}
}
if (importGroupStartLine == -1) {
importGroupStartLine = 1 + this.sourceInformation.getOffsetLine();
importGroupStartColumn = 0;
importGroupEndLine = 1 + this.sourceInformation.getOffsetLine();
importGroupEndColumn = 0;
}
return buildImportGroupFromImport(this.sourceInformation.getSourceName(), this.count, imports, new SourceInformation(this.sourceInformation.getSourceName(), importGroupStartLine, importGroupStartColumn, importGroupEndLine, importGroupEndColumn));
}
Aggregations