Skip to content

Commit 1b09a82

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

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

964924
private:
965925
OurReader(OurReader const&); // no impl
@@ -1801,45 +1761,6 @@ std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
18011761
return allErrors;
18021762
}
18031763

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

18441765
class OurCharReader : public CharReader {
18451766
bool const collectComments_;

0 commit comments

Comments
 (0)