aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/openvic-dataloader/ParseData.hpp11
-rw-r--r--include/openvic-dataloader/ParseError.hpp20
-rw-r--r--include/openvic-dataloader/ParseWarning.hpp10
-rw-r--r--include/openvic-dataloader/v2script/Parser.hpp27
4 files changed, 48 insertions, 20 deletions
diff --git a/include/openvic-dataloader/ParseData.hpp b/include/openvic-dataloader/ParseData.hpp
new file mode 100644
index 0000000..8bec7d2
--- /dev/null
+++ b/include/openvic-dataloader/ParseData.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <string>
+
+namespace ovdl {
+ struct ParseData {
+ const std::string production_name;
+ const unsigned int context_start_line;
+ const unsigned int context_start_column;
+ };
+} \ No newline at end of file
diff --git a/include/openvic-dataloader/ParseError.hpp b/include/openvic-dataloader/ParseError.hpp
new file mode 100644
index 0000000..f3ae287
--- /dev/null
+++ b/include/openvic-dataloader/ParseError.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <string>
+
+#include "openvic-dataloader/ParseData.hpp"
+
+namespace ovdl {
+ struct ParseError {
+ const enum class Type : unsigned char {
+ Recoverable,
+ Fatal
+ } type;
+ const std::string message;
+ const int error_value;
+ const ParseData parse_data;
+ const unsigned int start_line;
+ const unsigned int start_column;
+ };
+
+} \ No newline at end of file
diff --git a/include/openvic-dataloader/ParseWarning.hpp b/include/openvic-dataloader/ParseWarning.hpp
new file mode 100644
index 0000000..307599f
--- /dev/null
+++ b/include/openvic-dataloader/ParseWarning.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <string>
+
+namespace ovdl {
+ struct ParseWarning {
+ const std::string message;
+ const int warning_value;
+ };
+} \ No newline at end of file
diff --git a/include/openvic-dataloader/v2script/Parser.hpp b/include/openvic-dataloader/v2script/Parser.hpp
index dbbec73..e971cdb 100644
--- a/include/openvic-dataloader/v2script/Parser.hpp
+++ b/include/openvic-dataloader/v2script/Parser.hpp
@@ -5,9 +5,10 @@
#include <memory>
#include <optional>
#include <ostream>
-#include <string>
#include <vector>
+#include <openvic-dataloader/ParseError.hpp>
+#include <openvic-dataloader/ParseWarning.hpp>
#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
namespace ovdl::v2script {
@@ -16,20 +17,6 @@ namespace ovdl::v2script {
class Parser {
public:
- struct Error {
- const enum class Type : unsigned char {
- Recoverable,
- Fatal
- } type;
- const std::string message;
- const int error_value;
- };
-
- struct Warning {
- const std::string message;
- const int warning_value;
- };
-
Parser();
static Parser from_buffer(const char* data, std::size_t size);
@@ -51,8 +38,8 @@ namespace ovdl::v2script {
bool has_fatal_error() const;
bool has_warning() const;
- const std::vector<Error>& get_errors() const;
- const std::vector<Warning>& get_warnings() const;
+ const std::vector<ParseError>& get_errors() const;
+ const std::vector<ParseWarning>& get_warnings() const;
const FileNode* get_file_node() const;
@@ -62,8 +49,8 @@ namespace ovdl::v2script {
~Parser();
private:
- std::vector<Error> _errors;
- std::vector<Warning> _warnings;
+ std::vector<ParseError> _errors;
+ std::vector<ParseWarning> _warnings;
class BufferHandler;
friend class BufferHandler;
@@ -74,6 +61,6 @@ namespace ovdl::v2script {
bool _has_fatal_error = false;
template<typename... Args>
- inline void _run_load_func(std::optional<Error> (BufferHandler::*func)(Args...), Args... args);
+ inline void _run_load_func(std::optional<ParseError> (BufferHandler::*func)(Args...), Args... args);
};
} \ No newline at end of file