Classes | Public Member Functions | List of all members
fhicl::real_parser Struct Reference

#include <tokens.h>

Inheritance diagram for fhicl::real_parser:

Classes

struct  attribute
 

Public Member Functions

template<typename Iterator , typename Context , typename Skipper , typename Attribute >
bool parse (Iterator &first, Iterator const &last, Context &, Skipper const &skipper, Attribute &attr) const
 
template<typename Context >
boost::spirit::info what (Context &) const
 

Detailed Description

Definition at line 105 of file tokens.h.

Member Function Documentation

template<typename Iterator , typename Context , typename Skipper , typename Attribute >
bool fhicl::real_parser::parse ( Iterator &  first,
Iterator const &  last,
Context &  ,
Skipper const &  skipper,
Attribute &  attr 
) const
inline

Definition at line 118 of file tokens.h.

123  {
124  boost::spirit::qi::skip_over(first, last, skipper);
125 
126  static std::string const allowed{"0123456789.-+eE"};
127  Iterator it = first;
128  while (it != last && allowed.find(*it) != std::string::npos)
129  ++it;
130 
131  if (it != last && !maximally_munched_number(*it))
132  return false;
133 
134  Attribute raw(first, it);
135  if (raw.empty())
136  return false;
137 
138  Attribute result;
139  if (!cet::canonical_number(raw, result))
140  return false;
141 
142  first = it;
143  boost::spirit::traits::assign_to(result, attr);
144  return true;
145  }
bool canonical_number(std::string const &value, std::string &result)
static QCString result
std::string string
Definition: nybbler.cc:12
Raw data description.
bool maximally_munched_number(char const ch)
Definition: tokens.h:35
template<typename Context >
boost::spirit::info fhicl::real_parser::what ( Context &  ) const
inline

Definition at line 150 of file tokens.h.

151  {
152  return boost::spirit::info{"fhicl::real"};
153  }

The documentation for this struct was generated from the following file: