4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::parse::basic_char_set< Ch > Class Template Reference

Detailed Description

template<typename Ch>
class fcppt::parse::basic_char_set< Ch >

Parses a set of characters and returns which one has matched.

For the character set S, this parser returns c if c is the next input character and c is in S. Otherwise, an error is returned.

Note that instead of using basic_char_set{c_1,...,c_n}, one could also use P = basic_char{c_1} | ... | basic_char{c_n}. However, basic_char_set is more efficient, since it looks up the next character in a hash map, whereas P would first try to match against c_1, then c_2, and so on.

Inheritance diagram for fcppt::parse::basic_char_set< Ch >:
fcppt::parse::tag

Public Types

using char_set_type = fcppt::parse::basic_char_set_container<Ch>
 
using result_type = Ch
 

Public Member Functions

 basic_char_set (std::initializer_list< Ch > const &)
 
 basic_char_set (char_set_type &&)
 
template<typename Skipper >
fcppt::parse::result< Ch, result_typeparse (fcppt::reference< fcppt::parse::basic_stream< Ch > >, Skipper const &) const
 
char_set_type const & chars () const
 

Member Typedef Documentation

◆ char_set_type

template<typename Ch >
using fcppt::parse::basic_char_set< Ch >::char_set_type = fcppt::parse::basic_char_set_container<Ch>

◆ result_type

template<typename Ch >
using fcppt::parse::basic_char_set< Ch >::result_type = Ch

Constructor & Destructor Documentation

◆ basic_char_set() [1/2]

template<typename Ch >
fcppt::parse::basic_char_set< Ch >::basic_char_set ( std::initializer_list< Ch > const & )

◆ basic_char_set() [2/2]

template<typename Ch >
fcppt::parse::basic_char_set< Ch >::basic_char_set ( char_set_type && )
explicit

Member Function Documentation

◆ chars()

template<typename Ch >
char_set_type const & fcppt::parse::basic_char_set< Ch >::chars ( ) const
nodiscard

◆ parse()

template<typename Ch >
template<typename Skipper >
fcppt::parse::result< Ch, result_type > fcppt::parse::basic_char_set< Ch >::parse ( fcppt::reference< fcppt::parse::basic_stream< Ch > > ,
Skipper const &  ) const
nodiscard