| 2003 | } |
| 2004 | |
| 2005 | char_t* parse_exclamation(char_t* s, xml_node_struct* cursor, unsigned int optmsk, char_t endch) |
| 2006 | { |
| 2007 | // parse node contents, starting with exclamation mark |
| 2008 | ++s; |
| 2009 | |
| 2010 | if (*s == '-') // '<!-...' |
| 2011 | { |
| 2012 | ++s; |
| 2013 | |
| 2014 | if (*s == '-') // '<!--...' |
| 2015 | { |
| 2016 | ++s; |
| 2017 | |
| 2018 | if (OPTSET(parse_comments)) |
| 2019 | { |
| 2020 | PUSHNODE(node_comment); // Append a new node on the tree. |
| 2021 | cursor->value = s; // Save the offset. |
| 2022 | } |
| 2023 | |
| 2024 | if (OPTSET(parse_eol) && OPTSET(parse_comments)) |
| 2025 | { |
| 2026 | s = strconv_comment(s, endch); |
| 2027 | |
| 2028 | if (!s) THROW_ERROR(status_bad_comment, cursor->value); |
| 2029 | } |
| 2030 | else |
| 2031 | { |
| 2032 | // Scan for terminating '-->'. |
| 2033 | SCANFOR(s[0] == '-' && s[1] == '-' && ENDSWITH(s[2], '>')); |
| 2034 | CHECK_ERROR(status_bad_comment, s); |
| 2035 | |
| 2036 | if (OPTSET(parse_comments)) |
| 2037 | *s = 0; // Zero-terminate this segment at the first terminating '-'. |
| 2038 | |
| 2039 | s += (s[2] == '>' ? 3 : 2); // Step over the '\0->'. |
| 2040 | } |
| 2041 | } |
| 2042 | else THROW_ERROR(status_bad_comment, s); |
| 2043 | } |
| 2044 | else if (*s == '[') |
| 2045 | { |
| 2046 | // '<![CDATA[...' |
| 2047 | if (*++s=='C' && *++s=='D' && *++s=='A' && *++s=='T' && *++s=='A' && *++s == '[') |
| 2048 | { |
| 2049 | ++s; |
| 2050 | |
| 2051 | if (OPTSET(parse_cdata)) |
| 2052 | { |
| 2053 | PUSHNODE(node_cdata); // Append a new node on the tree. |
| 2054 | cursor->value = s; // Save the offset. |
| 2055 | |
| 2056 | if (OPTSET(parse_eol)) |
| 2057 | { |
| 2058 | s = strconv_cdata(s, endch); |
| 2059 | |
| 2060 | if (!s) THROW_ERROR(status_bad_cdata, cursor->value); |
| 2061 | } |
| 2062 | else |
nothing calls this directly
no test coverage detected