A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
emit_json.cc File Reference
#include "a11/flow/emit_json.h"
#include <algorithm>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <absl/container/flat_hash_set.h>
#include <absl/strings/str_cat.h>
#include <absl/time/time.h>
#include <absl/types/span.h>
#include <nlohmann/json.hpp>
#include "a11/flow/diagnostic.h"
#include "a11/flow/generate.h"
#include "a11/flow/highlight.h"
#include "a11/flow/lexer.h"
#include "a11/flow/parser.h"
#include "a11/flow/syntax.h"
#include "a11/flow/vocabulary.h"

Namespaces

namespace  a11
 
namespace  a11::flow
 

Functions

nlohmann::json a11::flow::DiagnosticToJsonValue (const Diagnostic &diagnostic)
 One diagnostic, as it appears in the envelope.
 
Diagnostic a11::flow::DiagnosticFromJsonValue (const nlohmann::json &value)
 Reads a diagnostic, ignoring unknown fields and defaulting missing ones.
 
nlohmann::json a11::flow::DiagnosticsToJsonValue (std::string_view source, absl::Span< const Diagnostic > diagnostics)
 The flow.diagnostics/v1 envelope, with source and severity counts.
 
std::string a11::flow::DiagnosticsToJson (std::string_view source, absl::Span< const Diagnostic > diagnostics)
 The envelope, serialised with a trailing newline and two-space indent.
 
nlohmann::json a11::flow::CodesToJsonValue ()
 The published code table, as flow.codes/v1.
 
nlohmann::json a11::flow::VocabularyToJsonValue ()
 The language word sets as flow.vocabulary/v1.
 
nlohmann::json a11::flow::DiagnosticsToSarifValue (std::string_view source, absl::Span< const Diagnostic > diagnostics)
 A SARIF 2.1.0 log for one file, with rule metadata from [KnownCodes].
 
std::string a11::flow::DiagnosticsToSarif (std::string_view source, absl::Span< const Diagnostic > diagnostics)
 The SARIF log, serialised with a trailing newline.
 
nlohmann::json a11::flow::ConstantToJsonValue (const syntax::Constant &constant)
 A constant as the syntax format writes it.
 
nlohmann::json a11::flow::NodeToJsonValue (const syntax::Node &node)
 A syntax node and its subtree.
 
nlohmann::json a11::flow::SyntaxToJsonValue (std::string_view source, const ParseResult &result)
 The flow.syntax/v1 envelope, including partial trees and diagnostics.
 
std::string a11::flow::SyntaxToJson (std::string_view source, const ParseResult &result)
 The envelope, serialised with a trailing newline and two-space indent.
 
nlohmann::json a11::flow::TokensToJsonValue (std::string_view source_name, std::string_view source)
 The flow.tokens/v1 envelope, with token kinds and semantic classes.
 
std::string a11::flow::TokensToJson (std::string_view source_name, std::string_view source)
 The envelope, serialised with a trailing newline and two-space indent.
 
nlohmann::json a11::flow::FormatToJsonValue (const FormatResult &result)
 The flow.format/v1 envelope: the formatted text, and what it took.
 
nlohmann::json a11::flow::CompletionsToJsonValue (const CompleteResult &result)
 The flow.completions/v1 envelope: what may be written at an offset.
 
nlohmann::json a11::flow::PlanToJsonValue (std::string_view source_name, const Program &program)
 The flow.plan/v1 envelope for resolved flows.
 
nlohmann::json a11::flow::DtoToJsonValue (const DtoPlan &dto, const Program *absl_nullable program=nullptr)
 A resolved shape.
 
std::string a11::flow::PlanToJson (std::string_view source_name, const Program &program)
 The envelope, serialised with a trailing newline and two-space indent.
 
std::string a11::flow::DiagnosticToText (std::string_view source, const Diagnostic &diagnostic)
 path:line:column: severity: message [code] on one line.