Ensure the last read byte is equal to expected.

If it is, read the next byte. If not, fire a fatal error using context. context is the part of the message that gives the context. For example, in Unexpected `xin y. Expectingz`., the value of context is " in y".

Return true if and only if the last read byte as the expected value.

Property definitions

saxophonit $ XophonLexer :: expect
	# Ensure the last read byte is equal to `expected`.
	#
	# If it is, read the next byte. If not, fire a fatal error using
	# `context`. `context` is the part of the message that gives the context.
	# For example, in `Unexpected ``x`` in y. Expecting ``z``.`, the value of
	# `context` is `" in y"`.
	#
	# Return `true` if and only if the last read byte as the expected value.
	fun expect(expected: Char, context: String): Bool do
		return accept(expected) or
				fire_unexpected_char("{context}. Expecting `{expected}`.")
	end
lib/saxophonit/lexer.nit:336,2--347,4