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/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)
 A diagnostic read back from its JSON, for frontends that consume the envelope rather than the library – the IntelliJ plugin, a CI script.
 
nlohmann::json a11::flow::DiagnosticsToJsonValue (std::string_view source, absl::Span< const Diagnostic > diagnostics)
 The full flow.diagnostics/v1 envelope.
 
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 ()
 Every word set the language gives meaning to, 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's diagnostics.
 
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)
 One syntax node, and everything under it.
 
nlohmann::json a11::flow::SyntaxToJsonValue (std::string_view source, const ParseResult &result)
 The full flow.syntax/v1 envelope: the flows a file declares, and what is wrong with it.
 
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: every token, and what it means where it is.
 
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: what each flow of a file resolved to.
 
nlohmann::json a11::flow::DtoToJsonValue (const DtoPlan &dto, const Program *absl_nullable program=nullptr)
 One resolved shape, as the structs of a plan writes it.
 
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)
 One diagnostic on one line, in the shape editors and compilers have used for decades: path:line:column: severity: message [code].