FE
0.13.1
Header-only C++ frontend library
Toggle main menu visibility
Loading...
Searching...
No Matches
snippet.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
5
#include <iosfwd>
6
7
#include "
fe/loc.h
"
8
#include "
fe/term.h
"
9
10
namespace
fe
{
11
12
/// The underlined source excerpt that goes below a diagnostic.
13
/// Streams every source row Snippet::loc spans, each underlining the columns Snippet::loc covers on it.
14
/// Streams nothing if Snippet::loc has no Loc::src or does not resolve within it.
15
struct
Snippet
{
16
Loc
loc
;
17
term::FG
color
=
term::FG::Red
;
18
uint32_t
gutter
= 5;
///< Width of the line-number column.
19
uint32_t
max_rows
= 8;
///< Rows streamed before the middle is elided; `0` elides nothing.
20
21
/// `fe/snippet.h` merely *declares* this.
22
/// Link `fe-lib` for the default implementation, or provide your own in namespace `fe`.
23
friend
std::ostream&
operator<<
(std::ostream&,
const
Snippet
&);
24
};
25
26
}
// namespace fe
loc.h
fe::term::FG
FG
Foreground colors that can be streamed into an std::ostream.
Definition
term.h:60
fe::term::FG::Red
@ Red
Definition
term.h:62
fe
Definition
algo.h:17
fe::Loc
Location within a Src: the half-open byte range [Loc::begin, Loc::end).
Definition
loc.h:46
fe::Snippet
The underlined source excerpt that goes below a diagnostic.
Definition
snippet.h:15
fe::Snippet::gutter
uint32_t gutter
Width of the line-number column.
Definition
snippet.h:18
fe::Snippet::max_rows
uint32_t max_rows
Rows streamed before the middle is elided; 0 elides nothing.
Definition
snippet.h:19
fe::Snippet::color
term::FG color
Definition
snippet.h:17
fe::Snippet::loc
Loc loc
Definition
snippet.h:16
fe::Snippet::operator<<
friend std::ostream & operator<<(std::ostream &, const Snippet &)
fe/snippet.h merely declares this.
term.h
fe
snippet.h
Generated by
1.18.0