… | |
… | |
21 | |
21 | |
22 | // F_SELFCONVERT? <=> to_json/toJson |
22 | // F_SELFCONVERT? <=> to_json/toJson |
23 | // F_BLESSED? <=> { $__class__$ => } |
23 | // F_BLESSED? <=> { $__class__$ => } |
24 | |
24 | |
25 | #define F_PRETTY F_INDENT | F_SPACE_BEFORE | F_SPACE_AFTER |
25 | #define F_PRETTY F_INDENT | F_SPACE_BEFORE | F_SPACE_AFTER |
26 | #define F_DEFAULT (12UL << S_MAXDEPTH) |
26 | #define F_DEFAULT (9UL << S_MAXDEPTH) |
27 | |
27 | |
28 | #define INIT_SIZE 32 // initial scalar size to be allocated |
28 | #define INIT_SIZE 32 // initial scalar size to be allocated |
29 | #define INDENT_STEP 3 // spaces per indentation level |
29 | #define INDENT_STEP 3 // spaces per indentation level |
30 | |
30 | |
31 | #define UTF8_MAX_LEN 11 // for perls UTF-X: max. number of octets per character |
31 | #define UTF8_MAX_LEN 11 // for perls UTF-X: max. number of octets per character |
… | |
… | |
688 | else |
688 | else |
689 | { |
689 | { |
690 | --dec->cur; |
690 | --dec->cur; |
691 | |
691 | |
692 | if (!ch) |
692 | if (!ch) |
693 | ERR ("unexpected end of string while parsing json string"); |
693 | ERR ("unexpected end of string while parsing JSON string"); |
694 | else |
694 | else |
695 | ERR ("invalid character encountered while parsing json string"); |
695 | ERR ("invalid character encountered while parsing JSON string"); |
696 | } |
696 | } |
697 | } |
697 | } |
698 | while (cur < buf + SHORT_STRING_LEN); |
698 | while (cur < buf + SHORT_STRING_LEN); |
699 | |
699 | |
700 | STRLEN len = cur - buf; |
700 | STRLEN len = cur - buf; |
… | |
… | |
958 | ERR ("'null' expected"); |
958 | ERR ("'null' expected"); |
959 | |
959 | |
960 | break; |
960 | break; |
961 | |
961 | |
962 | default: |
962 | default: |
963 | ERR ("malformed json string, neither array, object, number, string or atom"); |
963 | ERR ("malformed JSON string, neither array, object, number, string or atom"); |
964 | break; |
964 | break; |
965 | } |
965 | } |
966 | |
966 | |
967 | fail: |
967 | fail: |
968 | return 0; |
968 | return 0; |