aboutsummaryrefslogtreecommitdiff
path: root/include/openvic-dataloader/v2script/Parser.hpp
blob: 53aab90e6c9cfa533ba6343e1d780f76ee62e20e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once

#include <cstddef>
#include <cstdio>
#include <ostream>

namespace ovdl::v2script {
   class Parser {
   public:
      static Parser from_buffer(char8_t* data, std::size_t size);
      static Parser from_buffer(char8_t* start, char8_t* end);
      static Parser from_file(const char8_t* path);

      void set_error_log_to_stderr();
      void set_error_log_path(const char8_t* path);
      void set_error_log_to(std::basic_ostream<char8_t> stream);
      void set_error_log_to(std::FILE* file);

      bool parse();

      bool has_error();
      bool has_warning();

   private:
      Parser();
   };
}