2022-09-19 07:34:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace ppc {
|
|
|
|
struct location_t {
|
2022-10-03 12:48:39 +00:00
|
|
|
static const location_t NONE;
|
|
|
|
|
2022-09-19 07:34:19 +00:00
|
|
|
std::size_t line;
|
|
|
|
std::size_t start;
|
|
|
|
std::size_t length;
|
|
|
|
std::size_t code_start;
|
2022-10-09 13:34:02 +00:00
|
|
|
const std::string &filename;
|
2022-09-19 07:34:19 +00:00
|
|
|
|
2022-10-09 11:18:38 +00:00
|
|
|
operator std::string() const { return to_string(); }
|
2022-09-19 07:34:19 +00:00
|
|
|
std::string to_string() const;
|
|
|
|
location_t intersect(location_t other) const;
|
|
|
|
|
|
|
|
location_t();
|
2022-10-09 13:34:02 +00:00
|
|
|
location_t(const location_t &other): location_t(other.filename, other.line, other.start, other.code_start, other.length) { }
|
|
|
|
location_t(const std::string &filename);
|
2022-09-19 07:34:19 +00:00
|
|
|
location_t(std::size_t line, std::size_t start);
|
2022-10-09 13:34:02 +00:00
|
|
|
location_t(const std::string &filename, std::size_t line, std::size_t start);
|
2022-09-19 07:34:19 +00:00
|
|
|
location_t(std::size_t line, std::size_t start, std::size_t code_start);
|
2022-10-09 13:34:02 +00:00
|
|
|
location_t(const std::string &filename, std::size_t line, std::size_t start, std::size_t code_start);
|
2022-09-19 07:34:19 +00:00
|
|
|
location_t(std::size_t line, std::size_t start, std::size_t code_start, std::size_t length);
|
2022-10-09 13:34:02 +00:00
|
|
|
location_t(const std::string &filename, std::size_t line, std::size_t start, std::size_t code_start, std::size_t length);
|
2022-09-19 07:34:19 +00:00
|
|
|
};
|
|
|
|
}
|