summaryrefslogtreecommitdiff
path: root/libjsonpp/jsonFlexLexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'libjsonpp/jsonFlexLexer.h')
-rw-r--r--libjsonpp/jsonFlexLexer.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/libjsonpp/jsonFlexLexer.h b/libjsonpp/jsonFlexLexer.h
index 43770d5..bbd6b95 100644
--- a/libjsonpp/jsonFlexLexer.h
+++ b/libjsonpp/jsonFlexLexer.h
@@ -2,41 +2,45 @@
#define JSONFLEXLEXER_H
#include <string>
-#include "jsonpp.h"
-#include <stack>
-#include <functional>
+#include <stdexcept>
#ifndef FLEX_SCANNER
+#define yyFlexLexer jsonBaseFlexLexer
#include <FlexLexer.h>
#endif
namespace json {
+#pragma GCC visibility push(default)
+ class ParseError : public std::invalid_argument {
+ public:
+ ParseError(const char *, int, int);
+ };
+
class jsonFlexLexer : public yyFlexLexer {
public:
- jsonFlexLexer(std::istream &, std::string enc, Value & v);
+ jsonFlexLexer(std::istream &, std::string enc);
int yylex() override;
- void LexerError(const char * msg) override;
- void BeginObject();
- void BeginArray();
+ private:
+ virtual void BeginObject() = 0;
+ virtual void BeginArray() = 0;
- void PushBoolean(bool);
- void PushNumber(double);
- void PushNull();
- void PushText(std::string &&);
+ virtual void PushBoolean(bool) = 0;
+ virtual void PushNumber(double) = 0;
+ virtual void PushNull() = 0;
+ virtual void PushText(std::string &&) = 0;
+ virtual void PushKey(std::string &&) = 0;
- void EndArray();
- void EndObject();
+ virtual void EndArray() = 0;
+ virtual void EndObject() = 0;
- private:
+ void LexerError(const char * msg) override;
std::string encodeBuf() const;
- std::string buf, name;
+ std::string buf;
const std::string encoding;
-
- using AcceptValue = std::function<Value *(Value &&)>;
- std::stack<AcceptValue> acceptValues;
};
+#pragma GCC visibility pop
}
#endif