Files
carbon-lang/toolchain/format/format.cpp
T
Jon Ross-Perkins df55b89e08 Implement some token-based formatting structure. (#4386)
Here I'm trying to add some simple formatting based on the token kind,
aiming mainly to keep the implementation short for now.

This approach won't generalize to arbitrary structures (e.g., it doesn't
discern between braces for a function body and a struct literal). I
think we'll probably want to build a parse tree and associate parse
kinds with tokens in order to format, additionally doing something less
linear. But my essential goal at present is to just get a
proof-of-concept that the basics can yield something that looks okay.
2024-10-10 23:18:38 +00:00

17 lines
461 B
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
#include "toolchain/format/format.h"
#include "toolchain/format/formatter.h"
namespace Carbon::Format {
auto Format(const Lex::TokenizedBuffer& tokens, llvm::raw_ostream& out)
-> bool {
return Formatter(&tokens, &out).Run();
}
} // namespace Carbon::Format