MCPcopy Create free account
hub / github.com/Icinga/icinga2 / CompileStream

Method CompileStream

lib/config/configcompiler.cpp:236–252  ·  view source on GitHub ↗

* Compiles a stream. * * @param path A name identifying the stream. * @param stream The input stream. * @returns Configuration items. */

Source from the content-addressed store, hash-verified

234 * @returns Configuration items.
235 */
236std::unique_ptr<Expression> ConfigCompiler::CompileStream(const String& path,
237 std::istream *stream, const String& zone, const String& package)
238{
239 CONTEXT("Compiling configuration stream with name '" << path << "'");
240
241 stream->exceptions(std::istream::badbit);
242
243 ConfigCompiler ctx(path, stream, zone, package);
244
245 try {
246 return ctx.Compile();
247 } catch (const ScriptError& ex) {
248 return std::unique_ptr<Expression>(new ThrowExpression(MakeLiteral(ex.what()), ex.IsIncompleteExpression(), ex.GetDebugInfo()));
249 } catch (const std::exception& ex) {
250 return std::unique_ptr<Expression>(new ThrowExpression(MakeLiteral(DiagnosticInformation(ex)), false));
251 }
252}
253
254/**
255 * Compiles a file.

Callers

nothing calls this directly

Calls 5

MakeLiteralFunction · 0.85
CompileMethod · 0.80
whatMethod · 0.45
GetDebugInfoMethod · 0.45

Tested by

no test coverage detected