move parserContext to its own file

This change allows us to include ast_handlers.hpp just once.

Change-Id: Ib6c70d27f79422c8b90b3006cffdb6e747ca346c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55e7791..2c9975e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,6 +59,7 @@
     src/CParser.cpp
     src/ast.cpp
     src/utils.cpp
+    src/parser_context.cpp
     )
 
 add_library(parser STATIC ${parser_SRCS})
diff --git a/src/CParser.hpp b/src/CParser.hpp
index cb92b12..4b3e1c4 100644
--- a/src/CParser.hpp
+++ b/src/CParser.hpp
@@ -8,8 +8,6 @@
 
 #pragma once
 #include <boost/spirit/home/x3.hpp>
-#include "CTree.hpp"
-#include "ast.hpp"
 #include "grammars.hpp"
 namespace x3 = boost::spirit::x3;
 namespace ascii = boost::spirit::x3::ascii;
diff --git a/src/ast.cpp b/src/ast.cpp
index 28b37e9..9c96bd2 100644
--- a/src/ast.cpp
+++ b/src/ast.cpp
@@ -6,9 +6,7 @@
  *
 */
 #include "ast.hpp"
-#include "ast_handlers.hpp"
 
-InvalidKeyException::~InvalidKeyException() = default;
 
 container_::container_(const std::string& name)
     : m_name(name)
@@ -44,8 +42,3 @@
 }
 
 
-ParserContext::ParserContext(const CTree& tree)
-    : m_tree(tree)
-{
-    m_curPath = m_tree.currentNode();
-}
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp
index 139bb5c..746116e 100644
--- a/src/ast_handlers.hpp
+++ b/src/ast_handlers.hpp
@@ -7,23 +7,10 @@
 */
 
 #pragma once
+
 #include "CTree.hpp"
+#include "parser_context.hpp"
 
-class InvalidKeyException : public std::invalid_argument {
-public:
-    using std::invalid_argument::invalid_argument;
-    ~InvalidKeyException() override;
-};
-
-struct ParserContext {
-    ParserContext(const CTree& tree);
-    const CTree& m_tree;
-    std::string m_curPath;
-    std::string m_errorMsg;
-    std::string m_tmpListName;
-    std::set<std::string> m_tmpListKeys;
-    bool m_errorHandled = false;
-};
 
 struct keyValue_class {
     template <typename T, typename Iterator, typename Context>
diff --git a/src/parser_context.cpp b/src/parser_context.cpp
new file mode 100644
index 0000000..c3b31c9
--- /dev/null
+++ b/src/parser_context.cpp
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+
+#include "parser_context.hpp"
+ParserContext::ParserContext(const CTree& tree)
+        : m_tree(tree)
+{
+    m_curPath = m_tree.currentNode();
+}
diff --git a/src/parser_context.hpp b/src/parser_context.hpp
new file mode 100644
index 0000000..64b293a
--- /dev/null
+++ b/src/parser_context.hpp
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
+ * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
+ *
+ * Written by Václav Kubernát <kubervac@fit.cvut.cz>
+ *
+*/
+
+#include "CTree.hpp"
+struct ParserContext {
+    ParserContext(const CTree& tree);
+    const CTree& m_tree;
+    std::string m_curPath;
+    std::string m_errorMsg;
+    std::string m_tmpListName;
+    std::set<std::string> m_tmpListKeys;
+    bool m_errorHandled = false;
+};