CIRCT 20.0.0git
|
Add convenience methods for generating pretty-printing tokens. More...
#include <PrettyPrinterHelpers.h>
Public Member Functions | |
TokenBuilder (PPTy &pp) | |
template<typename T , typename... Args> | |
std::enable_if_t< std::is_base_of_v< Token, T > > | add (Args &&...args) |
Add new token. | |
void | addToken (Token t) |
void | eof () |
End of a stream. | |
void | literal (StringRef str) |
Add a literal (with external storage). | |
void | nbsp () |
Add a non-breaking space. | |
void | nbsp (unsigned n) |
Add multiple non-breaking spaces as a single token. | |
void | neverbreak () |
Add a 'neverbreak' break. Always 'fits'. | |
void | newline () |
Add a newline (break too wide to fit, always breaks). | |
void | spaces (uint32_t n) |
Add breakable spaces. | |
void | space () |
Add a breakable space. | |
void | zerobreak () |
Add a break that is zero-wide if not broken. | |
void | bbox (int32_t offset=0, Breaks breaks=Breaks::Consistent) |
Start a IndentStyle::Block group with specified offset. | |
void | cbox (int32_t offset=0, IndentStyle style=IndentStyle::Visual) |
Start a consistent group with specified offset. | |
void | ibox (int32_t offset=0, IndentStyle style=IndentStyle::Visual) |
Start an inconsistent group with specified offset. | |
void | neverbox () |
Start a group that cannot break, including nested groups. | |
void | end () |
End a group. | |
Private Attributes | |
PPTy & | pp |
Add convenience methods for generating pretty-printing tokens.
Definition at line 80 of file PrettyPrinterHelpers.h.
|
inline |
Definition at line 84 of file PrettyPrinterHelpers.h.
|
inline |
Add new token.
Definition at line 90 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::pp.
|
inline |
Definition at line 93 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::pp.
Referenced by circt::pretty::TokenBuilder< PPTy >::nbsp().
|
inline |
Start a IndentStyle::Block group with specified offset.
Definition at line 131 of file PrettyPrinterHelpers.h.
References circt::pretty::Block.
|
inline |
Start a consistent group with specified offset.
Definition at line 136 of file PrettyPrinterHelpers.h.
References circt::pretty::Consistent.
|
inline |
End a group.
Definition at line 150 of file PrettyPrinterHelpers.h.
|
inline |
End of a stream.
Definition at line 96 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::pp.
|
inline |
Start an inconsistent group with specified offset.
Definition at line 141 of file PrettyPrinterHelpers.h.
References circt::pretty::Inconsistent.
|
inline |
Add a literal (with external storage).
Definition at line 101 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenBuilder< PPTy >::nbsp().
|
inline |
Add a non-breaking space.
Definition at line 104 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::literal().
|
inline |
Add multiple non-breaking spaces as a single token.
Definition at line 107 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::addToken(), and circt::pretty::detail::emitNBSP().
|
inline |
Start a group that cannot break, including nested groups.
Use sparingly.
Definition at line 147 of file PrettyPrinterHelpers.h.
References circt::pretty::Never.
|
inline |
Add a 'neverbreak' break. Always 'fits'.
Definition at line 114 of file PrettyPrinterHelpers.h.
|
inline |
Add a newline (break too wide to fit, always breaks).
Definition at line 117 of file PrettyPrinterHelpers.h.
References circt::pretty::PrettyPrinter::kInfinity.
|
inline |
Add a breakable space.
Definition at line 123 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::spaces().
|
inline |
Add breakable spaces.
Definition at line 120 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenBuilder< PPTy >::space().
|
inline |
Add a break that is zero-wide if not broken.
Definition at line 126 of file PrettyPrinterHelpers.h.
|
private |
Definition at line 81 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenBuilder< PPTy >::add(), circt::pretty::TokenBuilder< PPTy >::addToken(), and circt::pretty::TokenBuilder< PPTy >::eof().