Add CodePosition

This commit is contained in:
ala89 2023-11-15 14:06:03 +01:00
parent 57439de0f7
commit 87bcd0d064

View File

@ -12,9 +12,15 @@ enum class Type { Int };
using TokenData = variant<int, string, Type>;
struct CodePosition {
int line;
int column;
};
struct Token {
TokenType type;
TokenData data { };
CodePosition pos;
};
class TokenError : public runtime_error {
@ -26,7 +32,7 @@ public:
/*
Parses a string into a vector of tokens
*/
vector<Token> tokenize(string str);
vector<Token> tokenize(vector<string> str);
/*
Format and print a Token