| 2177 | } |
| 2178 | |
| 2179 | char_t* parse_exclamation(char_t* s, xml_node_struct* cursor, unsigned int optmsk, char_t endch) |
| 2180 | { |
| 2181 | // parse node contents, starting with exclamation mark |
| 2182 | ++s; |
| 2183 | |
| 2184 | if (*s == '-') // '<!-...' |
| 2185 | { |
| 2186 | ++s; |
| 2187 | |
| 2188 | if (*s == '-') // '<!--...' |
| 2189 | { |
| 2190 | ++s; |
| 2191 | |
| 2192 | if (PUGI__OPTSET(parse_comments)) |
| 2193 | { |
| 2194 | PUGI__PUSHNODE(node_comment); // Append a new node on the tree. |
| 2195 | cursor->value = s; // Save the offset. |
| 2196 | } |
| 2197 | |
| 2198 | if (PUGI__OPTSET(parse_eol) && PUGI__OPTSET(parse_comments)) |
| 2199 | { |
| 2200 | s = strconv_comment(s, endch); |
| 2201 | |
| 2202 | if (!s) PUGI__THROW_ERROR(status_bad_comment, cursor->value); |
| 2203 | } |
| 2204 | else |
| 2205 | { |
| 2206 | // Scan for terminating '-->'. |
| 2207 | PUGI__SCANFOR(s[0] == '-' && s[1] == '-' && ENDSWITH(s[2], '>')); |
| 2208 | PUGI__CHECK_ERROR(status_bad_comment, s); |
| 2209 | |
| 2210 | if (PUGI__OPTSET(parse_comments)) |
| 2211 | *s = 0; // Zero-terminate this segment at the first terminating '-'. |
| 2212 | |
| 2213 | s += (s[2] == '>' ? 3 : 2); // Step over the '\0->'. |
| 2214 | } |
| 2215 | } |
| 2216 | else PUGI__THROW_ERROR(status_bad_comment, s); |
| 2217 | } |
| 2218 | else if (*s == '[') |
| 2219 | { |
| 2220 | // '<![CDATA[...' |
| 2221 | if (*++s=='C' && *++s=='D' && *++s=='A' && *++s=='T' && *++s=='A' && *++s == '[') |
| 2222 | { |
| 2223 | ++s; |
| 2224 | |
| 2225 | if (PUGI__OPTSET(parse_cdata)) |
| 2226 | { |
| 2227 | PUGI__PUSHNODE(node_cdata); // Append a new node on the tree. |
| 2228 | cursor->value = s; // Save the offset. |
| 2229 | |
| 2230 | if (PUGI__OPTSET(parse_eol)) |
| 2231 | { |
| 2232 | s = strconv_cdata(s, endch); |
| 2233 | |
| 2234 | if (!s) PUGI__THROW_ERROR(status_bad_cdata, cursor->value); |
| 2235 | } |
| 2236 | else |
nothing calls this directly
no test coverage detected