elna/include/elna/source/driver.hpp

36 lines
862 B
C++

#pragma once
#include <list>
#include "elna/source/ast.hpp"
#include "location.hh"
namespace elna::source
{
position make_position(const yy::location& location);
class syntax_error final : public error
{
std::string message;
public:
syntax_error(const std::string& message,
const std::filesystem::path& input_file, const yy::location& location);
virtual std::string what() const override;
};
class driver
{
std::list<std::unique_ptr<struct error>> m_errors;
const std::filesystem::path input_file;
public:
std::unique_ptr<program> tree;
driver(const std::filesystem::path& input_file);
void error(const yy::location& loc, const std::string& message);
const std::list<std::unique_ptr<struct error>>& errors() const noexcept;
};
}