Add CodePosition
This commit is contained in:
parent
57439de0f7
commit
87bcd0d064
@ -12,9 +12,15 @@ enum class Type { Int };
|
|||||||
|
|
||||||
using TokenData = variant<int, string, Type>;
|
using TokenData = variant<int, string, Type>;
|
||||||
|
|
||||||
|
struct CodePosition {
|
||||||
|
int line;
|
||||||
|
int column;
|
||||||
|
};
|
||||||
|
|
||||||
struct Token {
|
struct Token {
|
||||||
TokenType type;
|
TokenType type;
|
||||||
TokenData data { };
|
TokenData data { };
|
||||||
|
CodePosition pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TokenError : public runtime_error {
|
class TokenError : public runtime_error {
|
||||||
@ -26,7 +32,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
Parses a string into a vector of tokens
|
Parses a string into a vector of tokens
|
||||||
*/
|
*/
|
||||||
vector<Token> tokenize(string str);
|
vector<Token> tokenize(vector<string> str);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format and print a Token
|
Format and print a Token
|
||||||
|
Loading…
Reference in New Issue
Block a user