| 592 | } |
| 593 | |
| 594 | void fxParseJSONValue(txMachine* the, txJSONParser* theParser) |
| 595 | { |
| 596 | if (theParser->token == XS_JSON_TOKEN_LEFT_BRACE) |
| 597 | fxParseJSONObject(the, theParser); |
| 598 | else if (theParser->token == XS_JSON_TOKEN_LEFT_BRACKET) |
| 599 | fxParseJSONArray(the, theParser); |
| 600 | else { |
| 601 | switch (theParser->token) { |
| 602 | case XS_JSON_TOKEN_FALSE: |
| 603 | mxPushBoolean(0); |
| 604 | break; |
| 605 | case XS_JSON_TOKEN_TRUE: |
| 606 | mxPushBoolean(1); |
| 607 | break; |
| 608 | case XS_JSON_TOKEN_NULL: |
| 609 | mxPushNull(); |
| 610 | break; |
| 611 | case XS_JSON_TOKEN_INTEGER: |
| 612 | mxPushInteger(theParser->integer); |
| 613 | break; |
| 614 | case XS_JSON_TOKEN_NUMBER: |
| 615 | mxPushNumber(theParser->number); |
| 616 | break; |
| 617 | case XS_JSON_TOKEN_STRING: |
| 618 | mxPushString(theParser->string->value.string); |
| 619 | break; |
| 620 | default: |
| 621 | mxPushUndefined(); |
| 622 | mxSyntaxError("%ld: invalid value", theParser->line); |
| 623 | break; |
| 624 | } |
| 625 | if (theParser->sourceFlag) { |
| 626 | txSlot* value = the->stack; |
| 627 | txSlot* list; |
| 628 | txSlot* slot; |
| 629 | mxPushList(); |
| 630 | list = the->stack; |
| 631 | slot = list->value.list.first = fxNewSlot(the); |
| 632 | slot->kind = XS_DATA_VIEW_KIND; |
| 633 | slot->value.dataView.offset = theParser->sourceOffset; |
| 634 | slot->value.dataView.size = theParser->sourceSize; |
| 635 | slot = slot->next = list->value.list.last = fxNewSlot(the); |
| 636 | slot->kind = value->kind; |
| 637 | slot->value = value->value; |
| 638 | } |
| 639 | fxParseJSONToken(the, theParser); |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | void fxReviveJSON(txMachine* the, txJSONParser* theParser, txSlot* reviver) |
| 644 | { |
no test coverage detected