Add EOF check in determine_bracket_type()

Also converts EOF `error()`s into throwing `EOFError()`s