#include <Puma/Location.h>
Location of a token in a source file.
◆ Location() [1/2]
Puma::Location::Location |
( |
| ) |
|
|
inline |
Construct an empty location.
◆ Location() [2/2]
Puma::Location::Location |
( |
Filename | filename, |
|
|
int | line, |
|
|
int | column = 0 ) |
|
inline |
Construct a token location.
- Parameters
-
filename | The name of the file the token is located in. |
line | The line number. |
column | The optional column number. Defaults to 0. |
◆ column()
int Puma::Location::column |
( |
| ) |
const |
|
inline |
Get the number of the column in the file.
- Returns
- The column number.
◆ filename()
const Filename & Puma::Location::filename |
( |
| ) |
const |
|
inline |
Get the name of the file the token is located in.
- Returns
- A reference to the file name.
◆ line()
int Puma::Location::line |
( |
| ) |
const |
|
inline |
Get the number of the line in the file.
- Returns
- The line number.
◆ operator!=()
bool Puma::Location::operator!= |
( |
const Location & | location | ) |
const |
|
inline |
Compare with another location.
- Parameters
-
location | The other location. |
- Returns
- True if both locations differ.
◆ operator<()
bool Puma::Location::operator< |
( |
const Location & | location | ) |
const |
|
inline |
Compare with another location in the same file.
- Parameters
-
location | The other location. |
- Returns
- True if this location is before the given location in the same file.
◆ operator==()
bool Puma::Location::operator== |
( |
const Location & | location | ) |
const |
|
inline |
Compare with another location.
- Parameters
-
location | The other location. |
- Returns
- True if both locations are equal.
◆ setup()
void Puma::Location::setup |
( |
Filename | filename, |
|
|
int | line, |
|
|
int | column = 0 ) |
|
inline |
Initialize a token location.
- Parameters
-
filename | The name of the file the token is located in. |
line | The line number. |
column | The optional column number. Defaults to 0. |