2017-04-05 08:06:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
struct Position {
|
|
|
|
int32_t line = -1;
|
|
|
|
int32_t column = -1;
|
|
|
|
|
|
|
|
Position();
|
2017-04-07 06:10:17 +00:00
|
|
|
Position(int32_t line, int32_t column);
|
2017-04-05 08:06:18 +00:00
|
|
|
explicit Position(const char* encoded);
|
|
|
|
|
|
|
|
std::string ToString();
|
|
|
|
std::string ToPrettyString(const std::string& filename);
|
|
|
|
|
|
|
|
// Compare two Positions and check if they are equal. Ignores the value of
|
|
|
|
// |interesting|.
|
|
|
|
bool operator==(const Position& that) const;
|
|
|
|
bool operator!=(const Position& that) const;
|
|
|
|
bool operator<(const Position& that) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Range {
|
|
|
|
Position start;
|
|
|
|
Position end;
|
|
|
|
|
|
|
|
Range();
|
2017-04-19 05:28:33 +00:00
|
|
|
Range(Position start, Position end);
|
2017-04-05 08:06:18 +00:00
|
|
|
explicit Range(const char* encoded);
|
|
|
|
|
2017-04-11 05:43:01 +00:00
|
|
|
bool Contains(int line, int column) const;
|
|
|
|
|
2017-04-05 08:06:18 +00:00
|
|
|
std::string ToString();
|
|
|
|
|
|
|
|
bool operator==(const Range& that) const;
|
|
|
|
bool operator!=(const Range& that) const;
|
|
|
|
bool operator<(const Range& that) const;
|
|
|
|
};
|