#pragma once #include "object.hh" #include #include enum class TokenType : uint8_t { // Single-character tokens. LEFT_PAREN, RIGHT_PAREN, LEFT_BRACE, RIGHT_BRACE, COMMA, DOT, MINUS, PLUS, SEMICOLON, SLASH, STAR, // One or two character tokens. BANG, BANG_EQUAL, EQUAL, EQUAL_EQUAL, GREATER, GREATER_EQUAL, LESS, LESS_EQUAL, // Literals. IDENTIFIER, STRING, NUMBER, // Keywords. AND, CLASS, ELSE, FALSE, FUN, FOR, IF, NIL, OR, PRINT, RETURN, SUPER, THIS, TRUE, VAR, WHILE, EOFILE, }; struct Token { Token(TokenType type, const std::string &lexeme, Object &literal, int line) : type{type}, lexeme{lexeme}, literal{literal}, line{line} {}; TokenType type; std::string lexeme; Object &literal; int line; }; std::ostream &operator<<(std::ostream &os, const Token &token);