MCPcopy Create free account
hub / github.com/catboost/catboost / ReadNumeric

Method ReadNumeric

library/cpp/yson/parser_detail.h:274–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273 template <bool AllowFinish>
274 void ReadNumeric() {
275 TStringBuf valueBuffer;
276 ENumericResult numericResult = TBase::template ReadNumeric<AllowFinish>(&valueBuffer);
277
278 if (numericResult == ENumericResult::Double) {
279 double value;
280 try {
281 value = FromString<double>(valueBuffer);
282 } catch (yexception& e) {
283 // This exception is wrapped in parser.
284 ythrow TYsonException() << "Failed to parse double literal '" << valueBuffer << "'" << e;
285 }
286 Consumer->OnDoubleScalar(value);
287 } else if (numericResult == ENumericResult::Int64) {
288 i64 value;
289 try {
290 value = FromString<i64>(valueBuffer);
291 } catch (yexception& e) {
292 // This exception is wrapped in parser.
293 ythrow TYsonException() << "Failed to parse int64 literal '" << valueBuffer << "'" << e;
294 }
295 Consumer->OnInt64Scalar(value);
296 } else if (numericResult == ENumericResult::Uint64) {
297 ui64 value;
298 try {
299 value = FromString<ui64>(valueBuffer.SubStr(0, valueBuffer.size() - 1));
300 } catch (yexception& e) {
301 // This exception is wrapped in parser.
302 ythrow TYsonException() << "Failed to parse uint64 literal '" << valueBuffer << "'" << e;
303 }
304 Consumer->OnUint64Scalar(value);
305 }
306 }
307 };
308
309 ////////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 5

OnDoubleScalarMethod · 0.45
OnInt64ScalarMethod · 0.45
SubStrMethod · 0.45
sizeMethod · 0.45
OnUint64ScalarMethod · 0.45

Tested by

no test coverage detected