#ifndef TOKENIZER_HPP #define TOKENIZER_HPP #include "webserv.hpp" #include "tomlstuff.hpp" #include #include #include #include #include #include namespace config { enum e_token { KEY, NEWLINE, ASSIGN, STRING, NUMBER, COMMA, BOOL, NIL, OPEN_BRACKET, CLOSE_BRACKET, MAP_DECL, MAPARRAY_DECL }; struct s_token { std::string value; e_token type; /* std::string to_string(void); */ }; bool isspace(char c); bool istomlkey(char c); class Tokenizer { private: std::fstream file; size_t prev_pos; e_token last_token; public: Tokenizer(std::string filename); char getWithoutWhiteSpace(); struct s_token getToken(); bool hasMoreTokens(); bool firstToken(); void rollBackToken(); void set_last(e_token type); }; /* struct s_token Tokenizer::getKey(void) */ /* { */ /* char c; */ /* struct s_token token; */ /* if (file.eof()) */ /* { */ /* std::cout << "Tokens exhausted" << std::endl; */ /* } */ /* } */ } #endif