27 lines
492 B
C
Raw Normal View History

2023-10-27 14:46:32 +02:00
#ifndef TOKENIZE_H
#define TOKENIZE_H
2023-10-27 14:37:03 +02:00
#include <vector>
2023-10-27 17:53:58 +02:00
#include <string>
2023-10-27 14:37:03 +02:00
using namespace std;
2023-10-27 16:56:54 +02:00
enum class TokenType { Type, Identifier, Number, Plus, Minus, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese };
2023-10-27 14:37:03 +02:00
enum class Type { Int };
union TokenData {
2023-10-27 16:16:40 +02:00
double number;
2023-10-27 14:37:03 +02:00
Type type;
2023-10-27 17:53:58 +02:00
string identifier;
TokenData() : number(0.0) {}
// Explicitly define the destructor
~TokenData() {}
2023-10-27 14:37:03 +02:00
};
struct Token {
TokenType type;
TokenData data;
2023-10-27 14:46:32 +02:00
};
#endif