|
| template<typename Left , typename Right > |
| constexpr auto | operator>> (Left &&left, Right &&right) noexcept |
| | The sequence parser combinator. More...
|
| |
| template<typename Left , typename Right > |
| constexpr auto | operator| (Left &&left, Right &&right) noexcept |
| | The alternate parser combinator. More...
|
| |
| template<typename Parser > |
| constexpr bool | parse (std::string_view input, Parser const &parser, Skipper &skipper=skws) noexcept |
| | The parse function. More...
|
| |
| template<typename Parser > |
| constexpr bool | parse_ref (std::string_view &input, Parser const &parser, Skipper &skipper=skws) noexcept |
| | The parse function that takes input by reference. More...
|
| |
|
| static auto | alnum_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isalnum(ch); }) |
| | Single character parser based on std::isalnum. More...
|
| |
| static auto | alpha_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isalpha(ch); }) |
| | Single character parser based on std::isalpha. More...
|
| |
| static auto | lower_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::islower(ch); }) |
| | Single character parser based on std::islower. More...
|
| |
| static auto | upper_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isupper(ch); }) |
| | Single character parser based on std::isupper. More...
|
| |
| static auto | digit_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isdigit(ch); }) |
| | Single character parser based on std::isdigit. More...
|
| |
| static auto | xdigit_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isxdigit(ch); }) |
| | Single character parser based on std::xdigit. More...
|
| |
| static auto | cntrl_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::iscntrl(ch); }) |
| | Single character parser based on std::cntrl. More...
|
| |
| static auto | graph_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isgraph(ch); }) |
| | Single character parser based on std::graph. More...
|
| |
| static auto | space_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isspace(ch); }) |
| | Single character parser based on std::space. More...
|
| |
| static auto | blank_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isblank(ch); }) |
| | Single character parser based on std::blank. More...
|
| |
| static auto | print_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::isprint(ch); }) |
| | Single character parser based on std::print. More...
|
| |
| static auto | punct_ = char_if_([](char const ch) noexcept -> bool { return 0 != std::ispunct(ch); }) |
| | Single character parser based on std::punct. More...
|
| |
| static constexpr auto | end_ = impl::endtype_() |
| | End of input parser. More...
|
| |
| static constexpr auto | empty_ = impl::emptytype_() |
| | Empty parser. More...
|
| |
The namesapce for all Limn types, functions, and variables.
template<typename Left , typename Right >
| constexpr auto lm::operator>> |
( |
Left && |
left, |
|
|
Right && |
right |
|
) |
| |
|
inlinenoexcept |
The sequence parser combinator.
This function combines two parsers in sequence. For example, lm::lit_("Hello") >> lm::lit_("World") parses "HelloWorld" using two literal parsers combined in sequence.
If this first parser in a sequence fails, then the second parser is never evaluated.
This operator is found using ADL.
- Parameters
-
| [in] | left | The first parser to evaluate. |
| [in] | right | The second parser to evaluate. Only evaluated if the first parser succeeded. |
template<typename Left , typename Right >
| constexpr auto lm::operator| |
( |
Left && |
left, |
|
|
Right && |
right |
|
) |
| |
|
inlinenoexcept |
The alternate parser combinator.
This function combines two parsers as alternatives. For example, lm::lit_("Hello") | lm::lit_("World") parses "Hello" or "World" using two literal parsers.
If this first parser in a sequence fails, then the second parser is evaluated. If the first parser succeeds, then the second parser is never evaluated. This is analogous to "short circuiting" of ||.
This operator is found using ADL.
- Parameters
-
| [in] | left | The first parser to evaluate. If true, then the combined parse succeeds. |
| [in] | right | The second parser to evaluate. Only evaluated if the first parser failed. |
template<typename Parser >
| constexpr bool lm::parse_ref |
( |
std::string_view & |
input, |
|
|
Parser const & |
parser, |
|
|
Skipper & |
skipper = skws |
|
) |
| |
|
noexcept |
The parse function that takes input by reference.
This function is useful for recursive grammars. For an example, see tests.cpp or README.md.
Prefer to use lm::parse().
- Parameters
-
| [in,out] | input | The input string to parse |
| [in] | parser | The parser to evaluate on input |
- Returns
- true if the parser matched the input or false otherwise