A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
format.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 The A11 Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef A11_FLOW_FORMAT_H_
18#define A11_FLOW_FORMAT_H_
19
20#include <cstddef>
21#include <string>
22#include <string_view>
23#include <vector>
24
25#include "a11/flow/diagnostic.h"
26#include "a11/flow/limits.h"
27
28namespace a11::flow {
29
36 int indent = 2;
38 bool align_ports = true;
40 size_t line_width = 80;
41};
42
46 std::string formatted;
47 bool changed = false;
49 std::vector<Edit> edits;
51 std::vector<Diagnostic> diagnostics;
52};
53
57FormatResult Format(std::string_view source, FormatOptions options = {},
58 CompilationLimits limits = {},
59 CompilationBudget* absl_nullable budget = nullptr);
60
61} // namespace a11::flow
62
63#endif // A11_FLOW_FORMAT_H_
CompilationLimits limits
Definition main.cc:148
CompilationBudget budget
Definition lsp.cc:289
Definition catalogue.cc:29
FormatResult Format(std::string_view source, FormatOptions options, CompilationLimits limits, CompilationBudget *budget)
Definition format.cc:1783
stores::ChunkStoreReaderOptions options
Definition runtime_streams.cc:31
What the formatter is allowed to decide.
Definition format.h:34
size_t line_width
Maximum columns where syntax permits a break; zero leaves lines unbound.
Definition format.h:40
int indent
Spaces per block level. Repository Flow files use two.
Definition format.h:36
bool align_ports
Whether to align consecutive in and out declaration columns.
Definition format.h:38
Formatted source, edits, and diagnostics.
Definition format.h:44
bool changed
Definition format.h:47
std::vector< Edit > edits
Minimal edits producing formatted; empty when unchanged.
Definition format.h:49
std::string formatted
Complete source; equals the input when parsing fails or no edit is needed.
Definition format.h:46
std::vector< Diagnostic > diagnostics
Diagnostics that prevented formatting.
Definition format.h:51