Search in sources :

Example 1 with Validator

use of org.finos.legend.pure.m3.compiler.validation.Validator 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);
    }
}
Also used : Matcher(org.finos.legend.pure.m3.tools.matcher.Matcher) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) MatchRunner(org.finos.legend.pure.m3.tools.matcher.MatchRunner) InlineDSL(org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL) Parser(org.finos.legend.pure.m3.serialization.grammar.Parser)

Aggregations

Parser (org.finos.legend.pure.m3.serialization.grammar.Parser)1 InlineDSL (org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL)1 MatchRunner (org.finos.legend.pure.m3.tools.matcher.MatchRunner)1 Matcher (org.finos.legend.pure.m3.tools.matcher.Matcher)1 CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)1