19 using namespace fhicl;
22 using boost::lexical_cast;
23 using boost::numeric_cast;
67 if( result.size() >= 2 && result[0] ==
'\"' && result.end()[-1] ==
'\"' )
89 bool is_quoted = value.size() >= 2 && value[0] == value.end()[-1] &&
90 (value[0] ==
'\"' || value[0] ==
'\'');
98 << str <<
"\nat or before:\n" 132 if (result.size() > 6) {
133 std::size_t sz = result.size() - 1;
134 result.insert(1,
".");
145 result.insert(0,
"-");
152 if (value == std::numeric_limits<ldbl>::infinity())
154 if (value == -std::numeric_limits<ldbl>::infinity())
157 std::intmax_t chopped =
static_cast<std::intmax_t
>(
value);
158 if (static_cast<ldbl>(chopped) ==
value)
175 if (result.size() >= 2 && result[0] ==
'\"' && result.end()[-1] ==
'\"')
201 << str <<
"\nat or before:\n" 205 atom_t
const& atom =
atom_t(xval);
226 << str <<
"\nat or before:\n" 230 atom_t
const& atom =
atom_t(xval);
231 ldbl via = lexical_cast<
ldbl>(atom);
232 result = numeric_cast<std::uintmax_t>(via);
233 if (via !=
ldbl(result))
234 throw std::range_error(
"narrowing conversion");
247 << str <<
"\nat or before:\n" 251 atom_t
const& atom =
atom_t(xval);
252 ldbl via = lexical_cast<
ldbl>(atom);
253 result = numeric_cast<std::intmax_t>(via);
254 if (via !=
ldbl(result))
255 throw std::range_error(
"narrowing conversion");
268 << str <<
"\nat or before:\n" 272 atom_t
const& atom =
atom_t(xval);
276 result = +std::numeric_limits<ldbl>::infinity();
279 result = -std::numeric_limits<ldbl>::infinity();
283 result = lexical_cast<
ldbl>(atom);
296 << str <<
"\nat or before:\n" 300 complex_t
const& cmplx =
complex_t(xval);
302 decode(cmplx.first, real);
303 decode(cmplx.second, imag);
304 result = std::complex<ldbl>(real, imag);
intermediate_table::complex_t complex_t
static ParameterSetID const & put(ParameterSet const &ps)
bool parse_value_string(std::string const &s, extended_value &v, std::string &unparsed)
bool canonical_number(std::string const &value, std::string &result)
bool is_a(value_tag const t) const noexcept
ps_atom_t encode(std::string const &)
static ps_atom_t literal_false()
static collection_type const & get() noexcept
std::pair< std::string, std::string > complex_t
void decode(std::any const &, std::string &)
std::string unescape(std::string const &str)
static ps_atom_t literal_true()
bool is_nil(std::any const &val)
static std::string canon_nil()
static ps_atom_t literal_infinity()
intermediate_table::atom_t atom_t
static void atom_rep(any const &a, std::string &result)
bool is_table(std::any const &val)
cet::coded_exception< error, detail::translate > exception
bool is_sequence(std::any const &val)