| | |
| | | #ifndef TOKEN_HPP |
| | | #define TOKEN_HPP |
| | | #include <cstdint> |
| | | #include <iostream> |
| | | #include <string> |
| | | #include <unordered_map> |
| | | |
| | |
| | | IntDeclaration, // int $variable |
| | | DoubleDeclaration, // double $variable |
| | | BooleanDeclaration, // bool $variable |
| | | FunctionDeclaration, // function $variable |
| | | FunctionDeclaration, // function fn_name |
| | | FunctionCall, // fn_name(args) |
| | | Return, // return |
| | | Equals, // = |
| | | Plus, // + |
| | | Minus, // - |
| | |
| | | { TokenType::DoubleDeclaration, "DoubleDeclaration" }, |
| | | { TokenType::BooleanDeclaration, "BooleanDeclaration" }, |
| | | { TokenType::FunctionDeclaration, "FunctionDeclaration" }, |
| | | { TokenType::FunctionCall, "FunctionCall" }, |
| | | { TokenType::Return, "Return" }, |
| | | { TokenType::Equals, "Equals" }, |
| | | { TokenType::Plus, "Plus" }, |
| | | { TokenType::Minus, "Minus" }, |
| | |
| | | if (declaration == Variables::Type::VT_BOOLEAN) { |
| | | return TokenType::BooleanDeclaration; |
| | | } |
| | | if (declaration == Variables::Type::VT_FUNCTION) { |
| | | return TokenType::FunctionDeclaration; |
| | | } |
| | | // if (declaration == Variables::Type::VT_FUNCTION) { |
| | | // return TokenType::FunctionDeclaration; |
| | | // } |
| | | std::cout << "Unknown variable type: " << Variables::TypeToString(declaration) << "\n"; |
| | | return TokenType::Unknown; |
| | | } |
| | | |
| | |
| | | if (type == TokenType::BooleanDeclaration) { |
| | | return Variables::Type::VT_BOOLEAN; |
| | | } |
| | | if (type == TokenType::FunctionDeclaration) { |
| | | return Variables::Type::VT_FUNCTION; |
| | | } |
| | | //if (type == TokenType::FunctionDeclaration) { |
| | | // return Variables::Type::VT_FUNCTION; |
| | | //} |
| | | return Variables::Type::VT_NULL; |
| | | }; |
| | | |