use of org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL in project legend-pure by finos.
the class GraphLoader method getProcessorsByType.
private MapIterable<CoreInstance, ? extends ListIterable<Processor>> getProcessorsByType() {
MutableMap<CoreInstance, MutableList<Processor>> processorsByType = Maps.mutable.empty();
RichIterable<Processor> processors = LazyIterate.concatenate(this.parserLibrary.getParsers().asLazy().flatCollect(Parser::getProcessors), this.inlineDSLLibrary.getInlineDSLs().asLazy().flatCollect(InlineDSL::getProcessors)).selectInstancesOf(Processor.class);
for (Processor processor : processors) {
CoreInstance type = getByUserPath(processor.getClassName());
// Type may not be loaded yet, and that is ok.
if (type != null) {
processorsByType.getIfAbsentPut(type, Lists.mutable::empty).add(processor);
}
}
return processorsByType;
}
use of org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL in project legend-pure by finos.
the class IncrementalCompiler_Old method walkTheGraphForUnload.
private SetIterable<CoreInstance> walkTheGraphForUnload() {
WalkerState walkerState = new WalkerState(this.processorSupport);
Matcher walkerMatcher = new Matcher(this.modelRepository, this.context, this.processorSupport);
this.library.getParsers().asLazy().flatCollect(Parser::getUnLoadWalkers).concatenate(this.dslLibrary.getInlineDSLs().asLazy().flatCollect(InlineDSL::getUnLoadWalkers)).forEach(walkerMatcher::addMatchIfTypeIsKnown);
this.toUnload.forEach(i -> walkerMatcher.match(i, walkerState));
return walkerState.getInstances();
}
use of org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL in project legend-pure by finos.
the class Validator method validateM3.
public static void validateM3(Iterable<? extends CoreInstance> newInstancesConsolidated, ValidationType validationType, ParserLibrary parserLibrary, InlineDSLLibrary inlineDSLLibrary, Iterable<? extends MatchRunner> additionalValidators, CodeStorage codeStorage, ModelRepository modelRepository, Context context, ProcessorSupport processorSupport) throws PureCompilationException {
// Post Process
Matcher matcher = new Matcher(modelRepository, context, processorSupport);
for (Parser parser : parserLibrary.getParsers()) {
for (MatchRunner parserValidator : parser.getValidators()) {
matcher.addMatchIfTypeIsKnown(parserValidator);
}
}
for (InlineDSL dsl : inlineDSLLibrary.getInlineDSLs()) {
for (MatchRunner dslValidator : dsl.getValidators()) {
matcher.addMatchIfTypeIsKnown(dslValidator);
}
}
for (MatchRunner validator : additionalValidators) {
matcher.addMatchIfTypeIsKnown(validator);
}
ValidatorState validatorState = new ValidatorState(validationType, codeStorage, processorSupport);
for (CoreInstance instance : newInstancesConsolidated) {
validate(instance, validatorState, matcher, processorSupport);
}
}
use of org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL in project legend-pure by finos.
the class IncrementalCompiler_New method walkTheGraphForUnload.
private MutableSet<CoreInstance> walkTheGraphForUnload(MutableSet<CoreInstance> instances) {
WalkerState walkerState = new WalkerState(this.processorSupport);
Matcher walkerMatcher = new Matcher(this.modelRepository, this.context, this.processorSupport);
this.library.getParsers().asLazy().flatCollect(Parser::getUnLoadWalkers).concatenate(this.dslLibrary.getInlineDSLs().asLazy().flatCollect(InlineDSL::getUnLoadWalkers)).forEach(walkerMatcher::addMatchIfTypeIsKnown);
instances.forEach(i -> walkerMatcher.match(i, walkerState));
return walkerState.getInstances().toSet();
}
use of org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL in project legend-pure by finos.
the class ParserService method inlineDSLs.
public ListIterable<InlineDSL> inlineDSLs() {
MutableList<InlineDSL> inlineDSLS = Lists.mutable.of();
Iterator<InlineDSL> it = this.dslsLoader.iterator();
while (it.hasNext()) {
try {
InlineDSL dsl = it.next();
inlineDSLS.add(dsl);
} catch (Throwable e) {
// Needs to be silent ... during the build process
}
}
return inlineDSLS;
}
Aggregations