|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Represents a location in source code. More...
#include <parse_utils.H>
Public Member Functions | |
| SourceLocation ()=default | |
| Default constructor. | |
| SourceLocation (std::string file, const int ln, const int col) | |
| Construct with all fields. | |
| std::string | to_string () const |
| Convert to human-readable string. | |
Static Public Member Functions | |
| static SourceLocation | current (const std::string &file="") |
| Construct from the current global parsing state. | |
| static SourceLocation | previous (const std::string &file="") |
| Construct from the previous (token start) global parsing state. | |
Public Attributes | |
| std::string | filename |
| Name of the source file. | |
| int | line = 1 |
| Line number (1-based) | |
| int | column = 1 |
| Column number (1-based) | |
Represents a location in source code.
Stores file name, line number, and column number for precise error reporting in parsers and compilers.
Definition at line 601 of file parse_utils.H.
|
default |
Default constructor.
Construct with all fields.
Definition at line 611 of file parse_utils.H.
|
inlinestatic |
Construct from the current global parsing state.
Definition at line 615 of file parse_utils.H.
References Aleph::current_col_number, Aleph::current_line_number, and file.
Referenced by TEST().
|
inlinestatic |
Construct from the previous (token start) global parsing state.
Definition at line 621 of file parse_utils.H.
References file, Aleph::previous_col_number, and Aleph::previous_line_number.
|
inline |
Convert to human-readable string.
Definition at line 630 of file parse_utils.H.
References column, Aleph::DynList< T >::empty(), filename, line, and Aleph::maps().
Referenced by TEST(), TEST(), and Aleph::Token::to_string().
| int Aleph::SourceLocation::column = 1 |
Column number (1-based)
Definition at line 605 of file parse_utils.H.
Referenced by TEST(), TEST(), and to_string().
| std::string Aleph::SourceLocation::filename |
Name of the source file.
Definition at line 603 of file parse_utils.H.
Referenced by TEST(), TEST(), and to_string().
| int Aleph::SourceLocation::line = 1 |
Line number (1-based)
Definition at line 604 of file parse_utils.H.
Referenced by TEST(), TEST(), and to_string().