Skip to content

Commit eb6be65

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

File tree

2 files changed

+2
-104
lines changed

2 files changed

+2
-104
lines changed

include/json/reader.h

Lines changed: 0 additions & 23 deletions
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

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

908871
// exact copy of Features
909872
class OurFeatures {
@@ -954,9 +917,6 @@ class OurReader {
954917
bool collectComments = true);
955918
std::string getFormattedErrorMessages() const;
956919
std::vector<StructuredError> getStructuredErrors() const;
957-
bool pushError(const Value& value, const std::string& message);
958-
bool pushError(const Value& value, const std::string& message, const Value& extra);
959-
bool good() const;
960920

961921
private:
962922
OurReader(OurReader const&); // no impl
@@ -1824,45 +1784,6 @@ std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
18241784
return allErrors;
18251785
}
18261786

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

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

0 commit comments

Comments
 (0)