#include #include #include #include #include "include/lexer.hpp" using std::string, std::cin, std::cout, std::getline, std::vector, std::begin, std::end; string types[] = {string(1, '+'), string(1, '-'), string(1, '/'), string(1, '*'), string(1, '^'), "variable", "número", "función", string(1, '('), string(1, ')'), "nil"}; void print_tokens(const vector< Token > &tokens){ for(auto i = begin(tokens); i != end(tokens); ++i) { if(i->type == variable || i->type == number || i->type == function) cout << "Tipo: " << types[i->type] << "\nValor: " << i->value << '\n'; else cout << "Tipo: " << types[i->type] << '\n'; } } int main(){ vector< Token > tokens; string input; Lexer lexer; getline(cin, input); lexer.setText(input); while(lexer.getCurrentToken().type != nil) { tokens.push_back(lexer.getCurrentToken()); lexer.nextToken(); } print_tokens(tokens); return 0; }