diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-14 17:05:39 +0630 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-04-14 17:05:52 +0630 |
commit | e55871195adfca7abd477abd3c5a8c95fe7da2c5 (patch) | |
tree | cf0c27fcb6b1d330724d910aa89493cb451cf4a1 /asm/lexer.cpp | |
parent | a8f605c89b0e3d57aeb30b165733d95a11829f7b (diff) | |
download | ovm-e55871195adfca7abd477abd3c5a8c95fe7da2c5.tar.gz ovm-e55871195adfca7abd477abd3c5a8c95fe7da2c5.tar.bz2 ovm-e55871195adfca7abd477abd3c5a8c95fe7da2c5.zip |
Implemented overload for ostream and token as well as constructors for token
Diffstat (limited to 'asm/lexer.cpp')
-rw-r--r-- | asm/lexer.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/asm/lexer.cpp b/asm/lexer.cpp index 8b30c55..42ea5eb 100644 --- a/asm/lexer.cpp +++ b/asm/lexer.cpp @@ -396,3 +396,17 @@ lerr_t tokenise_buffer(string_view source, std::vector<token_t> &tokens) } return lerr_t::OK; } + +std::ostream &operator<<(std::ostream &os, token_t &t) +{ + return os << "TOKEN[" << token_type_as_cstr(t.type) << "(`" << t.content + << "`)@" << t.line << ", " << t.column << "]"; +} + +token_t::token_t() +{} + +token_t::token_t(token_type_t type, string content, size_t col, size_t line) + : type{type}, column{col}, line{line}, content{content} +{} + |