Search in sources :

Example 1 with MappingLineContext

use of org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.MappingLineContext in project legend-pure by finos.

the class AntlrContextToM3CoreInstance method mappingLine.

public TemporaryPurePropertyMapping mappingLine(MappingLineContext ctx, LambdaContext lambdaContext, String cl, ImportGroup importId) {
    String sourceMappingId = null;
    String targetMappingId = null;
    Pair<String, SourceInformation> enumerationMappingInformation = null;
    if (ctx.sourceAndTargetMappingId() != null) {
        SourceAndTargetMappingIdContext sctx = ctx.sourceAndTargetMappingId();
        if (sctx.targetId() != null) {
            sourceMappingId = sctx.sourceId().qualifiedName().getText();
            targetMappingId = sctx.targetId().qualifiedName().getText();
        } else {
            targetMappingId = sctx.sourceId().qualifiedName().getText();
        }
    }
    if (ctx.ENUMERATION_MAPPING() != null) {
        IdentifierContext identifier = ctx.identifier();
        String enumerationMappingName = identifier.getText();
        SourceInformation enumerationMappingReferenceSourceInformation = this.sourceInformation.getPureSourceInformation(identifier.getStart(), identifier.getStart(), identifier.getStop());
        enumerationMappingInformation = Tuples.pair(enumerationMappingName, enumerationMappingReferenceSourceInformation);
    }
    return TemporaryPurePropertyMapping.build(this.sourceInformation.getPureSourceInformation(ctx.qualifiedName().getStart()), ctx.PLUS() != null, ctx.type() == null ? null : this.type(ctx.type(), Lists.mutable.empty(), "", importId, true), ctx.multiplicity() == null ? null : this.buildMultiplicity(ctx.multiplicity().multiplicityArgument()), ctx.qualifiedName().getText(), this.combinedExpression(ctx.combinedExpression(), "", Lists.mutable.empty(), lambdaContext, "", true, importId, true), sourceMappingId, targetMappingId, ctx.STAR() != null, enumerationMappingInformation);
}
Also used : SourceAndTargetMappingIdContext(org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.SourceAndTargetMappingIdContext) AntlrSourceInformation(org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation) SourceInformation(org.finos.legend.pure.m4.coreinstance.SourceInformation) IdentifierContext(org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.IdentifierContext)

Aggregations

IdentifierContext (org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.IdentifierContext)1 SourceAndTargetMappingIdContext (org.finos.legend.pure.m3.serialization.grammar.m3parser.antlr.M3Parser.SourceAndTargetMappingIdContext)1 SourceInformation (org.finos.legend.pure.m4.coreinstance.SourceInformation)1 AntlrSourceInformation (org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation)1