| 2446 | } |
| 2447 | |
| 2448 | char_t* parse_exclamation(char_t* s, xml_node_struct* cursor, unsigned int optmsk, char_t endch) |
| 2449 | { |
| 2450 | // parse node contents, starting with exclamation mark |
| 2451 | ++s; |
| 2452 | |
| 2453 | if (*s == '-') // '<!-...' |
| 2454 | { |
| 2455 | ++s; |
| 2456 | |
| 2457 | if (*s == '-') // '<!--...' |
| 2458 | { |
| 2459 | ++s; |
| 2460 | |
| 2461 | if (PUGI__OPTSET(parse_comments)) |
| 2462 | { |
| 2463 | PUGI__PUSHNODE(node_comment); // Append a new node on the tree. |
| 2464 | cursor->value = s; // Save the offset. |
| 2465 | } |
| 2466 | |
| 2467 | if (PUGI__OPTSET(parse_eol) && PUGI__OPTSET(parse_comments)) |
| 2468 | { |
| 2469 | s = strconv_comment(s, endch); |
| 2470 | |
| 2471 | if (!s) |
| 2472 | PUGI__THROW_ERROR(status_bad_comment, cursor->value); |
| 2473 | } |
| 2474 | else |
| 2475 | { |
| 2476 | // Scan for terminating '-->'. |
| 2477 | PUGI__SCANFOR(s[0] == '-' && s[1] == '-' && ENDSWITH(s[2], '>')); |
| 2478 | PUGI__CHECK_ERROR(status_bad_comment, s); |
| 2479 | |
| 2480 | if (PUGI__OPTSET(parse_comments)) |
| 2481 | *s = 0; // Zero-terminate this segment at the first terminating '-'. |
| 2482 | |
| 2483 | s += (s[2] == '>' ? 3 : 2); // Step over the '\0->'. |
| 2484 | } |
| 2485 | } |
| 2486 | else |
| 2487 | PUGI__THROW_ERROR(status_bad_comment, s); |
| 2488 | } |
| 2489 | else if (*s == '[') |
| 2490 | { |
| 2491 | // '<![CDATA[...' |
| 2492 | if (*++s == 'C' && *++s == 'D' && *++s == 'A' && *++s == 'T' && *++s == 'A' && *++s == '[') |
| 2493 | { |
| 2494 | ++s; |
| 2495 | |
| 2496 | if (PUGI__OPTSET(parse_cdata)) |
| 2497 | { |
| 2498 | PUGI__PUSHNODE(node_cdata); // Append a new node on the tree. |
| 2499 | cursor->value = s; // Save the offset. |
| 2500 | |
| 2501 | if (PUGI__OPTSET(parse_eol)) |
| 2502 | { |
| 2503 | s = strconv_cdata(s, endch); |
| 2504 | |
| 2505 | if (!s) |
nothing calls this directly
no test coverage detected