mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
Mainly because "sorting_diagnostic_consumer" is legacy, since `SortingDiagnosticConsumer` became `SortingConsumer`. Also better reflecting contents of these files. Where I'm not renaming, I'm less positive about dropping "diagnostics" from "file_diagnostics" and "null_diagnostics" (which contain both a consumer and emitter, and "null.h" seems like poor naming), so not doing that here. Also "diagnostic.h" contains `struct Diagnostic`, so is a decent fit. Assisted-by: Google Antigravity with Gemini 3 Flash
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_PARSE_PARSE_H_
|
|
#define CARBON_TOOLCHAIN_PARSE_PARSE_H_
|
|
|
|
#include "common/ostream.h"
|
|
#include "toolchain/diagnostics/emitter.h"
|
|
#include "toolchain/lex/tokenized_buffer.h"
|
|
#include "toolchain/parse/tree.h"
|
|
|
|
namespace Carbon::Parse {
|
|
|
|
struct ParseOptions {
|
|
// Options must be set individually, not through initialization.
|
|
explicit ParseOptions() = default;
|
|
|
|
// If set, a consumer for diagnostics. Otherwise, diagnostics go to stderr.
|
|
Diagnostics::Consumer* consumer = nullptr;
|
|
|
|
// If set, enables verbose output.
|
|
llvm::raw_ostream* vlog_stream = nullptr;
|
|
|
|
// If set, the parse tree will be dumped to this.
|
|
llvm::raw_ostream* dump_stream = nullptr;
|
|
|
|
// When dumping, whether to dump in preorder; otherwise, postorder is used.
|
|
bool dump_preorder_parse_tree = false;
|
|
};
|
|
|
|
// Parses the token buffer into a `Tree`.
|
|
//
|
|
// This is the factory function which is used to build parse trees.
|
|
auto Parse(Lex::TokenizedBuffer& tokens, ParseOptions options) -> Tree;
|
|
|
|
} // namespace Carbon::Parse
|
|
|
|
#endif // CARBON_TOOLCHAIN_PARSE_PARSE_H_
|