summaryrefslogtreecommitdiff
path: root/src/tokeniser/tokeniser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokeniser/tokeniser.c')
-rw-r--r--src/tokeniser/tokeniser.c147
1 files changed, 68 insertions, 79 deletions
diff --git a/src/tokeniser/tokeniser.c b/src/tokeniser/tokeniser.c
index 6a9396d..9a67b07 100644
--- a/src/tokeniser/tokeniser.c
+++ b/src/tokeniser/tokeniser.c
@@ -591,17 +591,6 @@ hubbub_error hubbub_tokeniser_run(hubbub_tokeniser *tokeniser)
} \
} while (0)
-#define COLLECT_NOBUF(str, length) \
- do { \
- assert(str.len != 0); \
- (str).len += (length); \
- } while (0)
-
-#define COLLECT_MS_NOBUF(str, cptr, length) \
- do { \
- (str).len += (length); \
- } while (0)
-
#define FINISH(str) \
/* no-op */
@@ -754,7 +743,7 @@ bool hubbub_tokeniser_handle_data(hubbub_tokeniser *tokeniser)
tokeniser->escape_flag = true;
}
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
} else if (c == '<' && (tokeniser->content_model ==
HUBBUB_CONTENT_MODEL_PCDATA ||
((tokeniser->content_model ==
@@ -793,7 +782,7 @@ bool hubbub_tokeniser_handle_data(hubbub_tokeniser *tokeniser)
}
}
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
} else if (c == '\0') {
if (tokeniser->context.chars.len > 0) {
/* Emit any pending characters */
@@ -830,7 +819,7 @@ bool hubbub_tokeniser_handle_data(hubbub_tokeniser *tokeniser)
parserutils_inputstream_advance(tokeniser->input, 1);
} else {
/* Just collect into buffer */
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
}
}
@@ -927,7 +916,7 @@ bool hubbub_tokeniser_handle_tag_open(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
if (c == '/') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.close_tag_match.match = false;
tokeniser->context.close_tag_match.count = 0;
@@ -946,7 +935,7 @@ bool hubbub_tokeniser_handle_tag_open(hubbub_tokeniser *tokeniser)
tokeniser->context.chars.len = 0;
tokeniser->state = STATE_MARKUP_DECLARATION_OPEN;
} else if ('A' <= c && c <= 'Z') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag_type =
HUBBUB_TOKEN_START_TAG;
@@ -956,7 +945,7 @@ bool hubbub_tokeniser_handle_tag_open(hubbub_tokeniser *tokeniser)
tokeniser->state = STATE_TAG_NAME;
} else if ('a' <= c && c <= 'z') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag_type =
HUBBUB_TOKEN_START_TAG;
@@ -965,7 +954,7 @@ bool hubbub_tokeniser_handle_tag_open(hubbub_tokeniser *tokeniser)
tokeniser->state = STATE_TAG_NAME;
} else if (c == '\0') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag_type =
HUBBUB_TOKEN_START_TAG;
@@ -976,7 +965,7 @@ bool hubbub_tokeniser_handle_tag_open(hubbub_tokeniser *tokeniser)
} else if (c == '>') {
/** \todo parse error */
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_DATA;
} else if (c == '?') {
/** \todo parse error */
@@ -1101,7 +1090,7 @@ bool hubbub_tokeniser_handle_close_tag_open(hubbub_tokeniser *tokeniser)
c = CHAR(cptr);
if ('A' <= c && c <= 'Z') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag_type =
HUBBUB_TOKEN_END_TAG;
@@ -1113,7 +1102,7 @@ bool hubbub_tokeniser_handle_close_tag_open(hubbub_tokeniser *tokeniser)
tokeniser->state = STATE_TAG_NAME;
} else if ('a' <= c && c <= 'z') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag_type =
HUBBUB_TOKEN_END_TAG;
@@ -1124,7 +1113,7 @@ bool hubbub_tokeniser_handle_close_tag_open(hubbub_tokeniser *tokeniser)
tokeniser->state = STATE_TAG_NAME;
} else if (c == '>') {
/* Cursor still at "</", need to collect ">" */
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
/* Now need to advance past "</>" */
parserutils_inputstream_advance(tokeniser->input,
@@ -1172,7 +1161,7 @@ bool hubbub_tokeniser_handle_tag_name(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
FINISH(ctag->name);
@@ -1216,7 +1205,7 @@ bool hubbub_tokeniser_handle_before_attribute_name(
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -1284,7 +1273,7 @@ bool hubbub_tokeniser_handle_attribute_name(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
FINISH(ctag->attributes[ctag->n_attributes - 1].name);
@@ -1333,17 +1322,17 @@ bool hubbub_tokeniser_handle_after_attribute_name(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
} else if (c == '=') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_BEFORE_ATTRIBUTE_VALUE;
} else if (c == '>') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
emit_current_tag(tokeniser);
tokeniser->state = STATE_DATA;
} else if (c == '/') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_SELF_CLOSING_START_TAG;
} else {
hubbub_attribute *attr;
@@ -1379,7 +1368,7 @@ bool hubbub_tokeniser_handle_after_attribute_name(hubbub_tokeniser *tokeniser)
ctag->n_attributes++;
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_ATTRIBUTE_NAME;
}
@@ -1406,27 +1395,27 @@ bool hubbub_tokeniser_handle_before_attribute_value(
uint8_t c = CHAR(cptr);
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
} else if (c == '"') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_ATTRIBUTE_VALUE_DQ;
} else if (c == '&') {
tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
} else if (c == '\'') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_ATTRIBUTE_VALUE_SQ;
} else if (c == '>') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
emit_current_tag(tokeniser);
tokeniser->state = STATE_DATA;
} else if (c == '\0') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
u_fffd, sizeof(u_fffd));
tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
} else {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
START_BUF(ctag->attributes[ctag->n_attributes - 1].value,
(uint8_t *)cptr, len);
tokeniser->state = STATE_ATTRIBUTE_VALUE_UQ;
@@ -1455,7 +1444,7 @@ bool hubbub_tokeniser_handle_attribute_value_dq(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
if (c == '"') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
FINISH(ctag->attributes[ctag->n_attributes - 1].value);
tokeniser->state = STATE_AFTER_ATTRIBUTE_VALUE_Q;
} else if (c == '&') {
@@ -1464,7 +1453,7 @@ bool hubbub_tokeniser_handle_attribute_value_dq(hubbub_tokeniser *tokeniser)
tokeniser->context.allowed_char = '"';
/* Don't eat the '&'; it'll be handled by entity consumption */
} else if (c == '\0') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT(ctag->attributes[ctag->n_attributes - 1].value,
u_fffd, sizeof(u_fffd));
} else if (c == '\r') {
@@ -1482,9 +1471,9 @@ bool hubbub_tokeniser_handle_attribute_value_dq(hubbub_tokeniser *tokeniser)
&lf, sizeof(lf));
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
} else {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT_MS(ctag->attributes[ctag->n_attributes - 1].value,
cptr, len);
}
@@ -1512,7 +1501,7 @@ bool hubbub_tokeniser_handle_attribute_value_sq(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
if (c == '\'') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
FINISH(ctag->attributes[ctag->n_attributes - 1].value);
tokeniser->state =
STATE_AFTER_ATTRIBUTE_VALUE_Q;
@@ -1522,7 +1511,7 @@ bool hubbub_tokeniser_handle_attribute_value_sq(hubbub_tokeniser *tokeniser)
tokeniser->context.allowed_char = '\'';
/* Don't eat the '&'; it'll be handled by entity consumption */
} else if (c == '\0') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT(ctag->attributes[ctag->n_attributes - 1].value,
u_fffd, sizeof(u_fffd));
} else if (c == '\r') {
@@ -1540,9 +1529,9 @@ bool hubbub_tokeniser_handle_attribute_value_sq(hubbub_tokeniser *tokeniser)
&lf, sizeof(lf));
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
} else {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT_MS(ctag->attributes[ctag->n_attributes - 1].value,
cptr, len);
}
@@ -1571,7 +1560,7 @@ bool hubbub_tokeniser_handle_attribute_value_uq(hubbub_tokeniser *tokeniser)
c = CHAR(cptr);
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
FINISH(ctag->attributes[ctag->n_attributes - 1].value);
tokeniser->state = STATE_BEFORE_ATTRIBUTE_NAME;
} else if (c == '&') {
@@ -1579,13 +1568,13 @@ bool hubbub_tokeniser_handle_attribute_value_uq(hubbub_tokeniser *tokeniser)
tokeniser->state = STATE_CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE;
/* Don't eat the '&'; it'll be handled by entity consumption */
} else if (c == '>') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
FINISH(ctag->attributes[ctag->n_attributes - 1].value);
emit_current_tag(tokeniser);
tokeniser->state = STATE_DATA;
} else if (c == '\0') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT(ctag->attributes[ctag->n_attributes - 1].value,
u_fffd, sizeof(u_fffd));
} else {
@@ -1593,7 +1582,7 @@ bool hubbub_tokeniser_handle_attribute_value_uq(hubbub_tokeniser *tokeniser)
/** \todo parse error */
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT(ctag->attributes[ctag->n_attributes - 1].value,
cptr, len);
}
@@ -1622,9 +1611,9 @@ bool hubbub_tokeniser_handle_character_reference_in_attribute_value(
&utf8ptr, &len);
/* +1 for the ampersand */
- COLLECT_NOBUF(tokeniser->context.chars,
+ tokeniser->context.chars.len +=
tokeniser->context.match_entity.length
- + 1);
+ + 1;
if (attr->value.len == 0) {
START_BUF(attr->value,
@@ -1639,7 +1628,7 @@ bool hubbub_tokeniser_handle_character_reference_in_attribute_value(
tokeniser->context.chars.len, &len);
/* Insert the ampersand */
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
COLLECT_MS(attr->value, cptr, len);
}
@@ -1671,15 +1660,15 @@ bool hubbub_tokeniser_handle_after_attribute_value_q(
uint8_t c = CHAR(cptr);
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_BEFORE_ATTRIBUTE_NAME;
} else if (c == '>') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
emit_current_tag(tokeniser);
tokeniser->state = STATE_DATA;
} else if (c == '/') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_SELF_CLOSING_START_TAG;
} else {
/** \todo parse error */
@@ -1706,7 +1695,7 @@ bool hubbub_tokeniser_handle_self_closing_start_tag(
uint8_t c = CHAR(cptr);
if (c == '>') {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.current_tag.self_closing = true;
emit_current_tag(tokeniser);
@@ -1739,7 +1728,7 @@ bool hubbub_tokeniser_handle_bogus_comment(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
if (c == '>') {
tokeniser->context.current_comment.ptr =
@@ -1765,7 +1754,7 @@ bool hubbub_tokeniser_handle_bogus_comment(hubbub_tokeniser *tokeniser)
comment->len += sizeof(lf);
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
} else {
parserutils_buffer_append(tokeniser->buffer,
(uint8_t *)cptr, len);
@@ -1868,7 +1857,7 @@ bool hubbub_tokeniser_handle_comment(hubbub_tokeniser *tokeniser)
if (c == '>' && (tokeniser->state == STATE_COMMENT_START_DASH ||
tokeniser->state == STATE_COMMENT_START ||
tokeniser->state == STATE_COMMENT_END)) {
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
/** \todo parse error if state != COMMENT_END */
tokeniser->context.current_comment.ptr =
@@ -1891,7 +1880,7 @@ bool hubbub_tokeniser_handle_comment(hubbub_tokeniser *tokeniser)
comment->len += SLEN("-");
}
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
} else {
if (tokeniser->state == STATE_COMMENT_START_DASH ||
tokeniser->state == STATE_COMMENT_END_DASH) {
@@ -1927,7 +1916,7 @@ bool hubbub_tokeniser_handle_comment(hubbub_tokeniser *tokeniser)
comment->len += len;
}
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
tokeniser->state = STATE_COMMENT;
}
@@ -1968,7 +1957,7 @@ bool hubbub_tokeniser_handle_match_doctype(hubbub_tokeniser *tokeniser)
return true;
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (tokeniser->context.match_doctype.count == DOCTYPE_LEN) {
/* Skip over the DOCTYPE bit */
@@ -2008,7 +1997,7 @@ bool hubbub_tokeniser_handle_doctype(hubbub_tokeniser *tokeniser)
uint8_t c = CHAR(cptr);
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
}
tokeniser->state = STATE_BEFORE_DOCTYPE_NAME;
@@ -2033,7 +2022,7 @@ bool hubbub_tokeniser_handle_before_doctype_name(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -2071,7 +2060,7 @@ bool hubbub_tokeniser_handle_doctype_name(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
FINISH(cdoc->name);
@@ -2104,7 +2093,7 @@ bool hubbub_tokeniser_handle_after_doctype_name(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -2152,7 +2141,7 @@ bool hubbub_tokeniser_handle_match_public(hubbub_tokeniser *tokeniser)
return true;
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (tokeniser->context.match_doctype.count == PUBLIC_LEN) {
tokeniser->state = STATE_BEFORE_DOCTYPE_PUBLIC;
@@ -2182,7 +2171,7 @@ bool hubbub_tokeniser_handle_before_doctype_public(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -2222,7 +2211,7 @@ bool hubbub_tokeniser_handle_doctype_public_dq(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '"') {
FINISH(cdoc->public_id);
@@ -2273,7 +2262,7 @@ bool hubbub_tokeniser_handle_doctype_public_sq(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\'') {
FINISH(cdoc->public_id);
@@ -2326,7 +2315,7 @@ bool hubbub_tokeniser_handle_after_doctype_public(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -2380,7 +2369,7 @@ bool hubbub_tokeniser_handle_match_system(hubbub_tokeniser *tokeniser)
return true;
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (tokeniser->context.match_doctype.count == SYSTEM_LEN) {
tokeniser->state = STATE_BEFORE_DOCTYPE_SYSTEM;
@@ -2410,7 +2399,7 @@ bool hubbub_tokeniser_handle_before_doctype_system(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
} else if (c == '"') {
@@ -2451,7 +2440,7 @@ bool hubbub_tokeniser_handle_doctype_system_dq(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '"') {
FINISH(cdoc->system_id);
@@ -2503,7 +2492,7 @@ bool hubbub_tokeniser_handle_doctype_system_sq(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\'') {
FINISH(cdoc->system_id);
@@ -2553,7 +2542,7 @@ bool hubbub_tokeniser_handle_after_doctype_system(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '\t' || c == '\n' || c == '\f' || c == ' ' || c == '\r') {
/* pass over in silence */
@@ -2583,7 +2572,7 @@ bool hubbub_tokeniser_handle_bogus_doctype(hubbub_tokeniser *tokeniser)
}
uint8_t c = CHAR(cptr);
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (c == '>') {
emit_current_doctype(tokeniser, false);
@@ -2626,7 +2615,7 @@ bool hubbub_tokeniser_handle_match_cdata(hubbub_tokeniser *tokeniser)
return true;
}
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
if (tokeniser->context.match_cdata.count == CDATA_LEN) {
parserutils_inputstream_advance(tokeniser->input,
@@ -2663,7 +2652,7 @@ bool hubbub_tokeniser_handle_cdata_block(hubbub_tokeniser *tokeniser)
if (c == ']' && (tokeniser->context.match_cdata.end == 0 ||
tokeniser->context.match_cdata.end == 1)) {
- COLLECT_NOBUF(tokeniser->context.chars, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.match_cdata.end += len;
} else if (c == '>' && tokeniser->context.match_cdata.end == 2) {
/* Remove the previous two "]]" */
@@ -2712,7 +2701,7 @@ bool hubbub_tokeniser_handle_cdata_block(hubbub_tokeniser *tokeniser)
parserutils_inputstream_advance(tokeniser->input, len);
tokeniser->context.match_cdata.end = 0;
} else {
- COLLECT_MS_NOBUF(tokeniser->context.chars, cptr, len);
+ tokeniser->context.chars.len += len;
tokeniser->context.match_cdata.end = 0;
}