Skip to content

Commit bd2aa77

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

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
@@ -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 {
@@ -956,9 +919,6 @@ class OurReader {
956919
bool collectComments = true);
957920
std::string getFormattedErrorMessages() const;
958921
std::vector<StructuredError> getStructuredErrors() const;
959-
bool pushError(const Value& value, const std::string& message);
960-
bool pushError(const Value& value, const std::string& message, const Value& extra);
961-
bool good() const;
962922

963923
private:
964924
OurReader(OurReader const&); // no impl
@@ -1794,45 +1754,6 @@ std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
17941754
return allErrors;
17951755
}
17961756

1797-
bool OurReader::pushError(const Value& value, const std::string& message) {
1798-
size_t length = end_ - begin_;
1799-
if(value.getOffsetStart() > length
1800-
|| value.getOffsetLimit() > length)
1801-
return false;
1802-
Token token;
1803-
token.type_ = tokenError;
1804-
token.start_ = begin_ + value.getOffsetStart();
1805-
token.end_ = end_ + value.getOffsetLimit();
1806-
ErrorInfo info;
1807-
info.token_ = token;
1808-
info.message_ = message;
1809-
info.extra_ = 0;
1810-
errors_.push_back(info);
1811-
return true;
1812-
}
1813-
1814-
bool OurReader::pushError(const Value& value, const std::string& message, const Value& extra) {
1815-
size_t length = end_ - begin_;
1816-
if(value.getOffsetStart() > length
1817-
|| value.getOffsetLimit() > length
1818-
|| extra.getOffsetLimit() > length)
1819-
return false;
1820-
Token token;
1821-
token.type_ = tokenError;
1822-
token.start_ = begin_ + value.getOffsetStart();
1823-
token.end_ = begin_ + value.getOffsetLimit();
1824-
ErrorInfo info;
1825-
info.token_ = token;
1826-
info.message_ = message;
1827-
info.extra_ = begin_ + extra.getOffsetStart();
1828-
errors_.push_back(info);
1829-
return true;
1830-
}
1831-
1832-
bool OurReader::good() const {
1833-
return !errors_.size();
1834-
}
1835-
18361757

18371758
class OurCharReader : public CharReader {
18381759
bool const collectComments_;

0 commit comments

Comments
 (0)