LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
fhicl::uint_parser Struct Reference

#include "tokens.h"

Inheritance diagram for fhicl::uint_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 165 of file tokens.h.

Member Function Documentation

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

Definition at line 178 of file tokens.h.

References fhicl::maximally_munched_number().

183  {
184  boost::spirit::qi::skip_over(first, last, skipper);
185 
186  Iterator it = first;
187  while (it != last && std::isdigit(*it))
188  ++it;
189  Attribute result(first, it);
190 
191  if (result.empty())
192  return false;
193 
194  if (it != last && !maximally_munched_number(*it))
195  return false;
196 
197  for (std::size_t ndig = result.size(); ndig > 1 && result[0] == '0';
198  --ndig)
199  result.erase(0, 1);
200 
201  first = it;
202  boost::spirit::traits::assign_to(result, attr);
203  return true;
204  }
bool maximally_munched_number(char const ch)
Definition: tokens.h:35
template<typename Context >
boost::spirit::info fhicl::uint_parser::what ( Context &  ) const
inline

Definition at line 209 of file tokens.h.

210  {
211  return boost::spirit::info{"fhicl::uint"};
212  }

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