# Headers

Boost.Parser uses assertions (`BOOST_ASSERT()`) in several places to indicate that your use of the library has an error in it. All of those places could heve instead been ill-formed code, caught at compile time. It is far quicker and easier to determine exactly where in your code such an error is located if this is a runtime failure; you can just look at the stack in your favorite debugger. However, if you want to make thes kinds of errors always ill-formed code, define this macro.

Asserts that the given condition is true. If `BOOST_PARSER_NO_RUNTIME_ASSERTIONS` macro is defined by the user, `BOOST_PARSER_ASSERT` expends to a compile-time `static_assert()`. Otherwise, it expands to a run-time `BOOST_ASSERT()`. Note that defining `BOOST_DISABLE_ASSERTS` disables the use of C `assert`, even when `BOOST_ASSERT` is unavailble.

Boost.Parser will automatically use concepts to constrain templates when building in C++20 mode, if the compiler defines `__cpp_lib_concepts`. To disable the use of concepts, define this macro.

Define this macro to use `boost::hana::tuple` instead of `std::tuple` throughout Boost.Parser.

Boost.Parser automatically treats aggregate structs as if they were tuples. It uses some metaprogramming to do this. The technique used has a hard limit on the number of data members a struct can have. Re-define this macro to change the hard limit. Note that large values may increase compile times.

The subrange template that is used throughout Boost.Parser. This will be `boost::parser::subrange` in C++17 builds, and `std::ranges::subrange` in all other builds.

If you are using Visual Studio to run your program, and don't have a terminal in which to observe the output when parsing with `trace::on`, define this macro and you'll see the trace output in the Visual Studio debugger's output panel. This macro has no effect when `_MSC_VER` is not also defined.

An error handler that allows users to supply callbacks to handle the reporting of warnings and errors. The reporting of errors and/or warnings can be suppressed by supplying one or both default-constructed callbacks.

std::function< void(std::string const &)>
callback_type
callback_type
std::string
callback_type
callback_type
callback_type()
std::string_view
callback_type
callback_type
callback_type()
std::wstring_view
callback_type
callback_type
callback_type()

This overload is Windows-only.

error_handler_result `Iter` `Sentinel` ``parse_error`< Iter > const &`
void `diagnostic_kind` `std::string_view` `Context const &` `Iter`
void `diagnostic_kind` `std::string_view` `Context const &`

An error handler that just re-throws any exception generated by the parse.

error_handler_result `Iter` `Sentinel` ``parse_error`< Iter > const &`
void `diagnostic_kind` `std::string_view` `Context const &` `Iter`
void `diagnostic_kind` `std::string_view` `Context const &`
boost::parser::stream_error_handler

An error handler that prints to the Visual Studio debugger via calls to `OutputDebugString()`.

std::string_view
std::wstring_view
std::ostream & `std::ostream &` `std::string_view` `Iter` `Iter` `Sentinel` `std::string_view` `int64_t80` `int64_t40`

Writes a formatted message (meaning prefixed with the file name, line, and column number) to `os`.

std::ostream & `std::ostream &` `std::string_view` `Iter` `Sentinel` ``parse_error`< Iter > const &` `int64_t80` `int64_t40`

Writes a formatted parse-expectation failure (meaning prefixed with the file name, line, and column number) to `os`.

`line_position`< Iter > `Iter` `Iter`

Returns the `line_position` for `it`, counting lines from the beginning of the input `first`.

Iter `Iter` `Sentinel`

Returns the iterator to the end of the line in which `it` is found.

The error handler used when the user does not specify a custom one. This error handler prints warnings and errors to `std::cerr`, and does not have an associcated filename.

error_handler_result `Iter` `Sentinel` ``parse_error`< Iter > const &`

Handles a `parse_error` exception thrown during parsing. A formatted parse-expectation failure is printed to `std::cerr`. Always returns `error_handler_result::fail`.

void `diagnostic_kind` `std::string_view` `Context const &` `Iter`

Prints `message` to `std::cerr`. The diagnostic is printed with the given `kind`, indicating the location as being at `it`. This must be called within a parser semantic action, providing the parse context.

void `diagnostic_kind` `std::string_view` `Context const &`

Prints `message` to `std::cerr`. The diagnostic is printed with the given `kind`, at no particular location. This must be called within a parser semantic action, providing the parse context.

A position within a line, consisting of an iterator to the start of the line, the line number, and the column number.

Iter
int64_t
int64_t
std::runtime_error

The exception thrown when a parse error is encountered, consisting of an iterator to the point of failure, and the name of the failed parser or rule in `what()`.

Iter
Iter
std::string const &

Prints warnings and errors to the `std::ostream`s provided by the user, or `std::cerr` if neither stream is specified. If a filename is provided, that is used to print all diagnostics.

std::string_view
std::string_view
std::ostream &
std::string_view
std::ostream &
std::ostream &
std::wstring_view

This overload is Windows-only.

std::wstring_view
std::ostream &

This overload is Windows-only.

std::wstring_view
std::ostream &
std::ostream &

This overload is Windows-only.

error_handler_result `Iter` `Sentinel` ``parse_error`< Iter > const &`

Handles a `parse_error` exception thrown during parsing. A formatted parse-expectation failure is printed to `*err_os_` when `err_os_` is non-null, or `std::cerr` otherwise. Always returns `error_handler_result::fail`.

void `diagnostic_kind` `std::string_view` `Context const &` `Iter`

Let `std::ostream * s = kind == diagnostic_kind::error : err_os_ : warn_os_`; prints `message` to `*s` when `s` is non-null, or `std::cerr` otherwise. The diagnostic is printed with the given `kind`, indicating the location as being at `it`. This must be called within a parser semantic action, providing the parse context.

void `diagnostic_kind` `std::string_view` `Context const &`

Let `std::ostream * s = kind == diagnostic_kind::error : err_os_ : warn_os_`; prints `message` to `*s` when `s` is non-null, or `std::cerr` otherwise. The diagnostic is printed with the given `kind`, at no particular location. This must be called within a parser semantic action, providing the parse context.

Fail the top-level parse.

Re-throw the parse error exception.

The possible actions to take when a parse error is handled by an error handler.

An error diagnostic.

A warning diagnostic.

The kinds of diagnostics that can be handled by an error handler.

std::ostream & `std::ostream &` `std::wstring_view` `Iter` `Iter` `Sentinel` `std::string_view` `int64_t80` `int64_t40`

Writes a formatted message (meaning prefixed with the file name, line, and column number) to `os`. This overload is Windows-only.

std::ostream & `std::ostream &` `std::wstring_view` `Iter` `Sentinel` ``parse_error`< Iter > const &` `int64_t80` `int64_t40`

Writes a formatted parse-expectation failure (meaning prefixed with the file name, line, and column number) to `os`. This overload is Windows-only.

A type trait that evaluates to the attribute type for parser `Parser` used to parse range `R`, as if by calling `parse(r, parser)`, using some `R r` and `Parser parser`. Note that this implies that pointers to null-terminated strings are supported types for `R`. The result is not wrapped in a `std::optional` like the result of a call to `parse()` would be. If `Parser` produces no attribute, the result is the no-attribute sentinel type `none`.

unspecified
unspecified
boost::parser::repeat_parser< Parser, DelimiterParser >

Repeats the application of another parser `p` of type `Parser`, `[1, Inf)` times, applying a parser `d` of type `DelimiterParser` in between each pair of applications of `p`. The parse succeeds iff `p` succeeds at least once, and `d` succeeds each time it is applied. The attribute produced is a sequence of the type of attribute produced by `Parser`.

Parser
DelimiterParser
template< class > class

Represents a unparameterized higher-order parser (e.g. `omit_parser`) as a directive (e.g. `omit[other_parser]`).

constexpr auto ``parser_interface`< Parser2 >`

Represents a sequence parser, the first parser of which is an `epsilon_parser` with predicate, as a directive (e.g. `if_(pred)[p]`).

Predicate
constexpr auto ``parser_interface`< Parser2 >`

A directive type that can only be used on sequence parsers, that forces the merge of all the sequence_parser's subparser's attributes into a single attribute.

constexpr auto ``parser_interface`< `seq_parser`< ParserTuple, BacktrackingTuple, CombiningGroups > >`
T const &
`none` & `T const &`
T
`none`
`none`
`none`
`none`
`none`
`none`
`none`
`none` & `int`
`none`
`none` `int`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` `T const &`
`none` typename... `Args const &`
void
boost::parser::repeat_parser< Parser >

Repeats the application of another parser `p` of type `Parser`, `[1, Inf)` times. The parse succeeds iff `p` succeeds at least once. The attribute produced is a sequence of the type of attribute produced by `Parser`.

Parser

Repeats the application of another parser of type `Parser`, `[0, 1]` times. The parse always succeeds. The attribute produced is a `std::optional<T>`, where `T` is the type of attribute produced by `Parser`.

Parser
auto `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &`
void `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &` `Attribute &`

Applies each parser in `ParserTuple`, in order, stopping after the application of the first one that succeeds. The parse succeeds iff one of the sub-parsers succeeds. The attribute produced is a `std::variant` over the types of attribute produced by the parsers in `ParserTuple`.

ParserTuple
ParserTuple
auto `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &`
void `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &` `Attribute &`

A wrapper for parsers that provides the operations that must be supported by all parsers (e.g. `operator>>()`). `GlobalState` is an optional state object that can be accessed within semantic actions via a call to `_globals()`. This global state object is ignored for all but the topmost parser; the topmost global state object is available in the semantic actions of all nested parsers. `ErrorHandler` is the type of the error handler to be used on parse failure. This handler is ignored on all but the topmost parser; the topmost parser's error handler is used for all errors encountered during parsing.

Parser
GlobalState
ErrorHandler
int
parser_type
parser_type
global_state_type
error_handler_type
constexpr auto

Returns a `parser_interface` containing a parser equivalent to an `expect_parser` containing `parser_`, with `FailOnMatch == true`.

constexpr auto

Returns a `parser_interface` containing a parser equivalent to an `expect_parser` containing `parser_`, with `FailOnMatch == false`.

constexpr auto

Returns a `parser_interface` containing a parser equivalent to a `zero_plus_parser` containing `parser_`.

constexpr auto

Returns a `parser_interface` containing a parser equivalent to a `one_plus_parser` containing `parser_`.

constexpr auto

Returns a `parser_interface` containing a parser equivalent to a `opt_parser` containing `parser_`.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `rhs.parser_`.

constexpr auto `char`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto `char32_t`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `rhs.parser_`. No back-tracking is allowed after `parser_` succeeds; if `rhs.parser_` fails after `parser_` succeeds, the top-level parse fails.

constexpr auto `char`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`. No back-tracking is allowed after `parser_` succeeds; if `lit(rhs)` fails after `parser_` succeeds, the top-level parse fails.

constexpr auto `char32_t`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`. No back-tracking is allowed after `parser_` succeeds; if `lit(rhs)` fails after `parser_` succeeds, the top-level parse fails.

constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a parser equivalent to a `seq_parser` containing `parser_` followed by `lit(rhs)`. No back-tracking is allowed after `parser_` succeeds; if `lit(rhs)` fails after `parser_` succeeds, the top-level parse fails.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to an `or_parser` containing `parser_` followed by `rhs.parser_`.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to a `perm_parser` containing `parser_` followed by `rhs.parser_`. It is an error to use `eps` (conditional or not) with this operator.

constexpr auto `char`

Returns a `parser_interface` containing a parser equivalent to an `or_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto `char32_t`

Returns a `parser_interface` containing a parser equivalent to an `or_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a parser equivalent to an `or_parser` containing `parser_` followed by `lit(rhs)`.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to `!rhs >> *this`.

constexpr auto `char`

Returns a `parser_interface` containing a parser equivalent to `!lit(rhs) >> *this`.

constexpr auto `char32_t`

Returns a `parser_interface` containing a parser equivalent to `!lit(rhs) >> *this`.

constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a parser equivalent to `!lit(rhs) >> *this`.

constexpr auto ``parser_interface`< ParserType2 >`

Returns a `parser_interface` containing a parser equivalent to an `delimited_seq_parser` containing `parser_` and `rhs.parser_`.

constexpr auto `char`

Returns a `parser_interface` containing a parser equivalent to an `delimited_seq_parser` containing `parser_` and `lit(rhs)`.

constexpr auto `char32_t`

Returns a `parser_interface` containing a parser equivalent to an `delimited_seq_parser` containing `parser_` and `lit(rhs)`.

constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a parser equivalent to an `delimited_seq_parser` containing `parser_` and `lit(rhs)`.

constexpr auto `Action`

Returns a `parser_interface` containing a parser equivalent to an `action_parser` containing `parser_`, with semantic action `action`.

constexpr auto typename... `Arg &&` `Args &&...`

Returns `parser_((Arg &&)arg, (Args &&)args...)`. This is useful for those parsers that have `operator()` overloads, e.g. char_('x). By convention, parsers `operator()`s return `parser_interface`s.

This function does not participate in overload resolution unless `parser_((Arg &&)arg, (Args &&)args...)` is well-formed.

Applies each parsers in `ParserTuple`, an any order, stopping after all of them have matched the input. The parse succeeds iff all the parsers match, regardless of the order in which they do. The attribute produced is a `parser::tuple` containing the attributes of the subparsers, in their order of the parsers' appearance in `ParserTuple`, not the order of the parsers' matches. It is an error to specialize `perm_parser` with a `ParserTuple` template parameter that includes an `eps_parser`.

ParserTuple
ParserTuple
auto `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &`
void `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &` `Attribute &`
void typename... int... `Iter &` `Sentinel` `Context const &` `SkipParser const &` `unspecified` `bool &` `tuple< Ts... > &` `std::integer_sequence< int, Is... >`

Matches a string delimited by quotation marks; produces a `std::string` attribute.

Quotes
Escapes
char32_t
constexpr `quoted_string_parser`() return ``quoted_string_parser`(std::move(x))`
constexpr auto parsable_range_like `R &&`

Returns a `parser_interface` containing a `quoted_string_parser` that accepts any of the values in `r` as its quotation marks. If the input being matched during the parse is a a sequence of `char32_t`, the elements of `r` are transcoded from their presumed encoding to UTF-32 during the comparison. Otherwise, the character begin matched is directly compared to the elements of `r`.

auto `T` ``symbols`< U > const &`

Returns a `parser_interface` containing a `quoted_string_parser` that uses `x` as its quotation marks. `symbols` provides a list of strings that may appear after a backslash to form an escape sequence, and what character(s) each escape sequence represents. Note that `"\\"</tt> and <tt>"\ch"` are always valid escape sequences.

auto parsable_range_like `R &&` ``symbols`< T > const &`

Returns a `parser_interface` containing a `quoted_string_parser` that accepts any of the values in `r` as its quotation marks. If the input being matched during the parse is a a sequence of `char32_t`, the elements of `r` are transcoded from their presumed encoding to UTF-32 during the comparison. Otherwise, the character begin matched is directly compared to the elements of `r`. `symbols` provides a list of strings that may appear after a backslash to form an escape sequence, and what character(s) each escape sequence represents. Note that `"\\"</tt> and <tt>"\ch"` are always valid escape sequences.

Represents a `repeat_parser` as a directive (e.g. `repeat[other_parser]`).

MinType
MaxType
constexpr auto ``parser_interface`< Parser2 >`

A directive type that can only be used on sequence parsers, that prevents each of the sequence_parser's subparser's attributes from merging with any other subparser's attribute.

constexpr auto ``parser_interface`< `seq_parser`< ParserTuple, BacktrackingTuple, CombiningGroups > >`
unspecified

Represents a skip parser as a directive. When used without a skip parser, e.g. `skip[parser_in_which_to_do_skipping]`, the skipper for the entire parse is used. When given another parser, e.g. `skip(skip_parser)[parser_in_which_to_do_skipping]`, that other parser is used as the skipper within the directive.

SkipParser
constexpr auto ``parser_interface`< Parser >`
constexpr auto ``parser_interface`< SkipParser2 >`

Returns a `skip_directive` with `skip_parser` as its skipper.

boost::parser::parser_interface< symbol_parser< T > >

A `symbols<T>` represents the initial state of a symbol table parser that produces attributes of type `T`. The entries in the symbol table can be changed during parsing, but those mutations to not affect the `symbols<T>` object itself; all mutations happen to a copy of the symbol table in the parse context. For table entries that should be used during every parse, add entries via `add()` or `operator()`. For mid-parse mutations, use `insert()` and `erase()`.

char const *
std::initializer_list< std::pair< std::string_view, T > >
char const *
std::initializer_list< std::pair< std::string_view, T > >
void `std::string_view` `T`

Inserts an entry consisting of a UTF-8 string `str` to match, and an associated attribute `x`, to `*this`. The entry is added for use in all subsequent top-level parses. Subsequent lookups during the current top-level parse will not necessarily match `str`.

void `std::string_view`

Erases the entry whose UTF-8 match string is `str`, from `*this`. The entry will no longer be available for use in all subsequent top-level parses. `str` will not be removed from the symbols matched in the current top-level parse.

void

Erases all the entries from the copy of the symbol table inside the parse context `context`.

void `Context const &` `std::string_view` `T`

Inserts an entry consisting of a UTF-8 string `str` to match, and an associated attribute `x`, to `*this`. The entry is added for use in all subsequent top-level parses. Subsequent lookups during the current top-level parse will not necessarily match `str`.

void `Context const &` `std::string_view`

Erases the entry whose UTF-8 match string is `str`, from `*this`. The entry will no longer be available for use in all subsequent top-level parses. `str` will not be removed from the symbols matched in the current top-level parse.

void `Context const &`

Erases all the entries from the copy of the symbol table inside the parse context `context`.

unspecified `Context const &` `std::string_view`

Uses UTF-8 string `str` to look up an attribute in the table during parsing, returning it as an optional reference. The lookup is done on the copy of the symbol table inside the parse context `context`, not `*this`.

void `Context const &` `std::string_view` `T`

Inserts an entry consisting of a UTF-8 string to match `str`, and an associtated attribute `x`, to the copy of the symbol table inside the parse context `context`.

void `Context const &` `std::string_view`

Erases the entry whose UTF-8 match string is `str` from the copy of the symbol table inside the parse context `context`.

void `Context const &`

Erases all the entries from the copy of the symbol table inside the parse context `context`.

A directive that transforms the attribute generated by a parser. `operator[]` returns a `parser_interface<transform_parser<Parser, F>>`.

F
constexpr auto ``parser_interface`< Parser >`
boost::parser::repeat_parser< Parser >

Repeats the application of another parser `p` of type `Parser`, `[0, Inf)` times. The parse always succeeds. The attribute produced is a sequence of the type of attribute produced by `Parser`.

Parser
constexpr auto `char`

Returns a literal parser equivalent to `lit(c)`.

constexpr auto `char8_t`

Returns a literal parser equivalent to `lit(c)`.

constexpr auto `char32_t`

Returns a literal parser equivalent to `lit(c)`.

constexpr auto `char const *` `std::size_t`

Returns a literal parser equivalent to `lit(str)`.

constexpr auto `char8_t const *` `std::size_t`

Returns a literal parser equivalent to `lit(str)`.

constexpr auto `char32_t const *` `std::size_t`

Returns a literal parser equivalent to `lit(str)`.

constexpr auto `char`

Returns a character parser equivalent to `char_(c)`.

constexpr auto `char8_t`

Returns a character parser equivalent to `char_(c)`.

constexpr auto `char32_t`

Returns a character parser equivalent to `char_(c)`.

constexpr auto `char const *` `std::size_t`

Returns a string parser equivalent to `string(str)`.

constexpr auto `char8_t const *` `std::size_t`

Returns a string parser equivalent to `string(str)`.

constexpr auto `char32_t const *` `std::size_t`

Returns a string parser equivalent to `string(str)`.

An enumeration used for parameters to enable and disable trace in the `*parse()` functions.

unspecified

An invocable that returns the `I`th parameter to the bottommost rule. This is useful for forwarding parameters to sub-rules.

int64_t const

A very large sentinel value used to represent pseudo-infinity.

constexpr `directive`< `omit_parser` >

The `omit` directive, whose `operator[]` returns a `parser_interface<omit_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `directive`< `raw_parser` >

The `raw` directive, whose `operator[]` returns a `parser_interface<raw_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `directive`< `string_view_parser` >

The `string_view` directive, whose `operator[]` returns a `parser_interface<string_view_parser<P>>` from a given parser of type `parser_interface<P>`. This is only available in C++20 and later.

constexpr `directive`< `lexeme_parser` >

The `lexeme` directive, whose `operator[]` returns a `parser_interface<lexeme_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `directive`< `no_case_parser` >

The `no_case` directive, whose `operator[]` returns a `parser_interface<no_case_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `skip_directive`

The `skip_directive`, whose `operator[]` returns a `parser_interface<skip_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `merge_directive`

The `merge_directive`, whose `operator[]` returns a `parser_interface<P2>`, from a given parser of type `parser_interface<P>`, where `P` is a `seq_parser`. `P2` is the same as `P`, except that its `CombiningGroups` template parameter is replaced with a tag type that causes the subparser's attributes to be merged into a single attribute.

constexpr `separate_directive`

The `separate_directive`, whose `operator[]` returns a `parser_interface<P2>`, from a given parser of type `parser_interface<P>`, where `P` is a `seq_parser`. `P2` is the same as `P`, except that its `CombiningGroups` template parameter is replaced with a tag type that prevents each subparser's attribute from merging with any other subparser's attribute.

unspecified

The epsilon parser. This matches anything, and consumes no input. If used with an optional predicate, like `eps(pred)`, it matches iff `pred(ctx)` evaluates to true, where `ctx` is the parser context.

constexpr `parser_interface`< eoi_parser >

The end-of-input parser. It matches only the end of input.

unspecified

The single-character parser. The produced attribute is the type of the matched code point (`char` or `char32_t`). Used as-is, `char_` matches any code point. `char_` can also can be used to create code point parsers that match one or more specific code point values, by calling it with: a single value comparable to a code point; a closed range of code point values `[lo, hi]`, or a set of code point values passed as a range. When calling with a range, only the iterators that bound the range are stored. Make sure the range you pass outlives the use of the resulting parser. Note that a string literal is a range, and that it outlives any parser it is used to construct.

unspecified

The code point parser. It produces a `char32_t` attribute. Used as-is, `cp` matches any code point. `cp` can also can be used to create code point parsers that match one or more specific code point values, by calling it with: a single value comparable to a code point; a closed range of code point values `[lo, hi]`, or a set of code point values passed as a range. When calling with a range, only the iterators that bound the range are stored. Make sure the range you pass outlives the use of the resulting parser. Note that a string literal is a range, and that it outlives any parser it is used to construct.

unspecified

The code unit parser. It produces a `char` attribute. Used as-is, `cu` matches any code point. `cu` can also can be used to create code point parsers that match one or more specific code point values, by calling it with: a single value comparable to a code point; a closed range of code point values `[lo, hi]`, or a set of code point values passed as a range. When calling with a range, only the iterators that bound the range are stored. Make sure the range you pass outlives the use of the resulting parser. Note that a string literal is a range, and that it outlives any parser it is used to construct.

constexpr `parser_interface`< `quoted_string_parser`<> >

Parses a string delimited by quotation marks. This parser can be used to create parsers that accept one or more specific quotation mark characters. By default, the quotation marks are "'`; an alternate quotation mark can be specified by calling this parser with a single character, or a range of characters. If a range is specified, the opening quote must be one of the characters specified, and the closing quote must match the opening quote. Quotation marks may appear within the string if escaped with a backslash, and a pair of backslashes is treated as a single escaped backslash; all other backslashes cause the parse to fail, unless a symbol table is in use. A symbol table can be provided as a second parameter after the single character or range described above. The symbol table is used to recognize escape sequences. Each escape sequence is a backslash followed by a value in the symbol table. When using a symbol table, any backslash that is not followed by another backslash, the opening quote character, or a symbol from the symbol table will cause the parse to fail. Skipping is disabled during parsing of the entire quoted string, including the quotation marks. There is an expectation point before the closing quotation mark. Produces a `std::string` attribute.

constexpr `parser_interface`< `ws_parser`< true, false > >

The end-of-line parser. This matches "\r\n", or any one of the line break code points from the Unicode Line Break Algorithm, described in https://unicode.org/reports/tr14. Produces no attribute.

constexpr `parser_interface`< `ws_parser`< false, false > >

The whitespace parser. This matches "\r\n", or any one of the Unicode code points with the White_Space property, as defined in https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt. Produces no attribute.

constexpr `parser_interface`< `ws_parser`< false, true > >

The whitespace parser that does not match end-of-line. This matches any one of the Unicode code points with the White_Space property, as defined in https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt, except for the ones matched by `eol`. Produces no attribute.

constexpr `parser_interface`< digit_parser >

The decimal digit parser. Matches the full set of Unicode decimal digits; in other words, all Unicode code points with the "Nd" character property. Note that this covers all Unicode scripts, only a few of which are Latin.

unspecified

The hexidecimal digit parser. Matches the full set of Unicode hexidecimal digits (upper or lower case); in other words, all Unicode code points with the "Hex_Digit" character property.

unspecified

The control character parser. Matches the all Unicode code points with the "Cc" ("control character") character property.

unspecified

The punctuation character parser. Matches the full set of Unicode punctuation clases (specifically, "Pc", "Pd", "Pe", "Pf", "Pi", "Ps", and "Po").

unspecified

The lower case character parser. Matches the full set of Unicode lower case code points (class "Ll").

unspecified

The lower case character parser. Matches the full set of Unicode lower case code points (class "Lu").

constexpr `parser_interface`< bool_parser >

The Boolean parser. Parses "true" and "false", producing attributes `true` and `false`, respectively, and fails on any other input.

constexpr `parser_interface`< `uint_parser`< unsigned int, 2 > >

The binary unsigned integer parser. Produces an `unsigned int` attribute. To parse a particular value `x`, use `bin(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned int, 8 > >

The octal unsigned integer parser. Produces an `unsigned int` attribute. To parse a particular value `x`, use `oct(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned int, 16 > >

The hexadecimal unsigned integer parser. Produces an `unsigned int` attribute. To parse a particular value `x`, use `hex(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned short > >

The `unsigned short` parser. Produces an `unsigned short` attribute. To parse a particular value `x`, use `ushort_(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned int > >

The `unsigned int` parser. Produces an `unsigned int` attribute. To parse a particular value `x`, use `uint_(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned long > >

The `unsigned long` parser. Produces an `unsigned long` attribute. To parse a particular value `x`, use `ulong_(x)`.

constexpr `parser_interface`< `uint_parser`< unsigned long long > >

The `unsigned long long` parser. Produces an `unsigned long long` attribute. To parse a particular value `x`, use `ulong_long(x)`.

constexpr `parser_interface`< `int_parser`< short > >

The `short` parser. Produces a `short` attribute. To parse a particular value `x`, use `short_(x)`.

constexpr `parser_interface`< `int_parser`< int > >

The `int` parser. Produces an `int` attribute. To parse a particular value `x`, use `int_(x)`.

constexpr `parser_interface`< `int_parser`< long > >

The `long` parser. Produces a `long` attribute. To parse a particular value `x`, use `long_(x)`.

constexpr `parser_interface`< `int_parser`< long long > >

The `long long` parser. Produces a `long long` attribute. To parse a particular value `x`, use `long_long(x)`.

constexpr `parser_interface`< `float_parser`< float > >

The `float` parser. Produces a `float` attribute.

constexpr `parser_interface`< `float_parser`< double > >

The `double` parser. Produces a `double` attribute.

auto `unspecified` `GlobalState &`

Returns a `parser_interface` with the same parser and error handler, with `globals` added. The resut of passing any non-top-level parser for the `parser` argument is undefined.

auto ``parser_interface`< Parser, GlobalState, `default_error_handler` > const &` `ErrorHandler &`

Returns a `parser_interface` with the same parser and globals, with `error_handler` added. The resut of passing any non-top-level parser for the `parser` argument is undefined.

constexpr `repeat_directive`< T, T > `T`

Returns a `repeat_directive` that repeats exactly `n` times, and whose `operator[]` returns a `parser_interface<repeat_parser<P>>` from a given parser of type `parser_interface<P>`.

constexpr `repeat_directive`< MinType, MaxType > `MinType` `MaxType`

Returns a `repeat_directive` that repeats between `min_` and `max_` times, inclusive, and whose `operator[]` returns a `parser_interface<repeat_parser<P>>` from a given parser of type `parser_interface<P>`.

auto `F`

Returns a `transform_directive` that uses invocable `F` to do its work.

constexpr auto `Attribute`

Returns an `attr_parser` which matches anything, and consumes no input, and which produces `a` as its attribute.

constexpr auto `char`

Returns a literal code point parser that produces no attribute.

constexpr auto `char8_t`

Returns a literal code point parser that produces no attribute.

constexpr auto `char32_t`

Returns a literal code point parser that produces no attribute.

constexpr auto parsable_range_like `R &&`

Returns a parser that matches `str` that produces the matched string as its attribute.

constexpr auto parsable_range_like `R &&`

Returns a parser that matches `str` that produces no attribute.

constexpr auto `Predicate`

Returns an `if_directive` that fails if the given predicate `pred` is `false`, and otherwise, applies another parser. For instance, in `if_(pred)[p]`, `p` is only applied if `pred` is true.

constexpr auto `T`

Returns a `switch`-like parser. The resulting parser uses the given value `x` to select one of the following value/parser pairs, and to apply the selected parser. `x` may be a value to be used directly, or a unary invocable that takes a reference to the parse context, and returns the value to use. You can add more value/parser cases to the returned parser, using its call operator, e.g. `switch_(x)(y1, p1)(y2, p2)`. As with the `x` passed to this function, each `yN` value can be a value or a unary invocable.

constexpr auto `char` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) >> rhs`.

constexpr auto `char32_t` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) >> rhs`.

constexpr auto parsable_range_like `R &&` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(str) >> rhs`.

constexpr auto `char` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) > rhs`.

constexpr auto `char32_t` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) > rhs`.

constexpr auto parsable_range_like `R &&` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(str) > rhs`.

constexpr auto `char` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) | rhs`.

constexpr auto `char32_t` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) | rhs`.

constexpr auto parsable_range_like `R &&` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(str) | rhs`.

constexpr auto `char` ``parser_interface`< Parser >`

Returns a parser equivalent to `!rhs >> lit(c)`.

constexpr auto `char32_t` ``parser_interface`< Parser >`

Returns a parser equivalent to `!rhs >> lit(c)`.

constexpr auto parsable_range_like `R &&` ``parser_interface`< Parser >`

Returns a parser equivalent to `!rhs >> lit(str)`.

constexpr auto `char` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) % rhs`.

constexpr auto `char32_t` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(c) % rhs`.

constexpr auto parsable_range_like `R &&` ``parser_interface`< Parser >`

Returns a parser equivalent to `lit(str) % rhs`.

bool parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState >

Constrained by `!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`.

I &
S
parser_interface
< Parser, GlobalState, ErrorHandler > const &
Attr &
trace
trace::off

Parses `[first, last)` using `parser`, and returns whether the parse was successful. On success, `attr` will be assigned the value of the attribute produced by `parser`. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

Constrained by `!detail::derived_from_parser_interface_v<std::remove_cvref_t<Attr>`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
Attr &
trace
trace::off

Parses `r` using `parser`, and returns whether the parse was successful. The entire input range `r` must be consumed for the parse to be considered successful. On success, `attr` will be assigned the value of the attribute produced by `parser`. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

auto parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I &` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` `tracetrace::off`

Parses `[first, last)` using `parser`. Returns a `std::optional` containing the attribute produced by `parser` on parse success, and `std::nullopt` on parse failure. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

auto parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
trace
trace::off

Parses `r` using `parser`. Returns a `std::optional` containing the attribute produced by `parser` on parse success, and `std::nullopt` on parse failure. The entire input range `r` must be consumed for the parse to be considered successful. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I &` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` ``parser_interface`< SkipParser > const &` `Attr &` `tracetrace::off`

Parses `[first, last)` using `parser`, skipping all input recognized by `skip` between the application of any two parsers, and returns whether the parse was successful. On success, `attr` will be assigned the value of the attribute produced by `parser`. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
Attr &
trace
trace::off

Parses `r` using `parser`, skipping all input recognized by `skip` between the application of any two parsers, and returns whether the parse was successful. The entire input range `r` must be consumed for the parse to be considered successful. On success, `attr` will be assigned the value of the attribute produced by `parser`. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

auto parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I &` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` ``parser_interface`< SkipParser > const &` `tracetrace::off`

Parses `[first, last)` using `parser`, skipping all input recognized by `skip` between the application of any two parsers. Returns a `std::optional` containing the attribute produced by `parser` on parse success, and `std::nullopt` on parse failure. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

auto parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
trace
trace::off

Parses `r` using `parser`, skipping all input recognized by `skip` between the application of any two parsers. Returns a `std::optional` containing the attribute produced by `parser` on parse success, and `std::nullopt` on parse failure. The entire input range `r` must be consumed for the parse to be considered successful. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I &` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` `Callbacks const &` `tracetrace::off`

Parses `[first, last)` using `parser`, and returns whether the parse was successful. When a callback rule `r` is successful during the parse, one of two things happens: 1) if `r` has an attribute, `callbacks(tag, x)` will be called (where `tag` is `decltype(r)::tag_type{}`, and `x` is the attribute produced by `r`); or 2) if `r` has no attribute, `callbacks(tag)` will be called. `Callbacks` is expected to be an invocable with the correct overloads required to support all successful rule parses that might occur. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
Callbacks const &
trace
trace::off

Parses `r` using `parser`, and returns whether the parse was successful. The entire input range `r` must be consumed for the parse to be considered successful. When a callback rule `r` is successful during the parse, one of two things happens: 1) if `r` has an attribute, `callbacks(tag, x)` will be called (where `tag` is `decltype(r)::tag_type{}`, and `x` is the attribute produced by `r`); or 2) if `r` has no attribute, `callbacks(tag)` will be called. `Callbacks` is expected to be an invocable with the correct overloads required to support all successful rule parses that might occur. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I &` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` ``parser_interface`< SkipParser > const &` `Callbacks const &` `tracetrace::off`

Parses `[first, last)` using `parser`, skipping all input recognized by `skip` between the application of any two parsers, and returns whether the parse was successful. When a callback rule `r` is successful during the parse, one of two things happens: 1) if `r` has an attribute, `callbacks(tag, x)` will be called (where `tag` is `decltype(r)::tag_type{}`, and `x` is the attribute produced by `r`); or 2) if `r` has no attribute, `callbacks(tag)` will be called. `Callbacks` is expected to be an invocable with the correct overloads required to support all successful rule parses that might occur. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

bool parsable_range

Constrained by `error_handler<ErrorHandler,std::ranges::iterator_t<decltype(subrange_of(r))>, std::ranges::sentinel_t<decltype(subrange_of(r))>, GlobalState>`, where `subrange_of` is an implementation detail that: creates subranges out of pointers; trims trailing zeros off of bounded arrays (such as string literals); and transcodes to UTF-32 if the input is non-`char`.

R const &
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
Callbacks const &
trace
trace::off

Parses `r` using `parser`, skipping all input recognized by `skip` between the application of any two parsers, and returns whether the parse was successful. The entire input range `r` must be consumed for the parse to be considered successful. When a callback rule `r` is successful during the parse, one of two things happens: 1) if `r` has an attribute, `callbacks(tag, x)` will be called (where `tag` is `decltype(r)::tag_type{}`, and `x` is the attribute produced by `r`); or 2) if `r` has no attribute, `callbacks(tag)` will be called. `Callbacks` is expected to be an invocable with the correct overloads required to support all successful rule parses that might occur. If `trace_mode == trace::on`, a verbose trace of the parse will be streamed to `std::cout`.

For each given token `t`, defines a pair of `parse_rule()` overloads, used internally within Boost.Parser. Each such pair implements the parsing behavior rule `t`, using the parser `t_def`. This implementation is in the form of a pair of function templates. You should therefore write this macro only at namespace scope.

Applies the given parser `p` of type `Parser` and an invocable `a` of type `Action`. `Action` shall model `semantic_action`, and `a` will only be invoked if `p` succeeds. The parse succeeds iff `p` succeeds. Produces no attribute.

Matches anything, consumes no input, and produces an attribute of type `RESOLVE(Attribute)`.

no_attribute
no_local_state
no_params

A type used to declare named parsing rules that support reporting of attributes via callback. The `TagType` template parameter is used to associate a particular `rule` with the `rule_parser` used during parsing.

void

Matches a single code point. If `AttributeType` is not `void`, `AttributeType` is the attribute type produced; otherwise, the attribute type is the decayed type of the matched code point. The parse fails only if the parser is constructed with a specific set of expected code point values that does not include the matched code point.

Matches a single code point that is equal to one of the code points associated with tag type `Tag`. This is used to create sets of characters for matching Unicode character classes like punctuation or lower case. Attribute type is the attribute type of the character being matched.

Matches a single code point that falls into one of the subranges of code points associated with tag type `Tag`. This is used to create sets of characters for matching Unicode character classes like hex digits or control characters. Attribute type is the attribute type of the character being matched.

Matches anything, and consumes no input. If `Predicate` is anything other than `detail::nope` (which it is by default), and `pred_(ctx)` evaluates to false, where `ctx` is the parser context, the parse fails.

bool

Applies the given parser `p` of type `Parser`, producing no attributes and consuming no input. The parse succeeds iff `p`'s success is unequal to `FailOnMatch`.

Matches a floating point number, producing an attribute of type `T`.

int 10
int 1
int -1
unspecified

Matches a signed number of radix `Radix`, of at least `MinDigits` and at most `MaxDigits`, producing an attribute of type `T`. Fails on any other input. The parse will also fail if `Expected` is anything but `detail::nope` (which it is by default), and the produced attribute is not equal to `expected_`. `Radix` must be one of `2`, `8`, `10`, or `16`.

Applies the given parser `p` of type `Parser`, disabling the current skipper in use, if any. The parse succeeds iff `p` succeeds. The attribute produced is the type of attribute produced by `Parser`.

Applies the given parser `p` of type `Parser`, enabling case-insensitive matching, based on Unicode case folding. The parse succeeds iff `p` succeeds. The attribute produced is the type of attribute produced by `Parser`.

Applies the given parser `p` of type `Parser`. This parser produces no attribute, and suppresses the production of any attributes that would otherwise be produced by `p`. The parse succeeds iff `p` succeeds.

Applies the given parser `p` of type `Parser`; regardless of the attribute produced by `Parser`, this parser's attribute is equivalent to `_where(ctx)` within a semantic action on `p`. The parse succeeds iff `p` succeeds.

unspecified
int64_t
int64_t

Repeats the application of another parser `p` of type `Parser`, optionally applying another parser `d` of type `DelimiterParser` in between each pair of applications of `p`. The parse succeeds if `p` succeeds at least the minumum number of times, and `d` succeeds each time it is applied. The attribute produced is a sequence of the type of attribute produced by `Parser`.

no_attribute
no_local_state
no_params

A type used to declare named parsing rules. The `TagType` template parameter is used to associate a particular `rule` with the `rule_parser` used during parsing.

bool

Applies another parser `p`, associated with this parser via `TagType`. The attribute produced is `Attribute`. Both a default-constructed object of type `LocalState`, and a default-constructed object of type `ParamsTuple`, are added to the parse context before the associated parser is applied. The parse succeeds iff `p` succeeds. If `CanUseCallbacks` is `true`, and if this parser is used within a call to `callback_parse()`, the attribute is produced via callback; otherwise, the attribute is produced as normal (as a return value, or as an out-param). The rule may be constructed with user-friendly diagnostic text that will appear if the top-level parse is executed with `trace_mode == boost::parser::trace::on`.

Applies each parser in `ParserTuple`, in order. The parse succeeds iff all of the sub-parsers succeed. The attribute produced is a `std::tuple` over the types of attribute produced by the parsers in `ParserTuple`. The BacktrackingTuple template parameter is a `parser::tuple` of `std::bool_constant` values. The `i`th such value indicates whether backtracking is allowed if the `i`th parser fails.

unspecified

Applies the given parser `p` of type `Parser`, using a parser of type `SkipParser` as the skipper. The parse succeeds iff `p` succeeds. The attribute produced is the type of attribute produced by `Parser`.

A tag type that can be passed as the first parameter to `char_()` when the second parameter is a sorted, random access sequence that can be matched using a binary search.

Matches a particular string, delimited by an iterator sentinel pair; produces no attribute.

Applies the given parser `p` of type `Parser`. Regardless of the attribute produced by `Parser`, this parser's attribute is equivalent to `std::basic_string_view<char_type>` within a semantic action on `p`, where `char_type` is the type of character in the sequence being parsed. If the parsed range is transcoded, `char_type` will be the type being transcoded from. If the underlying range of `char_type` is non-contiguous, code using `string_view_parser` is ill-formed. The parse succeeds iff `p` succeeds. This parser is only available in C++20 and later.

unspecified

Applies at most one of the parsers in `OrParser`. If `switch_value_` matches one or more of the values in the parsers in `OrParser`, the first such parser is applied, and the success or failure and attribute of the parse are those of the applied parser. Otherwise, the parse fails.

Matches one of a set S of possible inputs, each of which is associated with an attribute value of type `T`, forming a symbol table. New elements and their associated attributes may be added to or removed from S dynamically, during parsing; any such changes are reverted at the end of parsing. The parse succeeds iff an element of S is matched.

# See Also:

`symbols`

Applies the given parser `p` of type `Parser`. The attribute produced by `p` is passed to the fiven invocable `f` of type `F`. `f` will only be invoked if `p` succeeds and sttributes are currently being generated. The parse succeeds iff `p` succeeds. The attribute produced is the the result of the call to `f`.

int 10
int 1
int -1
unspecified

Matches an unsigned number of radix `Radix`, of at least `MinDigits` and at most `MaxDigits`, producing an attribute of type `T`. Fails on any other input. The parse will also fail if `Expected` is anything but `detail::nope` (which it is by default), and the produced attribute is not equal to `expected_`. `Radix` must be in `[2, 36]`.

bool
bool

Matches an end-of-line (`NewlinesOnly == true`), whitespace (`NewlinesOnly == false`), or (`NoNewlines == true`) blank (whitespace but not newline) code point, based on the Unicode definitions of each (also matches the two code points `"\r\n"`). Produces no attribute.

A sentinel type that compares equal to a pointer to a character value type, iff the pointer is null.

unspecified

An alias for `typename attribute<R, Parser>::type`.

typename `attribute`< R, Parser >::type
unspecified
unspecified
unspecified
constexpr bool

A variable template that indicates that type `T` is an optional-like type.

constexpr bool

A variable template that indicates that type `T` is an variant-like type.

constexpr `sorted_t`
constexpr auto `CharT *`

Produces a `subrange` comprising the given pointer and `null_sentinel`. This should be used to make Null-Terminated Byte Strings ("NTBSs") compatible with ranges.

decltype(auto) `Context const &`

Returns a reference to the attribute(s) (i.e. return value) of the bottommost parser; multiple attributes will be stored within a `parser::tuple`. You may write to this value in a semantic action to control what attribute value(s) the associated parser produces. Returns `none` if the bottommost parser does produce an attribute.

decltype(auto) `Context const &`

Returns a reference to the attribute or attributes already produced by the bottommost parser; multiple attributes will be stored within a `parser::tuple`. Returns `none` if the bottommost parser does produce an attribute.

decltype(auto) `Context const &`

Returns a `subrange` that describes the matched range of the bottommost parser.

decltype(auto) `Context const &`

Returns an iterator to the beginning of the entire sequence being parsed. The effect of calling this within a semantic action associated with a skip-parser is undefined

decltype(auto) `Context const &`

Returns an iterator to the end of the entire sequence being parsed.

decltype(auto) `Context const &`

Returns a reference to a `bool` that represents the success or failure of the bottommost parser. You can assign `false` to this within a semantic action to force a parser to fail its parse.

decltype(auto) `Context const &`

Returns a reference to one or more local values that the bottommost rule is declared to have; multiple values will be stored within a `parser::tuple`. Returns `none` if there is no bottommost rule, or if that rule has no locals.

decltype(auto) `Context const &`

Returns a reference to one or more parameters passed to the bottommost rule `r`, by using `r` as `r.with(param0, param1, ... paramN)`; multiple values will be stored within a `parser::tuple`. Returns `none` if there is no bottommost rule, or if that rule was not given any parameters.

decltype(auto) `Context const &`

Returns a reference to the globals object associated with the top-level parser. Returns `none` if there is no associated globals object.

decltype(auto) `Context const &`

Returns a reference to the error handler object associated with the top-level parser. Returns `none` if there is no associated error handler.

void std::forward_iterator `Context const &` `std::string_view` `I`

Report that the error described in `message` occurred at `location`, using the context's error handler.

void `Context const &` `std::string_view`

Report that the error described in `message` occurred at `_where(context).begin()`, using the context's error handler.

void std::forward_iterator `Context const &` `std::string_view` `I`

Report that the warning described in `message` occurred at `location`, using the context's error handler.

void `Context const &` `std::string_view`

Report that the warning described in `message` occurred at `_where(context).begin()`, using the context's error handler.

std::ranges::viewable_range
std::ranges::viewable_range

Produces a range of subranges of a given range `base`. Each subrange is either a subrange of `base` that does not match the given parser `parser`, or is the given replacement for a match, `replacement`.

In addition to the template parameter constraints, `V` and `ReplacementV` must be ranges of `char`, or must have the same UTF format, and `V` and `ReplacementV` must meet the same compatibility requirements as described in `std::ranges::join_view`.

bool
unspecified
unspecified
unspecified
BOOST_PARSER_SUBRANGE< ref_t_iter >
unspecified
unspecified
constexpr `iterator` &
constexpr reference_type
bool
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
ReplacementV
trace
trace::off
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
ReplacementV
trace
trace::off
constexpr V
constexpr V
constexpr V
constexpr V
constexpr auto
constexpr auto
constexpr auto
constexpr auto
unspecified

A range adaptor object ([range.adaptor.object]). Given subexpressions `E` and `P`, `Q`, `R`, and 'S', each of the expressions `replace(E, P)`, `replace(E, P, Q)`. `replace(E, P, Q, R)`, and `replace(E, P, Q, R, S)` are expression-equivalent to `replace_view(E, P)`, `replace_view(E, P, Q)`, `replace_view(E, P, Q, R)`, `replace_view(E, P, Q, R, S)`, respectively.

V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
ReplacementV &&
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
ReplacementV &&
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
ReplacementV &&
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
ReplacementV &&
std::ranges::viewable_range

Produces a sequence of subranges of the underlying sequence of type `V`. Each subrange is a nonoverlapping match of the given parser, using a skip-parser if provided.

bool
unspecified
unspecified
unspecified
unspecified
constexpr `iterator` &
constexpr BOOST_PARSER_SUBRANGE< I >
bool
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
trace
trace::off
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
trace
trace::off
constexpr V
constexpr V
constexpr auto
constexpr auto
constexpr auto
constexpr auto
unspecified

A range adaptor object ([range.adaptor.object]). Given subexpressions `E` and `P`, `Q`, and `R`, each of the expressions `search_all(E, P)`, `search_all(E, P, Q)`, and `search_all(E, P, Q, R)` are expression-equivalent to `search_all_view(E, P)`, `search_all_view(E, P, Q)`, and `search_all_view(E, P, Q, R)`, respectively.

auto parsable_range `R &&` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` ``parser_interface`< SkipParser > const &` `tracetrace::off`

Returns a subrange to the first match for parser `parser` in `r`, using skip-parser `skip`. This function has a similar interface and semantics to `std::ranges::search()`. Returns `std::ranges::dangling` in C++20 and later if `r` is a non-borrowable rvalue.

auto parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` ``parser_interface`< SkipParser > const &` `tracetrace::off`

Returns a subrange to the first match for parser `parser` in `[first, last)`, using skip-parser `skip`. This function has a similar interface and semantics to `std::ranges::search()`.

auto parsable_range `R &&` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` `tracetrace::off`

Returns a subrange to the first match for parser `parser` in `r`. This function has a similar interface and semantics to `std::ranges::search()`. Returns `std::ranges::dangling` in C++20 and later if `r` is a non-borrowable rvalue.

auto parsable_iter std::sentinel_for< I > error_handler< I, S, GlobalState > `I` `S` ``parser_interface`< Parser, GlobalState, ErrorHandler > const &` `tracetrace::off`

Returns a subrange to the first match for parser `parser` in `[first, last)`. This function has a similar interface and semantics to `std::ranges::search()`.

V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
std::ranges::viewable_range

Produces a sequence of subranges of the underlying sequence of type `V`. the underlying sequence is split into subranges delimited by matches of the given parser, possibly using a given skip-parser.

bool
unspecified
unspecified
unspecified
unspecified
constexpr `iterator` &
constexpr BOOST_PARSER_SUBRANGE< I >
bool
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
trace
trace::off
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
trace
trace::off
constexpr V
constexpr V
constexpr auto
constexpr auto
constexpr auto
constexpr auto
unspecified

A range adaptor object ([range.adaptor.object]). Given subexpressions `E` and `P`, `Q`, and `R`, each of the expressions `split(E, P)`, `split(E, P, Q)`, and `split(E, P, Q, R)` are expression-equivalent to `split_view(E, P)`, `split_view(E, P, Q)`, and `split_view(E, P, Q, R)`, respectively.

V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
std::forward_iterator
std::sentinel_for< I > I

A simple view type used throughout the rest of the library in C++17 builds; similar to `std::ranges::subrange`.

I
S
R const &
constexpr I
constexpr S
constexpr `subrange` `std::ptrdiff_t1`
constexpr `subrange` `std::ptrdiff_t1`
constexpr `subrange` & `std::ptrdiff_t`
constexpr std::enable_if_t< std::is_convertible<I, I2>::value && std::is_convertible<S, S2>::value>
constexpr `subrange`< I, S > std::forward_iterator std::sentinel_for< I >I `I` `S`

Makes a `subrange<I, S>` from an `I` and an `S`.

unspecified

Constrained by `std::ranges::view<V>`. Additionally, the value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or `char32_t`.

A view that produces UTF-16 from an given sequence of UTF.

V
unspecified

Constrained by `std::ranges::view<V>`. Additionally, the value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or `char32_t`.

A view that produces UTF-32 from an given sequence of UTF.

V
unspecified

Constrained by `std::ranges::view<V>`. Additionally, the value type of `V` must be `char`, `wchar_t`, `char8_t`, `char16_t`, or `char32_t`.

A view that produces UTF-8 from an given sequence of UTF.

V
unspecified
constexpr auto

A view adaptor that produces a `utf8_view` of the given view.

constexpr auto

A view adaptor that produces a `utf16_view` of the given view.

constexpr auto

A view adaptor that produces a `utf32_view` of the given view.

std::ranges::viewable_range
std::move_constructible

Produces a range of subranges of a given range `base`. Each subrange is either a subrange of `base` that does not match the given parser `parser`, or is `f(*boost::parser::parse(match, parser))`, where `f` is the given invocable and `match` is the matching subrange.

In addition to the template parameter constraints, `F` must be invocable with the attribute type of `Parser`; `V` and the range type produced by `F`, "`Rf`" must be ranges of `char`, or must have the same UTF format; and `V` and `Rf` must meet the same compatibility requirements as described in `std::ranges::join_view`.

bool
unspecified
unspecified
unspecified
BOOST_PARSER_SUBRANGE< ref_t_iter >
unspecified
unspecified
constexpr `iterator` &
constexpr reference_type
bool
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
parser_interface
< SkipParser > const &
F
trace
trace::off
V
parser_interface
< Parser, GlobalState, ErrorHandler > const &
F
trace
trace::off
constexpr V
constexpr V
constexpr F const &
constexpr auto
constexpr auto
constexpr auto
constexpr auto
unspecified

A range adaptor object ([range.adaptor.object]). Given subexpressions `E` and `P`, `Q`, `R`, and 'S', each of the expressions `replace(E, P)`, `replace(E, P, Q)`. `replace(E, P, Q, R)`, and `replace(E, P, Q, R, S)` are expression-equivalent to `replace_view(E, P)`, `replace_view(E, P, Q)`, `replace_view(E, P, Q, R)`, `replace_view(E, P, Q, R, S)`, respectively.

V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
F &&
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
parser_interface
< SkipParser >
F &&
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
F &&
trace
V &&
parser_interface
< Parser, GlobalState, ErrorHandler >
F &&
constexpr auto char...

A literal that can be used to concisely name `parser::llong` integral constants.

The tuple template alias used within Boost.Parser. This will be `boost::hana::tuple` if `BOOST_PARSER_USE_HANA_TUPLE` is defined, and `std::tuple` otherwise.

hana::tuple< Args... >

A template alias that is `boost::hana::integral_constant<T, I>` if `BOOST_PARSER_USE_HANA_TUPLE` is defined, and `std::integral_constant<T, I>` otherwise.

hana::integral_constant< T, I >

A template alias that is `boost::hana::llong<I>` if `BOOST_PARSER_USE_HANA_TUPLE` is defined, and `std::integral_constant<long long, I>` otherwise.

integral_constant< long long, I >
constexpr decltype(auto) U `T &&` `integral_constant< U, I >`

An accessor that returns a reference to the `I`-th data member of an aggregate struct or `boost::parser::tuple`.