#pragma once #include "sapphirepch.h" /* Struct to represent a location in a file. */ struct Location { int line; int column; std::string fname; /* The location at which this location was imported, for error traces in imported files. */ std::shared_ptr parent = nullptr; /* Creates a Location with the given parameters. */ Location(int ln, int col, std::string file); ~Location(); /* Returns a string of the format FILE:LINE:COL. */ std::string str() const; /* Returns a string of the format (FILE:LINE:COL). */ std::string paren_str() const; /* Advance to the next column in the file. */ void advance(); /* Advance to the next line if provided a newline. */ void pos_from_char(const char& character); void operator=(const Location& other); /* Copies the other location into this one. */ void copy(const Location& other); };