diff options
-rw-r--r-- | src/openvic-dataloader/DiagnosticLogger.hpp | 4 | ||||
-rw-r--r-- | src/openvic-dataloader/ParseState.hpp | 8 | ||||
-rw-r--r-- | src/openvic-dataloader/detail/ParseHandler.hpp | 5 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/openvic-dataloader/DiagnosticLogger.hpp b/src/openvic-dataloader/DiagnosticLogger.hpp index 479a7a0..4c3a776 100644 --- a/src/openvic-dataloader/DiagnosticLogger.hpp +++ b/src/openvic-dataloader/DiagnosticLogger.hpp @@ -226,6 +226,10 @@ namespace ovdl { _tree.set_root(_tree.create<error::Root>()); } + void set_file(const file_type& file) { + _file = &file; + } + struct Writer; template<typename... Args> diff --git a/src/openvic-dataloader/ParseState.hpp b/src/openvic-dataloader/ParseState.hpp index 259f2a5..221a269 100644 --- a/src/openvic-dataloader/ParseState.hpp +++ b/src/openvic-dataloader/ParseState.hpp @@ -61,6 +61,10 @@ namespace ovdl { return _logger; } + void update_logger_file() { + _logger.set_file(this->ast().file()); + } + private: ast_type _ast; diagnostic_logger_type _logger; @@ -102,6 +106,10 @@ namespace ovdl { return _logger; } + void update_logger_file() { + _logger.set_file(this->file()); + } + private: file_type _file; diagnostic_logger_type _logger; diff --git a/src/openvic-dataloader/detail/ParseHandler.hpp b/src/openvic-dataloader/detail/ParseHandler.hpp index 28222ae..89969be 100644 --- a/src/openvic-dataloader/detail/ParseHandler.hpp +++ b/src/openvic-dataloader/detail/ParseHandler.hpp @@ -85,9 +85,10 @@ namespace ovdl::detail { lexy::buffer<BufferEncoding>(std::move(buffer)), encoding }; - return; + } else { + *state = { lexy::buffer<BufferEncoding>(std::move(buffer)), encoding }; } - *state = { lexy::buffer<BufferEncoding>(std::move(buffer)), encoding }; + state->update_logger_file(); }; template<detail::IsStateType State> |