1 #ifndef __RAT_DBTextLoader__
2 #define __RAT_DBTextLoader__
4 #include <RAT/DBExceptions.hh>
29 Tokenizer(std::string doc, std::string _filename =
"");
30 Tokenizer::Type Next();
31 std::string Token() {
return token; };
32 int AsInt() {
return intval; };
33 double AsDouble() {
return doubleval; };
35 void RaiseError(std::string message);
36 void RaiseProbablyJSONError(std::string message);
38 std::string GetFilename()
const {
return filename; };
40 inline bool Eof() {
return eof; };
42 static bool IsValType(Tokenizer::Type type) {
43 return type == TYPE_STRING || type == TYPE_INTEGER || type == TYPE_DOUBLE;
71 static const std::string number_char;
72 static const std::string symbol_char;
73 static const std::string quote_char;
74 static const std::string hex_char;
82 void Push(
Tokenizer tokenizer) { stack.push(tokenizer); };
85 Tokenizer::Type Next();
86 std::string Token() {
return stack.top().Token(); };
87 int AsInt() {
return stack.top().AsInt(); };
88 double AsDouble() {
return stack.top().AsDouble(); };
90 void RaiseError(std::string message) { stack.top().RaiseError(message); };
91 void RaiseProbablyJSONError(std::string message) { stack.top().RaiseProbablyJSONError(message); };
93 bool Eof() {
return stack.top().Eof(); };
95 std::string GetCurrentFilename()
const {
return stack.top().GetFilename(); };
98 std::stack<Tokenizer> stack;
104 Parser(std::string str, std::string filename) : tokenizer(
Tokenizer(str, filename)){};
127 static std::vector<RAT::DBTable *>
parse(std::string filename);
Definition: DBTable.hh:25
Definition: DBTextLoader.hh:124
static std::vector< RAT::DBTable * > parse(std::string filename)
Definition: DBTextLoader.cc:529
Definition: DBTextLoader.hh:102
Definition: DBTextLoader.hh:78
Definition: DBTextLoader.hh:16
Definition: CCCrossSecMessenger.hh:29