Defined in header <cparse/Parser.hh>
std::vector<ParseError> const& errors() const noexcept;
Returns the internal std::vector<ParseError> by const reference. Callers iterate over the result after parse() returns to obtain the diagnostics that were recorded via recordError().
Parameters
None.
Return value
A const reference to the internal error vector. Never returns a dangling reference — the vector lives inside the Parser for its entire lifetime.
Order is call order of recordError(). See ParseError Notes on why this is not always source order.
Exceptions
noexcept.
Notes
The vector is cleared at the start of every outermost parse(). Nested parses do not clear the vector — parent-context diagnostics are preserved. See Parser::parse Lifecycle Phase 1.
Example
Parser& p = /* ... */;
p.parse("input.txt");
for (auto const& e : p.errors())
std::cerr << e.filename << ':' << e.line << ':' << e.col
<< ": " << e.message << '\n';
See also
- Parser::hasErrors — non-empty check.
- Parser::clearErrors — empty the vector.
- Parser::recordError — the writer.
- ParseError — the record structure.

