@@ -334,11 +334,12 @@ static inline str parse_name(document* d)
334static inline str parse_attrval(document* d)
334static inline str parse_attrval(document* d)
337− if (get(d) != '=')
337+ if (peek(d) != '=')
339 set_error(d, "Expected = in attribute, but missing");
339 set_error(d, "Expected = in attribute, but missing");
340 return start_length(0, 0);
340 return start_length(0, 0);
343 char c = peek(d);
344 char c = peek(d);
344 if (c == '\"' || c == '\'')
345 if (c == '\"' || c == '\'')
@@ -403,10 +404,10 @@ static inline void parse_tag(document* d)
403 me->attrs = parse_attributes(d);
404 me->attrs = parse_attributes(d);
404 if (d->error_message != NULL) return;
405 if (d->error_message != NULL) return;
406− c = get(d);
407+ c = peek(d);
407− if ((c == '/' || c == '?') && peek(d) == '>')
408+ if ((c == '/' || c == '?') && peekAt(d, 1) == '>')
409− skip(d, 1);
410+ skip(d, 2);
410 me->nodes = start_length(0, 0);
411 me->nodes = start_length(0, 0);
411 me->outer.length = start_end(me->outer.start, doc_position(d)).length;
412 me->outer.length = start_end(me->outer.start, doc_position(d)).length;
412 me->inner = start_length(doc_position(d), 0);
413 me->inner = start_length(doc_position(d), 0);
@@ -417,6 +418,8 @@ static inline void parse_tag(document* d)
417 set_error(d, "Gunk at the end of the tag");
418 set_error(d, "Gunk at the end of the tag");
420 me->inner.start = doc_position(d);
423 me->inner.start = doc_position(d);
421 str content = parse_content(d);
424 str content = parse_content(d);