| 733 | } |
| 734 | |
| 735 | void fx_JSON_rawJSON(txMachine* the) |
| 736 | { |
| 737 | txSlot* slot; |
| 738 | txString string; |
| 739 | txSize length; |
| 740 | txSlot* instance; |
| 741 | txSlot* property; |
| 742 | volatile txJSONParser aParser = {0}; |
| 743 | if (mxArgc > 0) |
| 744 | mxPushSlot(mxArgv(0)); |
| 745 | else |
| 746 | mxPushUndefined(); |
| 747 | slot = the->stack; |
| 748 | string = fxToString(the, slot); |
| 749 | length = (txSize)c_strlen(string); |
| 750 | if (length == 0) |
| 751 | mxSyntaxError("empty string"); |
| 752 | else { |
| 753 | char first = string[0]; |
| 754 | char last = string[length - 1]; |
| 755 | if ((first == 0x09) || (first == 0x0A) || (first == 0x0D) || (first == 0x20) || (last == 0x09) || (last == 0x0A) || (last == 0x0D) || (last == 0x20)) |
| 756 | mxSyntaxError("invalid string"); |
| 757 | } |
| 758 | aParser.slot = slot; |
| 759 | aParser.offset = 0; |
| 760 | mxPush(mxEmptyString); |
| 761 | aParser.string = the->stack; |
| 762 | aParser.line = 1; |
| 763 | fxParseJSON(the, (txJSONParser*)&aParser); |
| 764 | if (mxIsReference(the->stack)) |
| 765 | mxSyntaxError("invalid string"); |
| 766 | mxPop(); |
| 767 | instance = fxNewInstance(the); |
| 768 | instance->flag |= XS_EXOTIC_FLAG | XS_DONT_PATCH_FLAG; |
| 769 | property = instance->next = fxNewSlot(the); |
| 770 | property->flag = XS_INTERNAL_FLAG | XS_DONT_DELETE_FLAG | XS_DONT_SET_FLAG; |
| 771 | property->kind = XS_RAW_JSON_KIND; |
| 772 | property = property->next = fxNewSlot(the); |
| 773 | property->ID = mxID(_rawJSON); |
| 774 | property->flag = XS_DONT_DELETE_FLAG | XS_DONT_SET_FLAG; |
| 775 | property->kind = slot->kind; |
| 776 | property->value = slot->value; |
| 777 | mxPullSlot(mxResult); |
| 778 | } |
| 779 | |
| 780 | void fx_JSON_stringify(txMachine* the) |
| 781 | { |
nothing calls this directly
no test coverage detected