Search in sources :

Example 1 with TreePathContext

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

the class AntlrContextToM3CoreInstance method treePath.

public CoreInstance treePath(TreePathContext ctx, ImportGroup importId) {
    GenericType treePathGT = this.type(ctx.type(), Lists.mutable.empty(), "", importId, true);
    if (Iterate.notEmpty(treePathGT._typeArguments())) {
        throw new PureParserException(treePathGT.getSourceInformation(), "TreePath doesn't support GenericTypes");
    }
    boolean includeAll = ctx.treePathClassBody() != null && ctx.treePathClassBody().simplePropertyFilter() != null && ctx.treePathClassBody().simplePropertyFilter().STAR() != null;
    String rootRouteNodeName = ctx.alias() != null ? ctx.alias().identifier().getText() : ctx.type().qualifiedName().identifier().getText();
    RootRouteNode rootRouteNode = RootRouteNodeInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(ctx.getStart(), ctx.getStart(), ctx.getStop()), String.valueOf(includeAll), rootRouteNodeName, treePathGT);
    if (ctx.stereotypes() != null) {
        rootRouteNode._stereotypesCoreInstance(this.stereotypes(ctx.stereotypes(), importId));
    }
    if (ctx.taggedValues() != null) {
        rootRouteNode._taggedValues(this.taggedValues(ctx.taggedValues(), importId));
    }
    if (ctx.treePathClassBody() != null) {
        this.treepathBody(ctx.treePathClassBody(), rootRouteNode, importId, new LambdaContext(importId.getName() + rootRouteNodeName), "");
    }
    return rootRouteNode;
}
Also used : GenericType(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType) RootRouteNode(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.treepath.RootRouteNode) PureParserException(org.finos.legend.pure.m4.serialization.grammar.antlr.PureParserException)

Aggregations

RootRouteNode (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.treepath.RootRouteNode)1 GenericType (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.generics.GenericType)1 PureParserException (org.finos.legend.pure.m4.serialization.grammar.antlr.PureParserException)1