#ifndef YERBACON_LEX_H #define YERBACON_LEX_H #include "Yerbacon.hpp" #include #include struct tok { typedef Yerbacon::Exception LexerException; enum type: const unsigned short { UNEXPECTED = std::numeric_limits::max() + 1, IDENTIFIER, NUMBER, ALPHACHAR, EOF_ = '\0', DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', DOT = '.', LPAR = '(', LBRACE = '{', LBRACKET = '[', RPAR = ')', RBRACE = '}', RBRACKET = ']', PLUS = '+', HYPHEN = '-', DIVIDE = '/', LCOMP = '>', RCOMP = '<', SQUOTE = '\'', ASTERISK = '*', STRING = '"', }; const type toktype; const std::string toktext; const unsigned long line; tok(const type& Type, std::string_view Text, const decltype(line)& line = 0): toktype(Type), toktext(Text), line(line) {} explicit tok(const type& Type, const decltype(line)& line = 0): tok(Type, std::string(1, Type), line) {}; friend std::ostream& operator<<(std::ostream& output, const tok& it) { return output << it.toktext; } }; std::vector lex(const std::string& in); #endif //YERBACON_TEST_H