| 528 | // ---- scan tuple: {"_0":val, "_1":val, ...} ---- |
| 529 | |
| 530 | bool scanTuple(char * dst, TypeInfo * ti) { |
| 531 | if (!expect('{')) return false; |
| 532 | if (peek() == '}') { cur++; return true; } |
| 533 | while (true) { |
| 534 | string key; |
| 535 | if (!readString(key)) return false; |
| 536 | if (!expect(':')) return false; |
| 537 | // key is "_0", "_1", etc. |
| 538 | int idx = -1; |
| 539 | if (key.length() >= 2 && key[0] == '_') { |
| 540 | idx = atoi(key.c_str() + 1); |
| 541 | } |
| 542 | if (idx >= 0 && uint32_t(idx) < ti->argCount) { |
| 543 | int offset = getTupleFieldOffset(ti, idx); |
| 544 | if (!scanValue(dst + offset, ti->argTypes[idx])) return false; |
| 545 | } else { |
| 546 | if (!skipValue()) return false; |
| 547 | } |
| 548 | skipWS(); |
| 549 | if (cur >= end) return false; |
| 550 | if (*cur == '}') { cur++; return true; } |
| 551 | if (*cur != ',') return false; |
| 552 | cur++; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | // ---- scan variant: {"fieldName":val} (single key) ---- |
| 557 |
nothing calls this directly
no test coverage detected