make parseCommand take an extra error stream argument
Change-Id: Ia56015e7e088f2ce5a28cf0747ca93fdee731f81
diff --git a/src/CParser.cpp b/src/CParser.cpp
index 0762468..c6a42a6 100644
--- a/src/CParser.cpp
+++ b/src/CParser.cpp
@@ -5,7 +5,7 @@
* Written by Václav Kubernát <kubervac@fit.cvut.cz>
*
*/
-#include <iostream>
+#include <ostream>
#include "CParser.hpp"
TooManyArgumentsException::~TooManyArgumentsException() = default;
@@ -18,13 +18,14 @@
}
-cd_ CParser::parseCommand(const std::string& line)
+cd_ CParser::parseCommand(const std::string& line, std::ostream& errorStream)
{
cd_ parsedCommand;
ParserContext ctx(m_tree);
auto it = line.begin();
- boost::spirit::x3::error_handler<std::string::const_iterator> errorHandler(it, line.end(), std::cerr);
+ boost::spirit::x3::error_handler<std::string::const_iterator> errorHandler(it, line.end(), errorStream);
+
auto grammar =
x3::with<parser_context_tag>(ctx)[
x3::with<x3::error_handler_tag>(std::ref(errorHandler))[cd]