The result returned by tokenize().
More...
#include <parser.hh>
|
| constexpr | operator bool () const noexcept |
| | Returns true when tokenization succeeded.
|
| constexpr auto | has_value () const noexcept -> bool |
| | Returns true when tokenization succeeded.
|
| constexpr auto | has_error () const noexcept -> bool |
| | Returns true when tokenization failed.
|
| auto | fail (ErrorCode code, std::size_t pos, std::string subject, std::string detail={}) -> TokenizeResult & |
| | Sets the error and returns *this for method chaining.
|
The result returned by tokenize().
On success, tokens contains the ordered token sequence and error is in the default (no-error) state. On failure, tokens may be partial and error describes the first problem encountered.
Definition at line 192 of file parser.hh.
◆ fail()
| auto cli::TokenizeResult::fail |
( |
ErrorCode | code, |
|
|
std::size_t | pos, |
|
|
std::string | subject, |
|
|
std::string | detail = {} ) -> TokenizeResult & |
|
inline |
Sets the error and returns *this for method chaining.
- Parameters
-
| code | The error code. |
| pos | The zero-based index into the input args span where the error occurred. Higher-level parser code may apply an offset when translating this to a caller-visible argument index. |
| subject | The option or token name that caused the error. |
| detail | Optional additional detail message. |
- Returns
- Reference to *this.
Definition at line 272 of file parser.hh.
◆ has_error()
| auto cli::TokenizeResult::has_error |
( |
| ) |
const -> bool |
|
inlinenodiscardconstexprnoexcept |
Returns true when tokenization failed.
Definition at line 256 of file parser.hh.
◆ has_value()
| auto cli::TokenizeResult::has_value |
( |
| ) |
const -> bool |
|
inlinenodiscardconstexprnoexcept |
Returns true when tokenization succeeded.
Definition at line 250 of file parser.hh.
◆ operator bool()
| cli::TokenizeResult::operator bool |
( |
| ) |
const |
|
inlineexplicitnodiscardconstexprnoexcept |
Returns true when tokenization succeeded.
Definition at line 244 of file parser.hh.
◆ error
◆ tokens
The documentation for this struct was generated from the following file: