use of org.finos.legend.pure.m3.statelistener.M3M4StateListener in project legend-pure by finos.
the class Loader method parseM3.
public static void parseM3(String code, ModelRepository repository, ParserLibrary library, ValidationType validationType, M3M4StateListener stateListener, Context context) {
try {
ListMultimap<Parser, CoreInstance> newInstancesByParser = new TopParser().parse(code, "fromString.pure", repository, library, stateListener, context, null);
ListIterable<CoreInstance> newInstances = newInstancesByParser.valuesView().toList();
updateStateFullContextCache(newInstances, context);
ProcessorSupport processorSupport = new M3ProcessorSupport(context, repository);
PostProcessor.process(newInstances, repository, library, new InlineDSLLibrary(), null, context, processorSupport, null, null);
processExcludes(repository, processorSupport, stateListener);
if (validationType == ValidationType.DEEP) {
repository.validate(stateListener);
}
// Validate M3
stateListener.startValidation();
Validator.validateM3(newInstances, validationType, library, new InlineDSLLibrary(), new PureCodeStorage(null), repository, context, processorSupport);
stateListener.finishedValidation();
} catch (PureException exception) {
String space = " ";
throw new RuntimeException(exception + " in\n" + space + code.replace("\n", "\n" + space), exception);
}
}
use of org.finos.legend.pure.m3.statelistener.M3M4StateListener in project legend-pure by finos.
the class DiagramParser method parse.
@Override
public void parse(String code, String sourceName, boolean addLines, int offset, ModelRepository repository, MutableList<CoreInstance> coreInstancesResult, M3M4StateListener listener, Context context, int count, SourceState oldState) throws PureParserException {
String result = this.parseDefinition(true, code, sourceName, addLines, offset, repository, listener, context, count);
new M3AntlrParser(false).parse(result, sourceName, false, offset, repository, coreInstancesResult, listener, context, count, null);
}
use of org.finos.legend.pure.m3.statelistener.M3M4StateListener in project legend-pure by finos.
the class TopParser method parseDefinition.
private MutableListMultimap<Parser, CoreInstance> parseDefinition(boolean useFastParser, String code, String sourceName, ModelRepository repository, ParserLibrary parserLibrary, M3M4StateListener listener, Context context, SourceState oldState) {
TopAntlrParser parser = this.initAntlrParser(useFastParser, "\u005cn###Pure\u005cn" + code, sourceName);
TopGraphBuilder visitor = new TopGraphBuilder(sourceName, repository, listener, context, parserLibrary, oldState);
TopAntlrParser.DefinitionContext c = parser.definition();
return visitor.visitDefinition(c);
}
use of org.finos.legend.pure.m3.statelistener.M3M4StateListener in project legend-pure by finos.
the class MappingParser method parse.
@Override
public void parse(String string, String sourceName, boolean addLines, int offset, ModelRepository repository, MutableList<CoreInstance> coreInstancesResult, M3M4StateListener listener, Context context, int count, SourceState oldState) throws PureParserException {
String result = parseDefinition(true, string, sourceName, addLines, offset, repository, listener, context, count);
new M3AntlrParser(false).parse(result, sourceName, false, offset, repository, coreInstancesResult, listener, context, count, null);
}
use of org.finos.legend.pure.m3.statelistener.M3M4StateListener in project legend-pure by finos.
the class RelationalParser method parse.
public void parse(String code, String sourceName, boolean addLines, int offset, ModelRepository repository, MutableList<CoreInstance> coreInstancesResult, M3M4StateListener listener, Context context, int count, SourceState oldState) throws PureParserException {
String importId = AntlrContextToM3CoreInstance.createImportGroupId(sourceName, count);
String result = parseDefinition(true, code, sourceName, addLines, offset, repository, listener, context, count, importId);
new M3AntlrParser(false).parse(result, sourceName, false, offset, repository, coreInstancesResult, listener, context, count, null);
}
Aggregations