Skip to content

Commit e41984c

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

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 {
@@ -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
@@ -1818,45 +1778,6 @@ std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
18181778
return allErrors;
18191779
}
18201780

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

18611782
class OurCharReader : public CharReader {
18621783
bool const collectComments_;

0 commit comments

Comments
 (0)