|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
Line and column lookup over one source text. More...
#include <cpp/a11/flow/diagnostic.h>
Public Member Functions | |
| LineIndex (std::string_view source) | |
| Position | At (size_t offset) const |
| The position at a byte offset, clamped to the end of the source. | |
| Range | Between (size_t start, size_t end) const |
| A range from two byte offsets. | |
| size_t | LineCount () const |
| How many lines the source has, counting a trailing partial line. | |
| size_t | LineStart (int line) const |
The byte offset the 1-based line starts at, clamped to the source. | |
Line and column lookup over one source text.
Built once per file and shared by everything that reports a position, so a diagnostic never costs a scan of the source to locate. Borrows the text, which must outlive it.
|
explicit |
| Position a11::flow::LineIndex::At | ( | size_t | offset | ) | const |
The position at a byte offset, clamped to the end of the source.
| Range a11::flow::LineIndex::Between | ( | size_t | start, |
| size_t | end | ||
| ) | const |
A range from two byte offsets.
|
inline |
How many lines the source has, counting a trailing partial line.
| size_t a11::flow::LineIndex::LineStart | ( | int | line | ) | const |
The byte offset the 1-based line starts at, clamped to the source.