Search in sources :

Example 1 with SignedExpressionContext

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

the class AntlrContextToM3CoreInstance method signedExpression.

private SimpleFunctionExpression signedExpression(SignedExpressionContext ctx, String exprName, MutableList<String> typeParametersNames, LambdaContext lambdaContext, String space, ImportGroup importId, boolean addLines) {
    CoreInstance number;
    SimpleFunctionExpression result;
    if (ctx.MINUS() != null) {
        number = this.expression(ctx.expression(), exprName, typeParametersNames, lambdaContext, space, true, importId, addLines);
        result = SimpleFunctionExpressionInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.MINUS().getSymbol()), null, null, importId, null);
        result._functionName("minus");
        result._parametersValues(Lists.mutable.of((ValueSpecification) number));
    } else {
        number = this.expression(ctx.expression(), exprName, typeParametersNames, lambdaContext, space, true, importId, addLines);
        result = SimpleFunctionExpressionInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.PLUS().getSymbol()), null, null, importId, null);
        result._functionName("plus");
        result._parametersValues(Lists.mutable.of((ValueSpecification) number));
    }
    return result;
}
Also used : SimpleFunctionExpression(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.SimpleFunctionExpression) PrimitiveCoreInstance(org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) ValueSpecification(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification)

Aggregations

SimpleFunctionExpression (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.SimpleFunctionExpression)1 ValueSpecification (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.valuespecification.ValueSpecification)1 CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)1 PrimitiveCoreInstance (org.finos.legend.pure.m4.coreinstance.primitive.PrimitiveCoreInstance)1