Skip to content

Commit a67d378

Browse files
committed
revert 'Add public semantic error reporting'
for binary-compatibility with 0.6.0 issue #147 was #57
1 parent e7f6e91 commit a67d378

File tree

2 files changed

+2
-104
lines changed

2 files changed

+2
-104
lines changed

include/json/reader.h

-23
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,6 @@ class JSON_API Reader {
132132
*/
133133
std::vector<StructuredError> getStructuredErrors() const;
134134

135-
/** \brief Add a semantic error message.
136-
* \param value JSON Value location associated with the error
137-
* \param message The error message.
138-
* \return \c true if the error was successfully added, \c false if the
139-
* Value offset exceeds the document size.
140-
*/
141-
bool pushError(const Value& value, const std::string& message);
142-
143-
/** \brief Add a semantic error message with extra context.
144-
* \param value JSON Value location associated with the error
145-
* \param message The error message.
146-
* \param extra Additional JSON Value location to contextualize the error
147-
* \return \c true if the error was successfully added, \c false if either
148-
* Value offset exceeds the document size.
149-
*/
150-
bool pushError(const Value& value, const std::string& message, const Value& extra);
151-
152-
/** \brief Return whether there are any errors.
153-
* \return \c true if there are no errors to report \c false if
154-
* errors have occurred.
155-
*/
156-
bool good() const;
157-
158135
private:
159136
enum TokenType {
160137
tokenEndOfStream = 0,

src/lib_json/json_reader.cpp

+2-81
Original file line numberDiff line numberDiff line change
@@ -864,45 +864,8 @@ std::vector<Reader::StructuredError> Reader::getStructuredErrors() const {
864864
}
865865
return allErrors;
866866
}
867-
868-
bool Reader::pushError(const Value& value, const std::string& message) {
869-
size_t length = end_ - begin_;
870-
if(value.getOffsetStart() > length
871-
|| value.getOffsetLimit() > length)
872-
return false;
873-
Token token;
874-
token.type_ = tokenError;
875-
token.start_ = begin_ + value.getOffsetStart();
876-
token.end_ = end_ + value.getOffsetLimit();
877-
ErrorInfo info;
878-
info.token_ = token;
879-
info.message_ = message;
880-
info.extra_ = 0;
881-
errors_.push_back(info);
882-
return true;
883-
}
884-
885-
bool Reader::pushError(const Value& value, const std::string& message, const Value& extra) {
886-
size_t length = end_ - begin_;
887-
if(value.getOffsetStart() > length
888-
|| value.getOffsetLimit() > length
889-
|| extra.getOffsetLimit() > length)
890-
return false;
891-
Token token;
892-
token.type_ = tokenError;
893-
token.start_ = begin_ + value.getOffsetStart();
894-
token.end_ = begin_ + value.getOffsetLimit();
895-
ErrorInfo info;
896-
info.token_ = token;
897-
info.message_ = message;
898-
info.extra_ = begin_ + extra.getOffsetStart();
899-
errors_.push_back(info);
900-
return true;
901-
}
902-
903-
bool Reader::good() const {
904-
return !errors_.size();
905-
}
867+
// Reader
868+
/////////////////////////
906869

907870
// exact copy of Features
908871
class OurFeatures {
@@ -953,9 +916,6 @@ class OurReader {
953916
bool collectComments = true);
954917
std::string getFormattedErrorMessages() const;
955918
std::vector<StructuredError> getStructuredErrors() const;
956-
bool pushError(const Value& value, const std::string& message);
957-
bool pushError(const Value& value, const std::string& message, const Value& extra);
958-
bool good() const;
959919

960920
private:
961921
OurReader(OurReader const&); // no impl
@@ -1823,45 +1783,6 @@ std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
18231783
return allErrors;
18241784
}
18251785

1826-
bool OurReader::pushError(const Value& value, const std::string& message) {
1827-
size_t length = end_ - begin_;
1828-
if(value.getOffsetStart() > length
1829-
|| value.getOffsetLimit() > length)
1830-
return false;
1831-
Token token;
1832-
token.type_ = tokenError;
1833-
token.start_ = begin_ + value.getOffsetStart();
1834-
token.end_ = end_ + value.getOffsetLimit();
1835-
ErrorInfo info;
1836-
info.token_ = token;
1837-
info.message_ = message;
1838-
info.extra_ = 0;
1839-
errors_.push_back(info);
1840-
return true;
1841-
}
1842-
1843-
bool OurReader::pushError(const Value& value, const std::string& message, const Value& extra) {
1844-
size_t length = end_ - begin_;
1845-
if(value.getOffsetStart() > length
1846-
|| value.getOffsetLimit() > length
1847-
|| extra.getOffsetLimit() > length)
1848-
return false;
1849-
Token token;
1850-
token.type_ = tokenError;
1851-
token.start_ = begin_ + value.getOffsetStart();
1852-
token.end_ = begin_ + value.getOffsetLimit();
1853-
ErrorInfo info;
1854-
info.token_ = token;
1855-
info.message_ = message;
1856-
info.extra_ = begin_ + extra.getOffsetStart();
1857-
errors_.push_back(info);
1858-
return true;
1859-
}
1860-
1861-
bool OurReader::good() const {
1862-
return !errors_.size();
1863-
}
1864-
18651786

18661787
class OurCharReader : public CharReader {
18671788
bool const collectComments_;

0 commit comments

Comments
 (0)