file
SFormat.hSystemVerilog string formatting routines.
Namespaces
- namespace slang
- Root namespace.
- namespace slang::ast
- The SystemVerilog AST.
Classes
- struct slang::ast::SFormat::FormatOptions
- A collection of options that can be applied to the SFormat string formatting functions.
Functions
-
auto parse(std::
string_view formatString, function_ref<void(std:: string_view text)> onText, function_ref<void(char specifier, size_t offset, size_t len, const FormatOptions&options)> onArg, function_ref<void(DiagCode code, size_t offset, size_t len, std:: optional<char> specifier)> onError) -> bool - Parse the given formatString and call the provided callbacks for each parsed portion.
-
void formatInt(std::
string& result, const SVInt& value, LiteralBase base, const FormatOptions& options) - Format the given value into a string and append it to result according to the provided options.
-
void formatArg(std::
string& result, const ConstantValue& arg, char specifier, const FormatOptions& options) - Format the given arg into a string and append it to result according to the provided options.
Function documentation
bool parse(std:: string_view formatString,
function_ref<void(std:: string_view text)> onText,
function_ref<void(char specifier, size_t offset, size_t len, const FormatOptions&options)> onArg,
function_ref<void(DiagCode code, size_t offset, size_t len, std:: optional<char> specifier)> onError)
Parse the given formatString and call the provided callbacks for each parsed portion.
Parameters | |
---|---|
formatString | Specified by the SystemVerilog LRM – see that for a complete reference. |
onText | Will be invoked for each constant / non-formatted portion of the format string. |
onArg | Will be invoked for each format specifier in the format string, with various options parsed and provided as arguments. |
onError | Will be invoked for any errors in the format string, with a diagnostic code describing the problem and the location in the string where the error occurred. |
Returns | true if parsing was successful, and false if an error occurred. |