Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Diagnostic_Builder Class Reference

Fluent builder used to enrich a just-created diagnostic. More...

#include <ah-diagnostics.H>

Collaboration diagram for Aleph::Diagnostic_Builder:
[legend]

Public Member Functions

 Diagnostic_Builder (Diagnostic_Engine &engine, const size_t index) noexcept
 Constructs a builder bound to engine[index].
 
Diagnostic_Builder & code (const std::string &value)
 Sets the stable diagnostic code.
 
Diagnostic_Builder & primary (const Source_Span &span, const std::string &msg="")
 Adds a primary label.
 
Diagnostic_Builder & secondary (const Source_Span &span, const std::string &msg)
 Adds a secondary label.
 
Diagnostic_Builder & note (const std::string &msg)
 Appends a note line.
 
Diagnostic_Builder & help (const std::string &msg)
 Appends a help line.
 
size_t emit () const noexcept
 Finalizes the builder and returns the diagnostic index.
 

Private Member Functions

Diagnostic & diag ()
 

Private Attributes

Diagnostic_Engine * engine = nullptr
 
size_t diag_index = 0
 

Detailed Description

Fluent builder used to enrich a just-created diagnostic.

Definition at line 104 of file ah-diagnostics.H.

Constructor & Destructor Documentation

◆ Diagnostic_Builder()

Aleph::Diagnostic_Builder::Diagnostic_Builder ( Diagnostic_Engine &  engine,
const size_t  index 
)
inlinenoexcept

Constructs a builder bound to engine[index].

Definition at line 113 of file ah-diagnostics.H.

Member Function Documentation

◆ code()

◆ diag()

Diagnostic & Aleph::Diagnostic_Builder::diag ( )
inlineprivate

◆ emit()

◆ help()

◆ note()

◆ primary()

Diagnostic_Builder & Aleph::Diagnostic_Builder::primary ( const Source_Span &  span,
const std::string &  msg = "" 
)
inline

Adds a primary label.

Parameters
spanSpan to highlight.
msgOptional label-specific message shown near the underline.

Definition at line 380 of file ah-diagnostics.H.

References diag(), Aleph::Diagnostic::labels, and Aleph::Primary.

◆ secondary()

Diagnostic_Builder & Aleph::Diagnostic_Builder::secondary ( const Source_Span &  span,
const std::string &  msg 
)
inline

Adds a secondary label.

Definition at line 387 of file ah-diagnostics.H.

References diag(), Aleph::Diagnostic::labels, and Aleph::Secondary.

Referenced by TEST().

Member Data Documentation

◆ diag_index

size_t Aleph::Diagnostic_Builder::diag_index = 0
private

Definition at line 107 of file ah-diagnostics.H.

Referenced by diag(), and emit().

◆ engine

Diagnostic_Engine* Aleph::Diagnostic_Builder::engine = nullptr
private

Definition at line 106 of file ah-diagnostics.H.

Referenced by diag().


The documentation for this class was generated from the following file: