27 lines
492 B
C++
27 lines
492 B
C++
#ifndef TOKENIZE_H
|
|
#define TOKENIZE_H
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
enum class TokenType { Type, Identifier, Number, Plus, Minus, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese };
|
|
enum class Type { Int };
|
|
|
|
union TokenData {
|
|
double number;
|
|
Type type;
|
|
string identifier;
|
|
|
|
TokenData() : number(0.0) {}
|
|
|
|
// Explicitly define the destructor
|
|
~TokenData() {}
|
|
};
|
|
|
|
struct Token {
|
|
TokenType type;
|
|
TokenData data;
|
|
};
|
|
|
|
#endif |