Go to the documentation of this file.
4 #ifndef LEXY_DSL_CONTEXT_IDENTIFIER_HPP_INCLUDED
5 #define LEXY_DSL_CONTEXT_IDENTIFIER_HPP_INCLUDED
17 return "different identifier";
24 template <
typename Id,
typename Reader>
27 template <
typename Id>
30 template <
typename NextParser>
33 template <
typename Context,
typename Reader,
typename... Args>
45 template <
typename Id,
typename Identifier>
48 template <
typename NextParser>
51 template <
typename Context,
typename Reader,
typename... Args>
59 template <
typename Reader>
61 template <
typename NextParser>
65 template <
typename Id,
typename Identifier,
typename Tag>
71 using _pattern = decltype(Identifier{}.pattern());
73 template <
typename Reader>
76 typename Reader::marker
end;
78 template <
typename ControlBlock>
79 constexpr
bool try_parse(
const ControlBlock* cb,
const Reader& reader)
83 if (!parser.try_parse(reader))
92 template <
typename Context>
96 template <
typename NextParser,
typename Context,
typename... Args>
108 template <
typename NextParser>
111 template <
typename... PrevArgs>
114 template <
typename Context,
typename Reader>
134 template <
typename Context,
typename Reader,
typename... Args>
143 template <
typename Error>
150 template <
typename Id,
typename Identifier>
170 template <
typename Id,
typename Leading,
typename Trailing,
typename... Reserved>
177 #endif // LEXY_DSL_CONTEXT_IDENTIFIER_HPP_INCLUDED
constexpr auto create() const
static constexpr T & get(const ControlBlock *cb)
static constexpr _ctx_irem< Id, Identifier, Error > error
lexy::parser_for< Identifier, _pc< NextParser > > p
std::conditional_t< std::is_void_v< T >, Fallback, T > type_or
constexpr void cancel(Context &)
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, PrevArgs &&... args, lexy::lexeme< Reader > lexeme)
LEXY_PARSER_FUNC bool finish(Context &context, Reader &reader, Args &&... args)
constexpr auto parse(const Input &input, const ErrorCallback &callback)
Parses the production into a value, invoking the callback on error.
constexpr bool try_parse(const ControlBlock *cb, const Reader &reader)
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
static LEXY_CONSTEVAL auto name()
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
constexpr void link(Context &context)
decltype(Identifier{}.pattern()) _pattern
constexpr auto context_identifier(_id< Leading, Trailing, Reserved... >)
Declares a context variable that stores one instance of the given identifier.
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
A branch parser that parses a branch rule but with a special continuation.
lexeme(const Reader &, typename Reader::iterator) -> lexeme< typename Reader::canonical_reader >
typename Rule::template p< NextParser > parser_for
constexpr auto capture() const
constexpr auto rematch() const
constexpr bool equal_lexemes(lexeme< Reader > lhs, lexeme< Reader > rhs)
static LEXY_PARSER_FUNC bool parse(Context &context, Reader &reader, Args &&... args)
typename TokenRule::template tp< Reader > token_parser_for