17#ifndef A11_FLOW_EMIT_JSON_H_
18#define A11_FLOW_EMIT_JSON_H_
23#include <absl/types/span.h>
24#include <nlohmann/json_fwd.hpp>
51 absl::Span<const Diagnostic> diagnostics);
55 absl::Span<const Diagnostic> diagnostics);
65 std::string_view source, absl::Span<const Diagnostic> diagnostics);
69 absl::Span<const Diagnostic> diagnostics);
88 std::string_view source);
91std::string
TokensToJson(std::string_view source_name, std::string_view source);
106 const Program* absl_nullable program =
nullptr);
a11::Promise< a11::Unit > result
Definition async_node.cc:56
std::string value
Definition discover.cc:100
Definition catalogue.cc:29
constexpr std::string_view kDiagnosticsFormat
Envelope format identifiers. Readers ignore unknown fields in a version.
Definition emit_json.h:36
Diagnostic DiagnosticFromJsonValue(const nlohmann::json &value)
Reads a diagnostic, ignoring unknown fields and defaulting missing ones.
Definition emit_json.cc:717
nlohmann::json PlanToJsonValue(std::string_view source_name, const Program &program)
The flow.plan/v1 envelope for resolved flows.
Definition emit_json.cc:1336
nlohmann::json CodesToJsonValue()
The published code table, as flow.codes/v1.
Definition emit_json.cc:825
nlohmann::json TokensToJsonValue(std::string_view source_name, std::string_view source)
The flow.tokens/v1 envelope, with token kinds and semantic classes.
Definition emit_json.cc:1070
nlohmann::json NodeToJsonValue(const syntax::Node &node)
A syntax node and its subtree.
Definition emit_json.cc:1022
nlohmann::json DiagnosticToJsonValue(const Diagnostic &diagnostic)
One diagnostic, as it appears in the envelope.
Definition emit_json.cc:671
std::string PlanToJson(std::string_view source_name, const Program &program)
The envelope, serialised with a trailing newline and two-space indent.
Definition emit_json.cc:1423
std::string SyntaxToJson(std::string_view source, const ParseResult &result)
The envelope, serialised with a trailing newline and two-space indent.
Definition emit_json.cc:1066
std::string DiagnosticToText(std::string_view source, const Diagnostic &diagnostic)
path:line:column: severity: message [code] on one line.
Definition emit_json.cc:1427
std::string DiagnosticsToJson(std::string_view source, absl::Span< const Diagnostic > diagnostics)
The envelope, serialised with a trailing newline and two-space indent.
Definition emit_json.cc:819
constexpr std::string_view kCodesFormat
Definition emit_json.h:37
nlohmann::json DiagnosticsToSarifValue(std::string_view source, absl::Span< const Diagnostic > diagnostics)
A SARIF 2.1.0 log for one file, with rule metadata from [KnownCodes].
Definition emit_json.cc:919
nlohmann::json CompletionsToJsonValue(const CompleteResult &result)
The flow.completions/v1 envelope: what may be written at an offset.
Definition emit_json.cc:1133
nlohmann::json SyntaxToJsonValue(std::string_view source, const ParseResult &result)
The flow.syntax/v1 envelope, including partial trees and diagnostics.
Definition emit_json.cc:1026
constexpr std::string_view kVocabularyFormat
Definition emit_json.h:40
nlohmann::json FormatToJsonValue(const FormatResult &result)
The flow.format/v1 envelope: the formatted text, and what it took.
Definition emit_json.cc:1116
nlohmann::json DiagnosticsToJsonValue(std::string_view source, absl::Span< const Diagnostic > diagnostics)
The flow.diagnostics/v1 envelope, with source and severity counts.
Definition emit_json.cc:784
nlohmann::json DtoToJsonValue(const DtoPlan &dto, const Program *absl_nullable program)
A resolved shape.
Definition emit_json.cc:1390
nlohmann::json ConstantToJsonValue(const syntax::Constant &constant)
A constant as the syntax format writes it.
Definition emit_json.cc:986
std::string TokensToJson(std::string_view source_name, std::string_view source)
The envelope, serialised with a trailing newline and two-space indent.
Definition emit_json.cc:1111
std::string DiagnosticsToSarif(std::string_view source, absl::Span< const Diagnostic > diagnostics)
The SARIF log, serialised with a trailing newline.
Definition emit_json.cc:980
constexpr std::string_view kFormatFormat
Definition emit_json.h:41
constexpr std::string_view kTokensFormat
Definition emit_json.h:39
nlohmann::json VocabularyToJsonValue()
The language word sets as flow.vocabulary/v1.
Definition emit_json.cc:836
constexpr std::string_view kSyntaxFormat
Definition emit_json.h:38
graph::RefId node
Graph ref for this result, or [graph::kNone] without a resolved ref.
Definition resolve.cc:809
What may be written at an offset, and the word already typed there.
Definition complete.h:97
Flow problem rendered by the CLI, JSON and SARIF writers, and editors.
Definition diagnostic.h:99
One compiled struct: a shape a port may be typed with.
Definition plan.h:87
The flows a file declares, and everything wrong with it.
Definition parser.h:34
Every flow and shape one source file declares.
Definition plan.h:200
A literal or folded literal expression, including nested lists and objects.
Definition syntax.h:62
Base of every syntax node: what it is, and where it started.
Definition syntax.h:179