Branch Coverage

XS.xs
Criterion Covered Total %
branch 700 1032 67.8


line true false branch
23 179 0 return (c == '_') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
159 20 return (c == '_') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
159 0 return (c == '_') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
156 23 return (c == '_') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
153 3 return (c == '_') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
27 26 108 return is_ident_start_char(c) || (c >= '0' && c <= '9') || c == '-';
19 7 return is_ident_start_char(c) || (c >= '0' && c <= '9') || c == '-';
19 0 return is_ident_start_char(c) || (c >= '0' && c <= '9') || c == '-';
0 26 return is_ident_start_char(c) || (c >= '0' && c <= '9') || c == '-';
31 169 9 while (p->pos < p->len) {
33 132 37 if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
132 0 if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
123 9 if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
0 123 if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
42 0 335 if (p->pos >= p->len) {
54 64 0 if (!got || got != expected) {
1 63 if (!got || got != expected) {
64 9 32 if (p->pos + litlen > p->len) {
67 31 1 if (strncmp(p->text + p->pos, literal, litlen) != 0) {
71 1 0 if (p->pos + litlen < p->len) {
73 0 1 if (is_ident_char(next)) {
88 188 0 if (i < n && (s[i] == '+' || s[i] == '-')) {
188 0 if (i < n && (s[i] == '+' || s[i] == '-')) {
1 187 if (i < n && (s[i] == '+' || s[i] == '-')) {
92 214 42 while (i < n && isdigit((unsigned char)s[i])) {
68 146 while (i < n && isdigit((unsigned char)s[i])) {
97 146 42 if (i < n && s[i] == '.') {
4 142 if (i < n && s[i] == '.') {
99 9 4 while (i < n && isdigit((unsigned char)s[i])) {
9 0 while (i < n && isdigit((unsigned char)s[i])) {
105 137 51 if (!has_digit) {
109 5 46 if (i < n && (s[i] == 'e' || s[i] == 'E')) {
4 1 if (i < n && (s[i] == 'e' || s[i] == 'E')) {
0 4 if (i < n && (s[i] == 'e' || s[i] == 'E')) {
111 1 0 if (i < n && (s[i] == '+' || s[i] == '-')) {
1 0 if (i < n && (s[i] == '+' || s[i] == '-')) {
0 1 if (i < n && (s[i] == '+' || s[i] == '-')) {
114 1 0 if (i >= n || !isdigit((unsigned char)s[i])) {
0 1 if (i >= n || !isdigit((unsigned char)s[i])) {
117 1 1 while (i < n && isdigit((unsigned char)s[i])) {
1 0 while (i < n && isdigit((unsigned char)s[i])) {
128 0 10 if (bp_peek(p) == '-') {
132 0 10 if (!isdigit((unsigned char)bp_peek(p))) {
136 0 10 if (bp_peek(p) == '0') {
139 11 10 while (isdigit((unsigned char)bp_peek(p))) {
144 0 10 if (bp_peek(p) == '.') {
146 0 0 if (!isdigit((unsigned char)bp_peek(p))) {
149 0 0 while (isdigit((unsigned char)bp_peek(p))) {
154 10 0 if (bp_peek(p) == 'e' || bp_peek(p) == 'E') {
0 10 if (bp_peek(p) == 'e' || bp_peek(p) == 'E') {
156 0 0 if (bp_peek(p) == '+' || bp_peek(p) == '-') {
0 0 if (bp_peek(p) == '+' || bp_peek(p) == '-') {
159 0 0 if (!isdigit((unsigned char)bp_peek(p))) {
162 0 0 while (isdigit((unsigned char)bp_peek(p))) {
171 10 0 if (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) {
10 0 if (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) {
0 10 if (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) {
187 25 0 while (p->pos < p->len) {
190 5 20 if (ch == '"') {
194 0 20 if (ch == '\\') {
195 0 0 if (p->pos >= p->len) {
215 0 0 if (p->pos + 4 > p->len) {
224 0 0 if (uv <= 0x7F) {
251 0 13 if (ch == '"') {
255 0 13 if (!is_ident_start_char(ch)) {
261 32 13 while (is_ident_char(bp_peek(p))) {
276 17 0 if (c != 0) return c;
277 0 0 if (na < nb) return -1;
278 0 0 if (na > nb) return 1;
284 11 0 SV **arr = (SV**)safemalloc(sizeof(SV*) * (count > 0 ? count : 1));
288 24 11 while ((he = hv_iternext(hv)) != NULL) {
293 7 4 if (idx > 1) {
298 24 11 for (I32 i = 0; i < idx; i++) {
309 17 0 if (n == 0 || !is_ident_start_char(s[0])) {
0 17 if (n == 0 || !is_ident_start_char(s[0])) {
312 43 17 for (STRLEN i = 1; i < n; i++) {
313 0 43 if (!is_ident_char(s[i])) {
322 75 0 while (p->pos < p->len) {
324 63 12 if (c == ',' || c == '\n' || c == '\r') {
57 6 if (c == ',' || c == '\n' || c == '\r') {
57 0 if (c == ',' || c == '\n' || c == '\r') {
331 18 0 while (end > start && (p->text[end - 1] == ' ' || p->text[end - 1] == '\t')) {
0 18 while (end > start && (p->text[end - 1] == ' ' || p->text[end - 1] == '\t')) {
0 18 while (end > start && (p->text[end - 1] == ' ' || p->text[end - 1] == '\t')) {
336 6 12 if (is_numeric_token(p->text + start, n)) {
339 6 0 if (memchr(SvPV_nolen(tmp), '.', n) || memchr(SvPV_nolen(tmp), 'e', n) || memchr(SvPV_nolen(tmp), 'E', n)) {
6 0 if (memchr(SvPV_nolen(tmp), '.', n) || memchr(SvPV_nolen(tmp), 'e', n) || memchr(SvPV_nolen(tmp), 'E', n)) {
0 6 if (memchr(SvPV_nolen(tmp), '.', n) || memchr(SvPV_nolen(tmp), 'e', n) || memchr(SvPV_nolen(tmp), 'E', n)) {
354 6 0 while (p->pos < p->len) {
356 3 3 if (p->pos >= p->len) {
360 0 3 if (!is_ident_start_char(bp_peek(p))) {
366 12 3 while (is_ident_char(bp_peek(p))) {
374 3 3 while (isdigit((unsigned char)bp_peek(p))) {
377 0 3 if (p->pos == cnt_start) {
392 0 9 if (!is_ident_start_char(bp_peek(p))) {
401 21 9 while (is_ident_char(bp_peek(p))) {
406 6 3 if (bp_peek(p) == ',') {
419 6 3 for (IV r = 0; r < count; r++) {
420 6 0 while (p->pos < p->len) {
422 6 0 if (c == '\n') {
427 18 0 while (p->pos < p->len) {
429 6 12 if (c == ' ' || c == '\t') {
0 6 if (c == ' ' || c == '\t') {
437 18 6 for (I32 fi = 0; fi < nfields; fi++) {
438 12 6 if (fi > 0) {
468 4 0 if (bp_peek(p) == ']') {
478 5 4 if (bp_peek(p) == ',') {
498 6 0 if (bp_peek(p) == '}') {
519 7 5 if (bp_peek(p) == ',') {
536 0 29 if (!ch) {
540 6 23 if (ch == '{') return bp_parse_object(p);
541 4 19 if (ch == '[') return bp_parse_array(p);
542 5 14 if (ch == '"') return bp_parse_string(p);
544 0 14 if (bp_consume_literal(p, "null")) return newSV(0);
545 1 13 if (bp_consume_literal(p, "true")) return newSViv(1);
546 0 13 if (bp_consume_literal(p, "false")) return newSViv(0);
548 13 0 if (ch == '-' || isdigit((unsigned char)ch)) {
10 3 if (ch == '-' || isdigit((unsigned char)ch)) {
552 3 0 if (is_ident_start_char(ch)) {
561 0 159 if (!SvOK(sv)) return 0;
562 137 22 if (SvNOK(sv) || SvIOK(sv) || looks_like_number(sv)) return 1;
87 50 if (SvNOK(sv) || SvIOK(sv) || looks_like_number(sv)) return 1;
0 87 if (SvNOK(sv) || SvIOK(sv) || looks_like_number(sv)) return 1;
570 3 1 for (STRLEN i = 0; i < n; i++) {
590 5 3 while ((he = hv_iternext(hv)) != NULL) {
592 0 5 if (!sv_is_identifier_key(key)) return 0;
595 3 2 if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVAV) return 0;
0 3 if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVAV) return 0;
599 0 3 if (arr_len <= 0) return 0;
602 3 0 if (!first_row_sv || !SvROK(*first_row_sv) || SvTYPE(SvRV(*first_row_sv)) != SVt_PVHV) return 0;
3 0 if (!first_row_sv || !SvROK(*first_row_sv) || SvTYPE(SvRV(*first_row_sv)) != SVt_PVHV) return 0;
0 3 if (!first_row_sv || !SvROK(*first_row_sv) || SvTYPE(SvRV(*first_row_sv)) != SVt_PVHV) return 0;
608 9 3 for (I32 fi = 0; fi < nfields; fi++) {
610 9 0 if (!f || !sv_is_identifier_key(*f)) {
0 9 if (!f || !sv_is_identifier_key(*f)) {
616 6 3 for (I32 ri = 0; ri < arr_len; ri++) {
618 6 0 if (!row_sv || !SvROK(*row_sv) || SvTYPE(SvRV(*row_sv)) != SVt_PVHV) {
6 0 if (!row_sv || !SvROK(*row_sv) || SvTYPE(SvRV(*row_sv)) != SVt_PVHV) {
0 6 if (!row_sv || !SvROK(*row_sv) || SvTYPE(SvRV(*row_sv)) != SVt_PVHV) {
625 0 6 if (row_count != nfields) {
630 18 6 for (I32 fi = 0; fi < nfields; fi++) {
635 18 0 if (!cell || !SvOK(*cell)) {
0 18 if (!cell || !SvOK(*cell)) {
639 12 6 if (!sv_is_plain_numberish(*cell)) {
642 51 12 for (STRLEN ci = 0; ci < cn; ci++) {
643 51 0 if (cs[ci] == ',' || cs[ci] == '\n' || cs[ci] == '\r') {
51 0 if (cs[ci] == ',' || cs[ci] == '\n' || cs[ci] == '\r') {
0 51 if (cs[ci] == ',' || cs[ci] == '\n' || cs[ci] == '\r') {
662 14 6 for (I32 i = 0; i < n; i++) {
668 0 18 if (!SvOK(value)) {
671 6 12 if (sv_is_plain_numberish(value)) {
682 0 5 if (key_count == 0) {
687 5 0 if (level == 0 && is_tabular_encodable(hv)) {
3 2 if (level == 0 && is_tabular_encodable(hv)) {
691 3 3 for (I32 ki = 0; ki < nkeys; ki++) {
705 9 3 for (I32 fi = 0; fi < nfields; fi++) {
706 6 3 if (fi > 0) sv_catpvn(out, ",", 1);
712 6 3 for (I32 ri = 0; ri < arr_len; ri++) {
716 18 6 for (I32 fi = 0; fi < nfields; fi++) {
717 12 6 if (fi > 0) sv_catpvn(out, ",", 1);
735 2 0 if (opts->canonical) {
741 0 0 while ((he = hv_iternext(hv)) != NULL) {
748 1 1 if (!opts->pretty) {
750 1 1 for (I32 i = 0; i < nkeys; i++) {
751 0 1 if (i > 0) sv_catpvn(out, ", ", 2);
756 1 0 if (sv_is_identifier_key(*ksv)) {
772 2 1 for (I32 i = 0; i < nkeys; i++) {
773 1 1 if (i > 0) sv_catpvn(out, ",\n", 2);
780 2 0 if (sv_is_identifier_key(*ksv)) {
799 0 1 if (n <= 0) {
804 0 1 if (!opts->pretty) {
806 0 0 for (I32 i = 0; i < n; i++) {
807 0 0 if (i > 0) sv_catpvn(out, ", ", 2);
816 2 1 for (I32 i = 0; i < n; i++) {
817 1 1 if (i > 0) sv_catpvn(out, ",\n", 2);
828 0 10 if (!SvOK(value)) {
833 6 4 if (SvROK(value)) {
835 0 6 if (SvOBJECT(rv)) {
838 1 5 if (SvTYPE(rv) == SVt_PVAV) {
842 5 0 if (SvTYPE(rv) == SVt_PVHV) {
851 0 4 if (n == 4 && strncmp(s, "true", 4) == 0) {
0 0 if (n == 4 && strncmp(s, "true", 4) == 0) {
855 0 4 if (n == 5 && strncmp(s, "false", 5) == 0) {
0 0 if (n == 5 && strncmp(s, "false", 5) == 0) {
860 3 1 if (sv_is_plain_numberish(value)) {
862 3 0 if (SvIOK(value) && !SvNOK(value)) {
3 0 if (SvIOK(value) && !SvNOK(value)) {
880 5 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) {
5 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) {
5 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) {
0 5 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) {
888 3 2 if (v) opts->pretty = SvTRUE(*v) ? 1 : 0;
891 5 0 if (v) opts->canonical = SvTRUE(*v) ? 1 : 0;
894 3 2 if (v) {
896 3 0 opts->indent = iv > 0 ? (int)iv : 2;
913 0 6 if (p.pos < p.len) {
946 1300 0 return (c == '_') || isalnum((unsigned char)c);
1138 162 return (c == '_') || isalnum((unsigned char)c);
953 179 0 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
0 179 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
0 179 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
955 179 0 while (end > start && (s[end - 1] == ' ' || s[end - 1] == '\t')) end--;
0 179 while (end > start && (s[end - 1] == ' ' || s[end - 1] == '\t')) end--;
0 179 while (end > start && (s[end - 1] == ' ' || s[end - 1] == '\t')) end--;
963 10384 0 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
10194 190 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
0 190 while (start < n && (s[start] == ' ' || s[start] == '\t')) start++;
971 33077 0 while (i < n && s[i] == ' ') i++;
32636 441 while (i < n && s[i] == ' ') i++;
981 127485 53 for (STRLEN i = 0; i < n; i++) {
982 213 127272 if (s[i] == '\n') {
984 213 0 if (end > start && s[end - 1] == '\r') end--;
0 213 if (end > start && s[end - 1] == '\r') end--;
989 53 0 if (start <= n) {
994 53 0 if (len > 0) {
996 53 0 if (last) {
999 36 17 if (ln == 0 || (ln == 1 && (ls[0] == '\r' || ls[0] == '\n'))) {
2 34 if (ln == 0 || (ln == 1 && (ls[0] == '\r' || ls[0] == '\n'))) {
2 0 if (ln == 0 || (ln == 1 && (ls[0] == '\r' || ls[0] == '\n'))) {
0 2 if (ln == 0 || (ln == 1 && (ls[0] == '\r' || ls[0] == '\n'))) {
1012 391 39 for (STRLEN i = 0; i < n; i++) {
1013 58 333 if (s[i] == delimiter) {
1018 39 0 if (start < n) {
1029 33077 0 for (STRLEN i = 0; i < n; i++) {
1030 441 32636 if (!(s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n')) return 0;
441 0 if (!(s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n')) return 0;
441 0 if (!(s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n')) return 0;
441 0 if (!(s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n')) return 0;
1038 49 4 if (n < 4 || s[0] != '[') return 0;
46 3 if (n < 4 || s[0] != '[') return 0;
1041 6 0 while (i < n && isdigit((unsigned char)s[i])) i++;
3 3 while (i < n && isdigit((unsigned char)s[i])) i++;
1042 0 3 if (i == dstart) return 0;
1048 3 0 if (i < n && (s[i] == '\t' || s[i] == '|')) {
3 0 if (i < n && (s[i] == '\t' || s[i] == '|')) {
1 2 if (i < n && (s[i] == '\t' || s[i] == '|')) {
1052 3 0 if (i >= n || s[i] != ']') return 0;
0 3 if (i >= n || s[i] != ']') return 0;
1054 3 0 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 3 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 3 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
1055 3 0 if (i >= n || s[i] != ':') return 0;
0 3 if (i >= n || s[i] != ':') return 0;
1057 6 0 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
3 3 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 3 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
1067 86 33 if (n >= 2 && s[0] == '"' && s[n - 1] == '"') {
8 78 if (n >= 2 && s[0] == '"' && s[n - 1] == '"') {
7 1 if (n >= 2 && s[0] == '"' && s[n - 1] == '"') {
1069 102513 7 for (STRLEN i = 1; i + 1 < n; i++) {
1071 4 102509 if (c == '\\' && i + 2 < n) {
4 0 if (c == '\\' && i + 2 < n) {
1092 11 101 if (n == 4 && strncmp(s, "null", 4) == 0) {
1 10 if (n == 4 && strncmp(s, "null", 4) == 0) {
1096 10 101 if (n == 4 && strncmp(s, "true", 4) == 0) {
2 8 if (n == 4 && strncmp(s, "true", 4) == 0) {
1100 22 87 if (n == 5 && strncmp(s, "false", 5) == 0) {
1 21 if (n == 5 && strncmp(s, "false", 5) == 0) {
1105 41 67 if (is_numeric_token(s, n)) {
1107 41 0 if (i < n && (s[i] == '+' || s[i] == '-')) i++;
41 0 if (i < n && (s[i] == '+' || s[i] == '-')) i++;
1 40 if (i < n && (s[i] == '+' || s[i] == '-')) i++;
1108 13 28 if (i + 1 < n && s[i] == '0' && isdigit((unsigned char)s[i + 1])) {
1 12 if (i + 1 < n && s[i] == '0' && isdigit((unsigned char)s[i + 1])) {
1 0 if (i + 1 < n && s[i] == '0' && isdigit((unsigned char)s[i + 1])) {
1109 1 0 if (!(i + 1 < n && s[i + 1] == '.')) {
1 0 if (!(i + 1 < n && s[i + 1] == '.')) {
1116 36 4 int has_float = (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) ? 1 : 0;
35 1 int has_float = (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) ? 1 : 0;
0 35 int has_float = (memchr(s, '.', n) || memchr(s, 'e', n) || memchr(s, 'E', n)) ? 1 : 0;
1117 5 35 if (has_float) {
1119 0 5 if (nv == 0.0) {
1129 1 4 if ((IV)nn == nn) return newSViv((IV)nn);
1145 165 0 if (i >= n || !is_word_char(s[i])) return 0;
0 165 if (i >= n || !is_word_char(s[i])) return 0;
1147 1135 3 while (i < n && is_word_char(s[i])) i++;
973 162 while (i < n && is_word_char(s[i])) i++;
1153 162 3 if (i < n && s[i] == '[') {
19 143 if (i < n && s[i] == '[') {
1156 46 0 while (i < n && s[i] != ']') i++;
27 19 while (i < n && s[i] != ']') i++;
1157 0 19 if (i >= n) return 0;
1162 161 4 if (i < n && s[i] == '{') {
11 150 if (i < n && s[i] == '{') {
1165 122 0 while (i < n && s[i] != '}') i++;
111 11 while (i < n && s[i] != '}') i++;
1166 0 11 if (i >= n) return 0;
1171 161 4 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 161 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 161 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
1172 161 4 if (i >= n || s[i] != ':') return 0;
1 160 if (i >= n || s[i] != ':') return 0;
1174 80 120 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
40 40 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
0 40 while (i < n && (s[i] == ' ' || s[i] == '\t')) i++;
1183 1 145 if (target_depth > ctx->max_depth) {
1189 156 44 while (ctx->pos < total) {
1191 0 156 if (!linep) { ctx->pos++; continue; }
1192 0 156 if (line_is_empty_or_ws(*linep)) { ctx->pos++; continue; }
1195 0 156 if (depth < target_depth) break;
1196 0 156 if (depth > target_depth + 1) { ctx->pos++; continue; }
1197 0 156 if (depth > target_depth) break;
1204 2 154 if (!ok) {
1205 2 0 if (key != &PL_sv_undef) SvREFCNT_dec(key);
1210 18 136 if (br != &PL_sv_undef) {
1213 106 30 if (SvCUR(rest) == 0) {
1225 18 35 if (br != &PL_sv_undef) SvREFCNT_dec(br);
1226 11 42 if (fs != &PL_sv_undef) SvREFCNT_dec(fs);
1235 18 0 if (n < 3 || s[0] != '[') return 0;
0 18 if (n < 3 || s[0] != '[') return 0;
1238 35 0 while (i < n && isdigit((unsigned char)s[i])) i++;
17 18 while (i < n && isdigit((unsigned char)s[i])) i++;
1239 1 17 if (i == start) return 0;
1244 17 0 if (i < n && (s[i] == '\t' || s[i] == '|')) {
14 3 if (i < n && (s[i] == '\t' || s[i] == '|')) {
4 10 if (i < n && (s[i] == '\t' || s[i] == '|')) {
1248 17 0 if (i >= n || s[i] != ']') return 0;
0 17 if (i >= n || s[i] != ']') return 0;
1255 1 17 if (!line_parse_bracket_info(bracket, &count, &delimiter)) {
1259 11 6 if (fields != &PL_sv_undef) {
1262 0 11 if (fn < 2) return newRV_noinc((SV*)newAV());
1269 22 11 while (ctx->pos < total) {
1271 0 22 if (!linep) { ctx->pos++; continue; }
1272 0 22 if (line_is_empty_or_ws(*linep)) { ctx->pos++; continue; }
1275 0 22 if (depth <= 0) break;
1279 22 0 if (tn >= 1 && ts[0] == '-') {
0 22 if (tn >= 1 && ts[0] == '-') {
1290 54 20 for (I32 i = 0; i < nf && i < nv; i++) {
52 2 for (I32 i = 0; i < nf && i < nv; i++) {
1310 3 3 while (peek < total) {
1312 0 3 if (!linep) { peek++; continue; }
1313 0 3 if (line_is_empty_or_ws(*linep)) { peek++; continue; }
1315 0 3 if (d <= 0) break;
1318 3 0 if (tn >= 1 && ts[0] == '-') has_list = 1;
3 0 if (tn >= 1 && ts[0] == '-') has_list = 1;
1323 3 3 if (has_list) {
1325 7 3 while (ctx->pos < total) {
1327 0 7 if (!linep) { ctx->pos++; continue; }
1328 0 7 if (line_is_empty_or_ws(*linep)) { ctx->pos++; continue; }
1331 0 7 if (depth <= 0) break;
1335 7 0 if (!(tn >= 2 && ts[0] == '-' && ts[1] == ' ')) {
7 0 if (!(tn >= 2 && ts[0] == '-' && ts[1] == ' ')) {
0 7 if (!(tn >= 2 && ts[0] == '-' && ts[1] == ' ')) {
1345 4 3 if (line_parse_object_header(item_trim, &key, &br, &fs, &restv) && br == &PL_sv_undef) {
4 0 if (line_parse_object_header(item_trim, &key, &br, &fs, &restv) && br == &PL_sv_undef) {
1348 0 4 if (SvCUR(restv) == 0) {
1356 4 2 while (ctx->pos < total) {
1358 0 4 if (!nextp) { ctx->pos++; continue; }
1359 0 4 if (line_is_empty_or_ws(*nextp)) { ctx->pos++; continue; }
1361 2 2 if (nd < depth + 1 || nd > depth + 1) break;
2 0 if (nd < depth + 1 || nd > depth + 1) break;
1364 2 0 if (nn >= 1 && ns[0] == '-') { SvREFCNT_dec(ntrim); break; }
0 2 if (nn >= 1 && ns[0] == '-') { SvREFCNT_dec(ntrim); break; }
1367 2 0 if (!line_parse_object_header(ntrim, &k2, &b2, &f2, &r2) || b2 != &PL_sv_undef) {
0 2 if (!line_parse_object_header(ntrim, &k2, &b2, &f2, &r2) || b2 != &PL_sv_undef) {
1368 0 0 if (k2 != &PL_sv_undef) SvREFCNT_dec(k2);
1387 3 0 if (key != &PL_sv_undef) SvREFCNT_dec(key);
1388 0 3 if (restv != &PL_sv_undef) SvREFCNT_dec(restv);
1398 9 3 for (I32 i = 0; i < nv; i++) {
1412 53 0 if (opts_sv && SvOK(opts_sv) && SvROK(opts_sv) && SvTYPE(SvRV(opts_sv)) == SVt_PVHV) {
53 0 if (opts_sv && SvOK(opts_sv) && SvROK(opts_sv) && SvTYPE(SvRV(opts_sv)) == SVt_PVHV) {
53 0 if (opts_sv && SvOK(opts_sv) && SvROK(opts_sv) && SvTYPE(SvRV(opts_sv)) == SVt_PVHV) {
53 0 if (opts_sv && SvOK(opts_sv) && SvROK(opts_sv) && SvTYPE(SvRV(opts_sv)) == SVt_PVHV) {
1415 0 53 if (md) ctx.max_depth = (I32)SvIV(*md);
1420 249 53 for (I32 i = 0; i < total; i++) {
1422 249 0 if (!linep || line_is_empty_or_ws(*linep)) continue;
0 249 if (!linep || line_is_empty_or_ws(*linep)) continue;
1423 189 60 if (line_depth_from_sv(*linep) != 0) continue;
1428 0 53 if (nn <= 0) {
1440 3 50 if (line_parse_root_array_header(first_trim, &count, &delimiter, &rest)) {
1441 3 0 if (SvCUR(rest) > 0) {
1445 9 3 for (I32 i = 0; i < nv; i++) {
1459 0 0 while (ctx.pos < total) {
1461 0 0 if (!linep || line_is_empty_or_ws(*linep)) { ctx.pos++; continue; }
0 0 if (!linep || line_is_empty_or_ws(*linep)) { ctx.pos++; continue; }
1463 0 0 if (d == 0) {
1467 0 0 if (tn >= 1 && ts[0] == '[') { ctx.pos++; continue; }
0 0 if (tn >= 1 && ts[0] == '[') { ctx.pos++; continue; }
1468 0 0 } else if (d > 0) {
1471 0 0 if (tn >= 1 && ts[0] == '-') {
0 0 if (tn >= 1 && ts[0] == '-') {
1491 258 10 for (STRLEN i = 0; i < fn; i++) {
1492 19 239 if (fs[i] == '[') { first_word_bracket = 1; break; }
1493 218 21 if (fs[i] == ':' || fs[i] == ' ') break;
218 0 if (fs[i] == ':' || fs[i] == ' ') break;
1497 19 31 if (first_word_bracket) {
1500 27 4 } else if (nn == 1 && !memchr(fs, ':', fn)) {
10 17 } else if (nn == 1 && !memchr(fs, ':', fn)) {
1516 0 62 if (n == 0) return 1;
1517 62 0 if (s[0] == ' ' || s[n - 1] == ' ') return 1;
0 62 if (s[0] == ' ' || s[n - 1] == ' ') return 1;
1518 8 54 if ((n == 4 && strncmp(s, "true", 4) == 0) ||
8 0 if ((n == 4 && strncmp(s, "true", 4) == 0) ||
1519 19 43 (n == 5 && strncmp(s, "false", 5) == 0) ||
19 0 (n == 5 && strncmp(s, "false", 5) == 0) ||
1520 8 54 (n == 4 && strncmp(s, "null", 4) == 0)) return 1;
0 8 (n == 4 && strncmp(s, "null", 4) == 0)) return 1;
1521 0 62 if (is_numeric_token(s, n)) return 1;
1522 57 5 if (n >= 2 && s[0] == '0' && isdigit((unsigned char)s[1])) return 1;
0 57 if (n >= 2 && s[0] == '0' && isdigit((unsigned char)s[1])) return 1;
0 0 if (n >= 2 && s[0] == '0' && isdigit((unsigned char)s[1])) return 1;
1523 305 62 for (STRLEN i = 0; i < n; i++) {
1525 305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
305 0 if (c == ':' || c == '"' || c == '\\' || c == '[' || c == ']' || c == '{' || c == '}' || c == '-' ||
1526 305 0 c == '\r' || c == '\n' || c == '\t' || c == delimiter) return 1;
305 0 c == '\r' || c == '\n' || c == '\t' || c == delimiter) return 1;
0 305 c == '\r' || c == '\n' || c == '\t' || c == delimiter) return 1;
1528 0 62 if (s[0] == '-') return 1;
1536 0 0 for (STRLEN i = 0; i < n; i++) {
1551 0 119 if (!SvOK(value)) return newSVpv("null", 0);
1553 57 62 if (sv_is_plain_numberish(value)) {
1555 1 56 if (nv == 0.0) return newSVpv("0", 0);
1556 53 3 if (SvIOK(value) && !SvNOK(value)) return newSViv(SvIV(value));
0 53 if (SvIOK(value) && !SvNOK(value)) return newSViv(SvIV(value));
1562 0 62 if (line_needs_quoting(value, delimiter)) {
1574 142 138 if (!ctx->priority) return 999999;
1577 48 90 if (!v) return 999999;
1583 102 3 SV **arr = (SV**)safemalloc(sizeof(SV*) * (count > 0 ? count : 1));
1586 207 105 while ((he = hv_iternext(hv)) != NULL) {
1590 207 105 for (I32 i = 0; i < idx; i++) {
1591 140 207 for (I32 j = i + 1; j < idx; j++) {
1595 58 82 if (ri != rj) {
1603 0 82 if (c == 0) c = (ni < nj) ? -1 : ((ni > nj) ? 1 : 0);
0 0 if (c == 0) c = (ni < nj) ? -1 : ((ni > nj) ? 1 : 0);
1606 75 65 if (swap) {
1615 207 105 for (I32 i = 0; i < idx; i++) {
1623 41 50 if (!*first) sv_catpvn(out, "\n", 1);
1633 6 2 for (I32 i = 0; i < n; i++) {
1635 6 0 if (it && SvROK(*it)) { all_prims = 0; break; }
0 6 if (it && SvROK(*it)) { all_prims = 0; break; }
1638 2 0 if (all_prims) {
1640 0 2 if (ctx->delimiter == '\t') sv_catpvn(out, "\t", 1);
1641 0 2 else if (ctx->delimiter == '|') sv_catpvn(out, "|", 1);
1643 6 2 for (I32 i = 0; i < n; i++) {
1644 4 2 if (i > 0) {
1657 0 0 for (I32 i = 0; i < n; i++) {
1660 0 0 if (SvOK(enc) && SvCUR(enc) > 0) {
0 0 if (SvOK(enc) && SvCUR(enc) > 0) {
1672 30 17 for (I32 i = 0; i < n; i++) {
1674 30 0 if (!it || !SvROK(*it) || SvTYPE(SvRV(*it)) != SVt_PVHV) { all_objects = 0; break; }
29 1 if (!it || !SvROK(*it) || SvTYPE(SvRV(*it)) != SVt_PVHV) { all_objects = 0; break; }
0 29 if (!it || !SvROK(*it) || SvTYPE(SvRV(*it)) != SVt_PVHV) { all_objects = 0; break; }
1680 17 1 if (all_objects && n > 0) {
17 0 if (all_objects && n > 0) {
1686 29 17 for (I32 i = 0; i < n && can_tabular; i++) {
29 0 for (I32 i = 0; i < n && can_tabular; i++) {
1689 1 28 if (av_len(rk) + 1 != nk) can_tabular = 0;
1690 73 28 for (I32 j = 0; j < nk && can_tabular; j++) {
72 1 for (I32 j = 0; j < nk && can_tabular; j++) {
1694 72 0 if (an != bn || memcmp(as, bs, an) != 0) can_tabular = 0;
0 72 if (an != bn || memcmp(as, bs, an) != 0) can_tabular = 0;
1697 72 25 while ((he = hv_iternext(row)) != NULL) {
1699 4 68 if (SvROK(v)) { can_tabular = 0; break; }
1704 12 5 if (can_tabular) {
1706 1 11 if (ctx->delimiter == '\t') sv_catpvn(out, "\t", 1);
1707 3 8 else if (ctx->delimiter == '|') sv_catpvn(out, "|", 1);
1709 32 12 for (I32 i = 0; i < nk; i++) {
1710 20 12 if (i > 0) {
1721 24 12 for (I32 x = 0; x < ctx->depth * ctx->indent; x++) sv_catpvn(row_indent, " ", 1);
1722 23 12 for (I32 i = 0; i < n; i++) {
1726 61 23 for (I32 j = 0; j < nk; j++) {
1727 38 23 if (j > 0) {
1750 20 6 for (I32 x = 0; x < ctx->depth * ctx->indent; x++) sv_catpvn(item_indent, " ", 1);
1752 32 6 for (I32 x = 0; x < (ctx->depth + 1) * ctx->indent; x++) sv_catpvn(field_indent, " ", 1);
1754 5 1 if (all_objects && n > 0) {
5 0 if (all_objects && n > 0) {
1755 6 5 for (I32 i = 0; i < n; i++) {
1759 6 0 if (nk > 0) {
1770 7 6 for (I32 j = 1; j < nk; j++) {
1788 2 1 for (I32 i = 0; i < n; i++) {
1791 2 0 if (SvOK(ev) && SvCUR(ev) > 0) {
2 0 if (SvOK(ev) && SvCUR(ev) > 0) {
1807 2 53 if (ctx->depth >= ctx->max_depth) {
1815 166 53 for (I32 i = 0; i < ctx->depth * ctx->indent; i++) sv_catpvn(indent, " ", 1);
1817 77 41 for (I32 i = 0; i < nk; i++) {
1821 0 77 if (!v) continue;
1825 44 33 if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVAV) {
18 26 if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVAV) {
1827 26 33 } else if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) {
26 0 } else if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) {
1852 0 50 if (!SvOK(value)) return newSV(0);
1853 31 19 if (SvROK(value)) {
1857 0 31 if (hv_exists(ctx->seen, addr, (I32)strlen(addr))) {
1861 0 31 if (ctx->depth > ctx->max_depth) {
1864 29 2 if (SvTYPE(rv) == SVt_PVHV) return line_encode_hash(ctx, (HV*)rv);
1865 2 0 if (SvTYPE(rv) == SVt_PVAV) return line_encode_array(ctx, (AV*)rv);
1878 35 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) return;
35 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) return;
35 0 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) return;
0 35 if (!opts_sv || !SvOK(opts_sv) || !SvROK(opts_sv) || SvTYPE(SvRV(opts_sv)) != SVt_PVHV) return;
1881 1 34 v = hv_fetch(hv, "indent", 6, 0); if (v) ctx->indent = SvIV(*v);
1882 2 33 v = hv_fetch(hv, "max_depth", 9, 0); if (v) ctx->max_depth = SvIV(*v);
1884 4 31 if (v) {
1886 4 0 if (n > 0) ctx->delimiter = s[0];
1889 8 27 if (v && SvROK(*v) && SvTYPE(SvRV(*v)) == SVt_PVAV) {
8 0 if (v && SvROK(*v) && SvTYPE(SvRV(*v)) == SVt_PVAV) {
8 0 if (v && SvROK(*v) && SvTYPE(SvRV(*v)) == SVt_PVAV) {
1893 16 8 for (I32 i = 0; i < n; i++) {
1895 0 16 if (!col) continue;
1906 0 33 if (!SvOK(out)) out = newSVpv("", 0);
1908 8 25 if (ctx.priority) SvREFCNT_dec((SV*)ctx.priority);
1917 0 3 PUSHMARK(SP);
1918 0 3 XPUSHs(text_sv);
1919 3 0 if (opts_sv && SvOK(opts_sv)) XPUSHs(opts_sv);
3 0 if (opts_sv && SvOK(opts_sv)) XPUSHs(opts_sv);
0 3 if (opts_sv && SvOK(opts_sv)) XPUSHs(opts_sv);
1923 3 0 if (SvTRUE(ERRSV)) ok = 0;
0 3 if (SvTRUE(ERRSV)) ok = 0;
1925 0 3 FREETMPS;