17 #ifndef COM_BORA_SOFTWARE__BALAU_LANG__CODE_SPAN 18 #define COM_BORA_SOFTWARE__BALAU_LANG__CODE_SPAN 49 public:
CodePosition(
unsigned int line_,
unsigned int column_) : line(line_), column(column_) {}
67 return line == rhs.
line && column == rhs.
column;
74 return line < rhs.
line || (line == rhs.
line && column < rhs.
column);
81 return line > rhs.
line || (line == rhs.
line && column > rhs.
column);
144 unsigned int columnStart_,
145 unsigned int lineEnd_,
146 unsigned int columnEnd_)
147 : start(lineStart_, columnStart_)
148 , end(lineEnd_, columnEnd_) {}
191 return start == rhs.
start && end == rhs.
end;
202 return start < rhs.
start;
213 return start > rhs.
start;
234 template <
typename AllocatorT>
236 return ::toString<AllocatorT>(
260 #endif // COM_BORA_SOFTWARE__BALAU_LANG__CODE_SPAN static CodeSpan emptyCodeSpanEnd(const CodeSpan &previous)
Create an empty code span equal to the end of the supplied code span.
Definition: CodeSpan.hpp:131
static CodeSpan totalCodeSpan(const CodeSpan &start, const CodeSpan &end)
Create a code span equal to the start of the first code span and the end of the end code span...
Definition: CodeSpan.hpp:111
Pre-defined universal to-string functions.
bool operator==(const CodePosition &rhs) const
Is this code position equal to the supplied code position?
Definition: CodeSpan.hpp:66
unsigned int column
The column of the code position (1-indexed).
Definition: CodeSpan.hpp:39
CodePosition(unsigned int line_, unsigned int column_)
Create a code position with the supplied line and colunn values.
Definition: CodeSpan.hpp:49
A position in a piece of multi-line text.
Definition: CodeSpan.hpp:30
unsigned int line
The line of the code position (1-indexed).
Definition: CodeSpan.hpp:34
Information on the span of some source code text.
Definition: CodeSpan.hpp:91
CodeSpan(unsigned int lineStart_, unsigned int columnStart_, unsigned int lineEnd_, unsigned int columnEnd_)
Create a code span equal to the supplied start and end positions.
Definition: CodeSpan.hpp:143
CodePosition & operator=(const CodePosition ©)=default
Assign the code position by copying the supplied code position line and column values.
CodeSpan(const CodePosition &start_, const CodePosition &end_)
Create a code span equal to the supplied start and end positions.
Definition: CodeSpan.hpp:153
Parsing tools and parser implementations.
Definition: AbstractScanner.hpp:27
Balau::U8String< AllocatorT > toString(const CodeSpan &codeSpan)
Print the supplied code span as a UTF-8 string.
Definition: CodeSpan.hpp:235
CodePosition()
Create a null code position (line and colunn equal to 0).
Definition: CodeSpan.hpp:44
CodePosition end
The end position of the code span.
Definition: CodeSpan.hpp:100
std::basic_string< char, std::char_traits< char >, AllocatorT > U8String
UTF-8 string type with selectable allocator.
Definition: ToStringA.hpp:41
static CodeSpan emptyCodeSpanStart(const CodeSpan &next)
Create an empty code span equal to the start of the supplied code span.
Definition: CodeSpan.hpp:121
CodeSpan()
Create a null code span.
Definition: CodeSpan.hpp:138
The abstract URI base class.
bool operator>(const CodePosition &rhs) const
Does this code position come after the supplied code position?
Definition: CodeSpan.hpp:80
bool operator<(const CodePosition &rhs) const
Does this code position come before the supplied code position?
Definition: CodeSpan.hpp:73
CodePosition start
The start position of the code span.
Definition: CodeSpan.hpp:95