|
ZenitUI
Retained-mode C++20 UI framework
|
Structured diagnostics for the CSS parser and style resolver. More...
#include <cstddef>#include <cstdint>#include <optional>#include <ostream>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | ZenitUI::SourceSpan |
| Source location for a diagnostic. More... | |
| struct | ZenitUI::ZStyleDiagnostic |
| A fully-formed diagnostic record. More... | |
| class | ZenitUI::DiagnosticSink |
| Abstract destination for diagnostics. More... | |
| class | ZenitUI::NullDiagnosticSink |
| Sink that discards every diagnostic. More... | |
| class | ZenitUI::CollectingDiagnosticSink |
| Sink that accumulates diagnostics in insertion order. More... | |
Enumerations | |
| enum class | ZenitUI::DiagnosticSeverity { Info , Warning , Error } |
| Diagnostic severity level. | |
| enum class | ZenitUI::DiagnosticCode { UnterminatedString , UnbalancedBrace , UnexpectedToken , UnknownProperty , InvalidValue , UnknownPseudo , UnknownPart , UnresolvedVariable , UnusedVariable , UnknownSelectorTag , SelectorMatchesNothing , DuplicateRule , UnknownTag , UnknownAttribute } |
| Machine-readable diagnostic identifier. More... | |
Functions | |
| const char * | ZenitUI::toString (DiagnosticSeverity s) noexcept |
| const char * | ZenitUI::toString (DiagnosticCode c) noexcept |
| ZStyleDiagnostic | ZenitUI::makeDiagnostic (DiagnosticCode code, DiagnosticSeverity severity, SourceSpan span, std::string message, std::string hint={}) |
| Build a diagnostic record. | |
| std::size_t | ZenitUI::editDistance (std::string_view a, std::string_view b) |
Levenshtein edit distance between a and b. | |
| std::vector< std::string > | ZenitUI::suggestSimilar (std::string_view unknown, const std::vector< std::string_view > &candidates, std::size_t maxDistance=2, std::size_t maxSuggestions=3) |
Suggest candidates within maxDistance edits of unknown. | |
| void | ZenitUI::formatDiagnostic (const ZStyleDiagnostic &d, std::ostream &os) |
Write a diagnostic to os in file:line:col: severity: message [code] format. | |
| const std::vector< std::string_view > & | ZenitUI::getKnownStyleProperties () |
| Return the list of style property names known to the parser. | |
Structured diagnostics for the CSS parser and style resolver.
The style subsystem can produce errors, warnings and informational messages with source spans, severities, machine-readable codes, optional "did you mean" suggestions, and cross-references to related spans.
The DiagnosticSink interface decouples reporting from consumption: the parser writes to any sink, tests can use CollectingDiagnosticSink, and production code can use NullDiagnosticSink to discard everything.
loadStyleString / loadStyleFile (in StyleParser.hpp) accept an optional sink and return false if any error was reported.