sapphirec
0.1
The Sapphire compiler.
src
Location.h
1
#pragma once
2
#include "sapphirepch.h"
3
4
/* Struct to represent a location in a file. */
5
struct
Location
6
{
7
int
line;
8
int
column;
9
std::string fname;
10
11
/* The location at which this location was imported, for error traces in imported files. */
12
std::shared_ptr<Location> parent =
nullptr
;
13
14
/* Creates a Location with the given parameters. */
15
Location
(
int
ln,
int
col, std::string file);
16
17
~
Location
();
18
19
/* Returns a string of the format FILE:LINE:COL. */
20
std::string str()
const
;
21
/* Returns a string of the format (FILE:LINE:COL). */
22
std::string paren_str()
const
;
23
24
/* Advance to the next column in the file. */
25
void
advance();
26
27
/* Advance to the next line if provided a newline. */
28
void
pos_from_char(
const
char
& character);
29
30
void
operator=(
const
Location
& other);
31
32
/* Copies the other location into this one. */
33
void
copy(
const
Location
& other);
34
};
Location
Definition:
Location.h:6
Generated by
1.9.1