* Compiles a stream. * * @param path A name identifying the stream. * @param stream The input stream. * @returns Configuration items. */
| 234 | * @returns Configuration items. |
| 235 | */ |
| 236 | std::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. |
nothing calls this directly
no test coverage detected