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>
66 absl::Span<const Diagnostic> diagnostics);
70 absl::Span<const Diagnostic> diagnostics);
93 std::string_view source, absl::Span<const Diagnostic> diagnostics);
97 absl::Span<const Diagnostic> diagnostics);
134 std::string_view source);
137std::string
TokensToJson(std::string_view source_name, std::string_view source);
165 const Program* absl_nullable program =
nullptr);
std::string value
Definition discover.cc:114
Definition boundary.cc:32
constexpr std::string_view kDiagnosticsFormat
The format field of each envelope: what a reader checks before parsing.
Definition emit_json.h:40
Diagnostic DiagnosticFromJsonValue(const nlohmann::json &value)
A diagnostic read back from its JSON, for frontends that consume the envelope rather than the library...
Definition emit_json.cc:594
nlohmann::json PlanToJsonValue(std::string_view source_name, const Program &program)
The flow.plan/v1 envelope: what each flow of a file resolved to.
Definition emit_json.cc:1127
nlohmann::json CodesToJsonValue()
The published code table, as flow.codes/v1.
Definition emit_json.cc:681
nlohmann::json TokensToJsonValue(std::string_view source_name, std::string_view source)
The flow.tokens/v1 envelope: every token, and what it means where it is.
Definition emit_json.cc:908
nlohmann::json NodeToJsonValue(const syntax::Node &node)
One syntax node, and everything under it.
Definition emit_json.cc:877
nlohmann::json DiagnosticToJsonValue(const Diagnostic &diagnostic)
One diagnostic, as it appears in the envelope.
Definition emit_json.cc:566
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:1200
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:904
std::string 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:colum...
Definition emit_json.cc:1204
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:675
constexpr std::string_view kCodesFormat
Definition emit_json.h:41
nlohmann::json DiagnosticsToSarifValue(std::string_view source, absl::Span< const Diagnostic > diagnostics)
A SARIF 2.1.0 log for one file's diagnostics.
Definition emit_json.cc:774
nlohmann::json CompletionsToJsonValue(const CompleteResult &result)
The flow.completions/v1 envelope: what may be written at an offset.
Definition emit_json.cc:966
nlohmann::json 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.
Definition emit_json.cc:881
constexpr std::string_view kVocabularyFormat
Definition emit_json.h:44
nlohmann::json FormatToJsonValue(const FormatResult &result)
The flow.format/v1 envelope: the formatted text, and what it took.
Definition emit_json.cc:949
nlohmann::json DiagnosticsToJsonValue(std::string_view source, absl::Span< const Diagnostic > diagnostics)
The full flow.diagnostics/v1 envelope.
Definition emit_json.cc:640
nlohmann::json DtoToJsonValue(const DtoPlan &dto, const Program *absl_nullable program)
One resolved shape, as the structs of a plan writes it.
Definition emit_json.cc:1167
nlohmann::json ConstantToJsonValue(const syntax::Constant &constant)
A constant as the syntax format writes it.
Definition emit_json.cc:841
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:944
std::string DiagnosticsToSarif(std::string_view source, absl::Span< const Diagnostic > diagnostics)
The SARIF log, serialised with a trailing newline.
Definition emit_json.cc:835
constexpr std::string_view kFormatFormat
Definition emit_json.h:45
constexpr std::string_view kTokensFormat
Definition emit_json.h:43
nlohmann::json VocabularyToJsonValue()
Every word set the language gives meaning to, as flow.vocabulary/v1.
Definition emit_json.cc:692
constexpr std::string_view kSyntaxFormat
Definition emit_json.h:42
graph::RefId node
The graph ref this answer corresponds to, when a graph is being built.
Definition resolve.cc:698
What may be written at an offset, and the word already typed there.
Definition complete.h:108
One problem found in a flow.
Definition diagnostic.h:108
One compiled struct: a shape a port may be typed with.
Definition plan.h:80
The flows a file declares, and everything wrong with it.
Definition parser.h:32
Every flow and shape one source file declares.
Definition plan.h:185
A value the language can write out in full: what a literal is, and what folding a literal expression ...
Definition syntax.h:80
Base of every syntax node: what it is, and where it started.
Definition syntax.h:204
std::string dto
Which shape schema is asked about; every one of them when empty.
Definition main.cc:78