| 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 | //////////////////////////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected