Branch Coverage

include/litavis_tokeniser.h
Criterion Covered Total %
branch 225 368 61.1


line true false branch
57 0 587 if (!list) LITAVIS_FATAL("out of memory");
58 0 587 if (initial_cap < 64) initial_cap = 64;
60 0 587 if (!list->tokens) LITAVIS_FATAL("out of memory");
67 0 587 if (!list) return;
68 587 0 if (list->tokens) free(list->tokens);
74 3 7303 if (list->count >= list->capacity) {
77 0 3 if (!new_tokens) LITAVIS_FATAL("out of memory");
92 124 581 return isalnum((unsigned char)c) || c == '-' || c == '_';
122 2 return isalnum((unsigned char)c) || c == '-' || c == '_';
0 122 return isalnum((unsigned char)c) || c == '-' || c == '_';
96 0 0 return c != '{' && c != '}' && c != ';' && c != '\0';
0 0 return c != '{' && c != '}' && c != ';' && c != '\0';
0 0 return c != '{' && c != '}' && c != ';' && c != '\0';
0 0 return c != '{' && c != '}' && c != ';' && c != '\0';
101 15900 135 while (*pos < len) {
103 754 15146 if (c == '\n') {
107 6770 8376 } else if (c == ' ' || c == '\t' || c == '\r' || c == '\f') {
6770 0 } else if (c == ' ' || c == '\t' || c == '\r' || c == '\f') {
6770 0 } else if (c == ' ' || c == '\t' || c == '\r' || c == '\f') {
0 6770 } else if (c == ' ' || c == '\t' || c == '\r' || c == '\f') {
126 163 0 while (pos < len) {
127 0 163 if (input[pos] == '\\' && pos + 1 < len) {
0 0 if (input[pos] == '\\' && pos + 1 < len) {
129 20 143 } else if (input[pos] == quote) {
141 2603 0 while (pos < len) {
143 121 2482 if (c == '(') {
145 121 2361 } else if (c == ')') {
147 119 2 if (depth <= 0) return pos + 1;
148 2357 4 } else if (c == '"' || c == '\'') {
0 2357 } else if (c == '"' || c == '\'') {
159 705 0 while (pos < len && litavis_is_ident_char(input[pos]))
583 122 while (pos < len && litavis_is_ident_char(input[pos]))
172 5697 452 while (pos < len) {
176 135 5562 if (pos >= len) break;
181 11 5551 if (c == '/' && pos + 1 < len && input[pos + 1] == '*') {
11 0 if (c == '/' && pos + 1 < len && input[pos + 1] == '*') {
8 3 if (c == '/' && pos + 1 < len && input[pos + 1] == '*') {
185 265 0 while (pos + 1 < len && !(input[pos] == '*' && input[pos + 1] == '/')) {
257 8 while (pos + 1 < len && !(input[pos] == '*' && input[pos + 1] == '/')) {
0 8 while (pos + 1 < len && !(input[pos] == '*' && input[pos + 1] == '/')) {
186 5 252 if (input[pos] == '\n') { line++; col = 1; }
190 8 0 if (pos + 1 < len) { pos += 2; col += 2; }
196 3 5551 if (c == '/' && pos + 1 < len && input[pos + 1] == '/') {
3 0 if (c == '/' && pos + 1 < len && input[pos + 1] == '/') {
3 0 if (c == '/' && pos + 1 < len && input[pos + 1] == '/') {
199 68 0 while (pos < len && input[pos] != '\n')
65 3 while (pos < len && input[pos] != '\n')
207 824 4727 if (c == '{') {
214 824 3903 if (c == '}') {
223 997 2906 if (c == ';') {
231 10 2896 if (c == ',') {
238 16 2880 if (c == '@') {
250 16 0 if (pos < len && input[pos] != '{' && input[pos] != ';') {
16 0 if (pos < len && input[pos] != '{' && input[pos] != ';') {
16 0 if (pos < len && input[pos] != '{' && input[pos] != ';') {
253 77 0 while (pos < len && input[pos] != '{' && input[pos] != ';') {
65 12 while (pos < len && input[pos] != '{' && input[pos] != ';') {
61 4 while (pos < len && input[pos] != '{' && input[pos] != ';') {
254 13 48 if (input[pos] == '(') {
257 47 1 } else if (input[pos] == '"' || input[pos] == '\'') {
0 47 } else if (input[pos] == '"' || input[pos] == '\'') {
260 0 47 } else if (input[pos] == '\n') {
268 28 0 while (pl_end > pl_start && (input[pl_end - 1] == ' ' || input[pl_end - 1] == '\t'
12 16 while (pl_end > pl_start && (input[pl_end - 1] == ' ' || input[pl_end - 1] == '\t'
0 16 while (pl_end > pl_start && (input[pl_end - 1] == ' ' || input[pl_end - 1] == '\t'
269 0 16 || input[pl_end - 1] == '\r' || input[pl_end - 1] == '\n'))
0 16 || input[pl_end - 1] == '\r' || input[pl_end - 1] == '\n'))
271 16 0 if (pl_end > pl_start)
278 134 2746 if (c == '$' && !expecting_value) {
65 69 if (c == '$' && !expecting_value) {
283 0 65 if (name_end == pos) {
293 65 0 if (pos < len && input[pos] == ':') {
65 0 if (pos < len && input[pos] == ':') {
300 337 0 while (pos < len && input[pos] != ';') {
272 65 while (pos < len && input[pos] != ';') {
301 3 269 if (input[pos] == '(') {
303 269 0 } else if (input[pos] == '"' || input[pos] == '\'') {
0 269 } else if (input[pos] == '"' || input[pos] == '\'') {
305 0 269 } else if (input[pos] == '\n') {
313 65 0 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'))
0 65 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'))
0 65 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'))
317 65 0 if (val_end > val_start)
319 65 0 if (pos < len && input[pos] == ';') {
65 0 if (pos < len && input[pos] == ';') {
335 41 2774 if (c == '%' && !expecting_value) {
41 0 if (c == '%' && !expecting_value) {
340 0 41 if (name_end == pos) {
348 41 0 if (pos < len && input[pos] == ':') {
23 18 if (pos < len && input[pos] == ':') {
352 23 0 if (pos < len && input[pos] == '(') {
23 0 if (pos < len && input[pos] == '(') {
359 23 0 if (pos - body_start - 2 > 0)
362 23 0 if (pos < len && input[pos] == ';') {
23 0 if (pos < len && input[pos] == ';') {
370 0 0 while (pos < len && input[pos] != ';' && input[pos] != '}') {
0 0 while (pos < len && input[pos] != ';' && input[pos] != '}') {
0 0 while (pos < len && input[pos] != ';' && input[pos] != '}') {
371 0 0 if (input[pos] == '\n') { pos++; line++; col = 1; }
375 0 0 if (pos > val_start)
377 0 0 if (pos < len && input[pos] == ';') {
0 0 if (pos < len && input[pos] == ';') {
394 10 2764 if (c == '&') {
404 2756 8 if ((c == '"' || c == '\'') && !expecting_value) {
4 2752 if ((c == '"' || c == '\'') && !expecting_value) {
0 12 if ((c == '"' || c == '\'') && !expecting_value) {
415 1987 777 if (brace_depth > 0 && !expecting_value) {
1012 975 if (brace_depth > 0 && !expecting_value) {
421 7224 0 while (scan < len) {
423 0 7224 if (sc == '(') { paren_d++; scan++; continue; }
424 0 7224 if (sc == ')') { paren_d--; scan++; continue; }
425 0 7224 if (paren_d > 0) { scan++; continue; }
426 7224 0 if (sc == '"' || sc == '\'') {
0 7224 if (sc == '"' || sc == '\'') {
430 976 6248 if (sc == ':' && scan + 1 < len && input[scan + 1] == ':') {
976 0 if (sc == ':' && scan + 1 < len && input[scan + 1] == ':') {
0 976 if (sc == ':' && scan + 1 < len && input[scan + 1] == ':') {
435 976 6248 if (sc == ':') {
438 976 0 if (scan + 1 < len && (isalpha((unsigned char)input[scan + 1]) || input[scan + 1] == ':')) {
976 0 if (scan + 1 < len && (isalpha((unsigned char)input[scan + 1]) || input[scan + 1] == ':')) {
0 976 if (scan + 1 < len && (isalpha((unsigned char)input[scan + 1]) || input[scan + 1] == ':')) {
444 0 0 for (k = pos; k < scan; k++) {
445 0 0 if (input[k] == '.' || input[k] == '#' || input[k] == '&'
0 0 if (input[k] == '.' || input[k] == '#' || input[k] == '&'
0 0 if (input[k] == '.' || input[k] == '#' || input[k] == '&'
446 0 0 || input[k] == '*' || input[k] == '[' || input[k] == '>'
0 0 || input[k] == '*' || input[k] == '[' || input[k] == '>'
0 0 || input[k] == '*' || input[k] == '[' || input[k] == '>'
447 0 0 || input[k] == '~' || input[k] == '+') {
0 0 || input[k] == '~' || input[k] == '+') {
452 0 0 if (has_selector_chars) {
460 6213 35 if (sc == '{' || sc == '}' || sc == ';') {
6213 0 if (sc == '{' || sc == '}' || sc == ';') {
1 6212 if (sc == '{' || sc == '}' || sc == ';') {
464 0 6212 if (sc == '\n') { scan++; continue; }
468 976 36 if (found_colon && !found_brace) {
976 0 if (found_colon && !found_brace) {
473 6994 0 while (pos < len && input[pos] != ':') {
6018 976 while (pos < len && input[pos] != ':') {
478 976 0 while (prop_end > prop_start && (input[prop_end - 1] == ' ' || input[prop_end - 1] == '\t'))
0 976 while (prop_end > prop_start && (input[prop_end - 1] == ' ' || input[prop_end - 1] == '\t'))
0 976 while (prop_end > prop_start && (input[prop_end - 1] == ' ' || input[prop_end - 1] == '\t'))
482 976 0 if (prop_end - prop_start >= 2 && input[prop_start] == '-' && input[prop_start + 1] == '-')
11 965 if (prop_end - prop_start >= 2 && input[prop_start] == '-' && input[prop_start + 1] == '-')
7 4 if (prop_end - prop_start >= 2 && input[prop_start] == '-' && input[prop_start + 1] == '-')
488 976 0 if (pos < len && input[pos] == ':') {
976 0 if (pos < len && input[pos] == ':') {
499 975 813 if (expecting_value) {
511 5105 0 while (pos < len) {
512 973 4132 if (input[pos] == ';' && val_brace_depth == 0) break;
973 0 if (input[pos] == ';' && val_brace_depth == 0) break;
513 12 4120 if (input[pos] == '}' && val_brace_depth == 0) break;
2 10 if (input[pos] == '}' && val_brace_depth == 0) break;
514 10 4120 if (input[pos] == '{') {
517 10 4110 } else if (input[pos] == '}') {
520 79 4031 } else if (input[pos] == '(') {
523 4023 8 } else if (input[pos] == '"' || input[pos] == '\'') {
4 4019 } else if (input[pos] == '"' || input[pos] == '\'') {
526 0 4019 } else if (input[pos] == '\n') {
535 977 0 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'
2 975 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'
0 975 while (val_end > val_start && (input[val_end - 1] == ' ' || input[val_end - 1] == '\t'
536 0 975 || input[val_end - 1] == '\r' || input[val_end - 1] == '\n'))
0 975 || input[val_end - 1] == '\r' || input[val_end - 1] == '\n'))
538 975 0 if (val_end > val_start)
551 6256 1 while (pos < len) {
553 5445 811 if (sc == '{' || sc == ';' || sc == '}') break;
5444 1 if (sc == '{' || sc == ';' || sc == '}') break;
5444 0 if (sc == '{' || sc == ';' || sc == '}') break;
554 10 5434 if (sc == ',') break;
555 0 5434 if (sc == '/' && pos + 1 < len && (input[pos + 1] == '/' || input[pos + 1] == '*')) break;
0 0 if (sc == '/' && pos + 1 < len && (input[pos + 1] == '/' || input[pos + 1] == '*')) break;
0 0 if (sc == '/' && pos + 1 < len && (input[pos + 1] == '/' || input[pos + 1] == '*')) break;
0 0 if (sc == '/' && pos + 1 < len && (input[pos + 1] == '/' || input[pos + 1] == '*')) break;
556 5431 3 if (sc == '"' || sc == '\'') {
0 5431 if (sc == '"' || sc == '\'') {
561 1 5430 if (sc == '(') {
566 0 5430 if (sc == '\n') {
575 1653 0 while (sel_end > sel_start && (input[sel_end - 1] == ' ' || input[sel_end - 1] == '\t'
830 823 while (sel_end > sel_start && (input[sel_end - 1] == ' ' || input[sel_end - 1] == '\t'
0 823 while (sel_end > sel_start && (input[sel_end - 1] == ' ' || input[sel_end - 1] == '\t'
576 0 823 || input[sel_end - 1] == '\r' || input[sel_end - 1] == '\n'))
0 823 || input[sel_end - 1] == '\r' || input[sel_end - 1] == '\n'))
579 823 0 if (sel_end > sel_start) {