use of org.finos.legend.pure.m3.inlinedsl.path.serialization.grammar.NavigationParser.ParameterContext in project legend-pure by finos.
the class NavigationGraphBuilder method visitPropertyWithParametersBlock.
private void visitPropertyWithParametersBlock(PropertyWithParametersContext ctx, MutableList<PathElement> props, Token firstChar) {
MutableList<ValueSpecification> parameters = FastList.newList();
Token property = ctx.VALID_STRING().getSymbol();
ClassInstance ppeType = (ClassInstance) this.processorSupport.package_getByUserPath(M3Paths.PropertyPathElement);
PropertyPathElement propertyPathElement = (PropertyPathElement) this.repository.newAnonymousCoreInstance(this.sourceInformation.getPureSourceInformation(property), ppeType, true);
GenericType classifierGT = GenericTypeInstance.createPersistent(this.repository);
classifierGT._rawTypeCoreInstance(ppeType);
propertyPathElement._classifierGenericType(classifierGT);
PropertyStub propStub = PropertyStubInstance.createPersistent(this.repository, this.sourceInformation.getPureSourceInformation(property), null, property.getText());
propertyPathElement._propertyCoreInstance(propStub);
if (ctx.parameter() != null) {
for (ParameterContext parameterContext : ctx.parameter()) {
parameters.add(visitParameterBlock(parameterContext));
}
}
if (!parameters.isEmpty()) {
propertyPathElement._parameters(parameters);
}
props.add(propertyPathElement);
}
use of org.finos.legend.pure.m3.inlinedsl.path.serialization.grammar.NavigationParser.ParameterContext in project legend-pure by finos.
the class GraphAntlrTreeWalker method visitGraphPathContext.
private String visitGraphPathContext(GraphPathContext graphPathContext) {
SourceInformation definitionSourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.start, graphPathContext.start, graphPathContext.stop);
SourceInformation propertySourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.identifier().start, graphPathContext.identifier().start, graphPathContext.identifier().stop);
MutableList<String> subTrees = FastList.newList();
if (graphPathContext.graphDefinition() != null) {
for (GraphPathContext subGraphPathContext : graphPathContext.graphDefinition().graphPaths().graphPath()) {
subTrees.add(this.visitGraphPathContext(subGraphPathContext));
}
}
MutableList<String> parameters = FastList.newList();
if (graphPathContext.propertyParameters() != null) {
for (ParameterContext parameterContext : graphPathContext.propertyParameters().parameter()) {
parameters.add(this.visitParameterContext(parameterContext));
}
}
String subType = "";
if (graphPathContext.subtype() != null) {
SourceInformation subTypeSourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.subtype().qualifiedName().start, graphPathContext.subtype().qualifiedName().start, graphPathContext.subtype().qualifiedName().stop);
subType = "^meta::pure::metamodel::import::ImportStub " + subTypeSourceInfo.toM4String() + " (importGroup = system::imports::" + this.importId._name() + ", idOrPath = '" + graphPathContext.subtype().qualifiedName().getText() + "')";
}
String alias = "";
if (graphPathContext.alias() != null) {
alias = graphPathContext.alias().STRING().getText();
}
return "^meta::pure::graphFetch::PropertyGraphFetchTree " + definitionSourceInfo.toM4String() + " (" + "property = " + "^meta::pure::metamodel::import::PropertyStub " + propertySourceInfo.toM4String() + " (propertyName = '" + graphPathContext.identifier().getText() + "'), " + "parameters = " + parameters.makeString("[", ", ", "]") + ", " + "subTrees = " + subTrees.makeString("[", ", ", "]") + ", " + "subType = [" + subType + "]" + ", " + "alias = [" + alias + "]" + ")";
}
use of org.finos.legend.pure.m3.inlinedsl.path.serialization.grammar.NavigationParser.ParameterContext in project legend-pure by finos.
the class NavigationGraphBuilder method visitParameterBlock.
private ValueSpecification visitParameterBlock(ParameterContext ctx) {
ListIterable<CoreInstance> rawValue;
if (ctx.scalar() != null) {
MutableList<CoreInstance> elements = FastList.newList();
CoreInstance result = visitScalar(ctx.scalar());
elements.add(result);
rawValue = elements;
} else {
rawValue = visitCollectionBlock(ctx.collection());
}
InstanceValueInstance instanceVal = InstanceValueInstance.createPersistent(this.repository, null, null);
instanceVal._values(rawValue);
return instanceVal;
}
Aggregations