EmptyElemTag | STag | ETag | Reference | CDSect | PI | Comment | CharData
production.If the last read byte matches the CharData
production, push the char in
char_data
. Else, flush CharData
as a characters
event.
# Parse a `EmptyElemTag | STag | ETag | Reference | CDSect | PI | Comment | CharData` production.
#
# If the last read byte matches the `CharData` production, push the char in
# `char_data`. Else, flush `CharData` as a `characters` event.
private fun expect_content_chunk(char_data: Buffer): Bool do
if lexer.accept('<') then
flush(char_data)
if lexer.accept('!') then
if lexer.accept('-') then
return lexer.expect('-',
" at the beginning of a comment") and
expect_comment
else if lexer.accept('[') then
return expect_cd_sect
else
return lexer.fire_unexpected_char(
". Expecting `--` or `[CDATA[`")
end
else if lexer.accept('?') then
return expect_pi
else if lexer.accept('/') then
return expect_etag
else
return expect_stag
end
else if lexer.accept('&') then
flush(char_data)
var success = expect_reference(char_data)
flush(char_data)
return success
else
return lexer.expect_xml_char(char_data)
end
end
lib/saxophonit/saxophonit.nit:273,2--306,4