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. More... | |
void | addToken (Token t) |
void | eof () |
End of a stream. More... | |
void | literal (StringRef str) |
Add a literal (with external storage). More... | |
void | nbsp () |
Add a non-breaking space. More... | |
void | nbsp (unsigned n) |
Add multiple non-breaking spaces as a single token. More... | |
void | neverbreak () |
Add a 'neverbreak' break. Always 'fits'. More... | |
void | newline () |
Add a newline (break too wide to fit, always breaks). More... | |
void | spaces (uint32_t n) |
Add breakable spaces. More... | |
void | space () |
Add a breakable space. More... | |
void | zerobreak () |
Add a break that is zero-wide if not broken. More... | |
void | bbox (int32_t offset=0, Breaks breaks=Breaks::Consistent) |
Start a IndentStyle::Block group with specified offset. More... | |
void | cbox (int32_t offset=0, IndentStyle style=IndentStyle::Visual) |
Start a consistent group with specified offset. More... | |
void | ibox (int32_t offset=0, IndentStyle style=IndentStyle::Visual) |
Start an inconsistent group with specified offset. More... | |
void | neverbox () |
Start a group that cannot break, including nested groups. More... | |
void | end () |
End a group. More... | |
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(), and circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Start a IndentStyle::Block group with specified offset.
Definition at line 131 of file PrettyPrinterHelpers.h.
References circt::pretty::Block.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Start a consistent group with specified offset.
Definition at line 136 of file PrettyPrinterHelpers.h.
References circt::pretty::Consistent.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
End a group.
Definition at line 150 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
End of a stream.
Definition at line 96 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::pp.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Start an inconsistent group with specified offset.
Definition at line 141 of file PrettyPrinterHelpers.h.
References circt::pretty::Inconsistent.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Add a literal (with external storage).
Definition at line 101 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenBuilder< PPTy >::nbsp(), and circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Add a non-breaking space.
Definition at line 104 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::literal().
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
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.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Add a 'neverbreak' break. Always 'fits'.
Definition at line 114 of file PrettyPrinterHelpers.h.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Add a newline (break too wide to fit, always breaks).
Definition at line 117 of file PrettyPrinterHelpers.h.
References circt::pretty::PrettyPrinter::kInfinity.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
inline |
Add a breakable space.
Definition at line 123 of file PrettyPrinterHelpers.h.
References circt::pretty::TokenBuilder< PPTy >::spaces().
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
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.
Referenced by circt::pretty::TokenStream< PPTy >::operator<<().
|
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().