Expect a CDSect production, without the beginning.

Assume last_char is the fourth byte of the production that is, the next byte after the '<![' token.

Property definitions

saxophonit $ XophonReader :: expect_cd_sect
	# Expect a `CDSect` production, without the beginning.
	#
	# Assume `last_char` is the fourth byte of the production that is, the
	# next byte after the `'<!['` token.
	private fun expect_cd_sect: Bool do
		var buffer: Buffer = new FlatBuffer

		# Number of consecutive closing brackets.
		var closing = 0

		if lexer.expect_string("CDATA[",
				" at the beginning of a CDATA section.") then
			model.fire_start_cdata
			loop
				if lexer.accept(']') then
					closing += 1
				else
					for i in [0..closing[ do
						buffer.chars.push(']')
					end
					closing = 0
					if closing >= 2 and lexer.accept('>') then break
					if not lexer.expect_xml_char(buffer) then return false
				end
			end
			flush(buffer)
			model.fire_end_cdata
			return true
		else
			return false
		end
	end
lib/saxophonit/saxophonit.nit:586,2--617,4