Read a string until the end of the line and append it to s.

Unlike read_line and other related methods, the line terminator '\n', if any, is preserved in each line. Use the method Text::chomp to safely remove it.

var txt = "Hello\n\nWorld\n"
var i = new StringReader(txt)
var b = new FlatBuffer
i.append_line_to(b)
assert b == "Hello\n"
i.append_line_to(b)
assert b == "Hello\n\n"
i.append_line_to(b)
assert b == txt
assert i.eof

If \n is not present at the end of the result, it means that a non-eol terminated last line was returned.

var i2 = new StringReader("hello")
assert not i2.eof
var b2 = new FlatBuffer
i2.append_line_to(b2)
assert b2 == "hello"
assert i2.eof

NOTE: The single character LINE FEED (\n) delimits the end of lines. Therefore CARRIAGE RETURN & LINE FEED (\r\n) is also recognized.

Property definitions

core $ Reader :: append_line_to
	# Read a string until the end of the line and append it to `s`.
	#
	# Unlike `read_line` and other related methods,
	# the line terminator '\n', if any, is preserved in each line.
	# Use the method `Text::chomp` to safely remove it.
	#
	# ~~~
	# var txt = "Hello\n\nWorld\n"
	# var i = new StringReader(txt)
	# var b = new FlatBuffer
	# i.append_line_to(b)
	# assert b == "Hello\n"
	# i.append_line_to(b)
	# assert b == "Hello\n\n"
	# i.append_line_to(b)
	# assert b == txt
	# assert i.eof
	# ~~~
	#
	# If `\n` is not present at the end of the result, it means that
	# a non-eol terminated last line was returned.
	#
	# ~~~
	# var i2 = new StringReader("hello")
	# assert not i2.eof
	# var b2 = new FlatBuffer
	# i2.append_line_to(b2)
	# assert b2 == "hello"
	# assert i2.eof
	# ~~~
	#
	# NOTE: The single character LINE FEED (`\n`) delimits the end of lines.
	# Therefore CARRIAGE RETURN & LINE FEED (`\r\n`) is also recognized.
	fun append_line_to(s: Buffer)
	do
		if last_error != null then return
		loop
			var x = read_char
			if x == null then
				if eof then return
			else
				s.chars.push(x)
				if x == '\n' then return
			end
		end
	end
lib/core/stream.nit:369,2--414,4