#include "Location.h" #include "FormatString/FormatString.hpp" #include Location::Location(int ln, int col, std::string file) : line(ln), column(col), fname(file) { } Location::~Location() { } std::string Location::str() const { std::ostringstream ss; ss << fname << ":" << line << ":" << column; return ss.str(); } std::string Location::paren_str() const { return format_string("(%s)", this->str()); } void Location::advance() { ++column; } void Location::pos_from_char(const char& character) { if (character == '\n') { ++line; column = 0; } } void Location::operator=(const Location& other) { this->parent = other.parent; this->line = other.line; this->column = other.column; this->fname = other.fname; } void Location::copy(const Location& other) { this->operator=(other); }