NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
diagnostic.h File Reference

Stable, transport-neutral Program diagnostics and source coordinates. More...

#include <neograph/api.h>
#include <neograph/graph/configuration_failure.h>
#include <neograph/json.h>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for diagnostic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  neograph::program::DiagnosticHelp
 Self-repair help for one diagnostic. More...
 
struct  neograph::program::LabelledCoordinate
 A secondary location with a one-line label ("also referenced here"). More...
 
class  neograph::program::ProgramDiagnosticError
 A Program diagnostic raised at runtime. More...
 
struct  neograph::program::SuggestionEdit
 One edit of a suggestion, as an RFC 6902 JSON Patch operation on the Program document the compiler parsed. More...
 

Enumerations

enum class  neograph::program::SuggestionApplicability { Machine , Maybe , Placeholder }
 How safely a tool may apply a suggestion without review. More...
 

Functions

NEOGRAPH_PROGRAM_API std::string neograph::program::diagnostic_doc_link (std::string_view code)
 The documentation link for a diagnostic code: its own entry in docs/diagnostics.md, or the section of its family when the code has none.
 
NEOGRAPH_PROGRAM_API std::vector< std::string > neograph::program::diagnostic_name_candidates (std::string_view unknown, const std::vector< std::string > &declared)
 Names within distance 2 of unknown, nearest first, then by byte order.
 
NEOGRAPH_PROGRAM_API std::size_t neograph::program::diagnostic_name_distance (std::string_view left, std::string_view right, std::size_t limit=2)
 Damerau-Levenshtein (optimal string alignment) distance, counted in bytes.
 
NEOGRAPH_PROGRAM_API Diagnostic neograph::program::sealed_diagnostic (Diagnostic diagnostic)
 The copy that is sealed into a bundle: the same diagnostic without help.
 
NEOGRAPH_PROGRAM_API void neograph::program::to_json (json &value, const Diagnostic &diagnostic)
 Writes "help" only when the diagnostic carries it.
 

Variables

constexpr std::string_view neograph::program::DIAGNOSTICS_TRUNCATED_CODE = "P_DIAGNOSTICS_TRUNCATED"
 Code of the note that replaces returned diagnostics past the cap.
 
constexpr std::size_t neograph::program::MAX_RETURNED_DIAGNOSTICS = 20
 At most this many diagnostics are returned, plus the truncation note.
 

Detailed Description

Stable, transport-neutral Program diagnostics and source coordinates.

Definition in file diagnostic.h.

Enumeration Type Documentation

◆ SuggestionApplicability

How safely a tool may apply a suggestion without review.

Enumerator
Machine 

The edits are the fix; apply them as given.

Maybe 

A likely fix; review it first. The default.

Placeholder 

The edits contain a value the author must fill in.

Definition at line 54 of file diagnostic.h.

Function Documentation

◆ diagnostic_name_distance()

NEOGRAPH_PROGRAM_API std::size_t neograph::program::diagnostic_name_distance ( std::string_view  left,
std::string_view  right,
std::size_t  limit = 2 
)

Damerau-Levenshtein (optimal string alignment) distance, counted in bytes.

Returns limit + 1 as soon as the distance is known to exceed limit.

References neograph::program::diagnostic_name_distance().

Referenced by neograph::program::diagnostic_name_distance().