From 87bcd0d064e151765dadfe6e79987013eab53b4d Mon Sep 17 00:00:00 2001 From: ala89 Date: Wed, 15 Nov 2023 14:06:03 +0100 Subject: [PATCH] Add CodePosition --- src/include/tokenize.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/include/tokenize.h b/src/include/tokenize.h index 6310ab3..b0cfd36 100644 --- a/src/include/tokenize.h +++ b/src/include/tokenize.h @@ -12,9 +12,15 @@ enum class Type { Int }; using TokenData = variant; +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 tokenize(string str); +vector tokenize(vector str); /* Format and print a Token