aboutsummaryrefslogtreecommitdiff
path: root/asm/lexer.hpp
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 16:28:51 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-15 16:29:37 +0630
commita2d98142d5c7d8678651692ba34d0f803317fef8 (patch)
tree984acd83df341592909e02b0748c2c449403c7ac /asm/lexer.hpp
parentae3794c33e1dbc96551082a3886379bf517b8aae (diff)
downloadovm-a2d98142d5c7d8678651692ba34d0f803317fef8.tar.gz
ovm-a2d98142d5c7d8678651692ba34d0f803317fef8.tar.bz2
ovm-a2d98142d5c7d8678651692ba34d0f803317fef8.zip
lerr_t is now a struct with constructors
Similar principle to pp_err_t in that a structure provides the opportunity for more information about the error such as location.
Diffstat (limited to 'asm/lexer.hpp')
-rw-r--r--asm/lexer.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/asm/lexer.hpp b/asm/lexer.hpp
index c74228f..c361f32 100644
--- a/asm/lexer.hpp
+++ b/asm/lexer.hpp
@@ -80,7 +80,7 @@ struct token_t
std::ostream &operator<<(std::ostream &, token_t &);
-enum class lerr_t
+enum class lerr_type_t
{
OK = 0,
INVALID_CHAR_LITERAL,
@@ -88,8 +88,18 @@ enum class lerr_t
INVALID_STRING_LITERAL,
INVALID_NUMBER_LITERAL,
INVALID_PREPROCESSOR_DIRECTIVE,
+ UNKNOWN_CHAR,
};
-const char *lerr_as_cstr(lerr_t);
+
+struct lerr_t
+{
+ size_t col, line;
+ lerr_type_t type;
+
+ lerr_t(lerr_type_t type = lerr_type_t::OK, size_t col = 0, size_t line = 0);
+};
+
+std::ostream &operator<<(std::ostream &, lerr_t &);
lerr_t tokenise_buffer(std::string_view, std::vector<token_t *> &);