Read the next sequence of non whitespace characters.

Leading whitespace characters are skipped. The first whitespace character that follows the result is consumed.

An empty string is returned if the end of the file or an error is encounter.

var w = new StringReader(" Hello, \n\t World!")
assert w.read_word == "Hello,"
assert w.read_char == '\n'
assert w.read_word == "World!"
assert w.read_word == ""

Char::is_whitespace determines what is a whitespace.

Property definitions

core $ Reader :: read_word
	# Read the next sequence of non whitespace characters.
	#
	# Leading whitespace characters are skipped.
	# The first whitespace character that follows the result is consumed.
	#
	# An empty string is returned if the end of the file or an error is encounter.
	#
	# ~~~
	# var w = new StringReader(" Hello, \n\t World!")
	# assert w.read_word == "Hello,"
	# assert w.read_char == '\n'
	# assert w.read_word == "World!"
	# assert w.read_word == ""
	# ~~~
	#
	# `Char::is_whitespace` determines what is a whitespace.
	fun read_word: String
	do
		var buf = new FlatBuffer
		var c = read_nonwhitespace
		if c != null then
			buf.add(c)
			while not eof do
				c = read_char
				if c == null then break
				if c.is_whitespace then break
				buf.add(c)
			end
		end
		var res = buf.to_s
		return res
	end
lib/core/stream.nit:424,2--455,4