Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Struct template or_parser

boost::parser::or_parser

Synopsis

// In header: <boost/parser/parser.hpp>

template<typename ParserTuple> 
struct or_parser {

  // public member functions
  or_parser(ParserTuple);
  template<typename Iter, typename Sentinel, typename Context, 
           typename SkipParser> 
    auto call(Iter &, Sentinel, Context const &, SkipParser const &, 
              unspecified, bool &) const;
  template<typename Iter, typename Sentinel, typename Context, 
           typename SkipParser, typename Attribute> 
    void call(Iter &, Sentinel, Context const &, SkipParser const &, 
              unspecified, bool &, Attribute &) const;

  // public data members
  ParserTuple parsers_;
};

Description

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.

or_parser public member functions

  1. or_parser(ParserTuple parsers);
  2. template<typename Iter, typename Sentinel, typename Context, 
             typename SkipParser> 
      auto call(Iter & first, Sentinel last, Context const & context, 
                SkipParser const & skip, unspecified flags, bool & success) const;
  3. template<typename Iter, typename Sentinel, typename Context, 
             typename SkipParser, typename Attribute> 
      void call(Iter & first, Sentinel last, Context const & context, 
                SkipParser const & skip, unspecified flags, bool & success, 
                Attribute & retval) const;

PrevUpHomeNext