From 36ec04c00fa540fcee0f2cff1f7b81dd8a98101a Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Thu, 17 Apr 2025 18:44:58 +0000
Subject: [PATCH] some refactor
---
src/Lexer/Token.hpp | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/Lexer/Token.hpp b/src/Lexer/Token.hpp
index ac2ac9f..2352950 100644
--- a/src/Lexer/Token.hpp
+++ b/src/Lexer/Token.hpp
@@ -2,10 +2,10 @@
#define TOKEN_HPP
#include <iostream>
-#include <string> // <<< Hozzáadva
-#include <string_view> // <<< Hozzáadva
+#include <string>
+#include <string_view>
-#include "Lexer/TokenType.hpp" // Feltételezzük, hogy ez definiálja Type-ot és TypeToString-ot
+#include "Lexer/TokenType.hpp"
namespace Lexer::Tokens {
@@ -27,6 +27,14 @@
<< ", Lexeme: \"" << std::string(lexeme) << "\""
<< " }" << '\n';
}
+
+ std::string dump() const {
+ return + "Token { Type: " + Lexer::Tokens::TypeToString(type) + ", Value: \"" + value + "\""
+ + ", Pos: [" + std::to_string(start_pos) + ", " + std::to_string(end_pos)
+ + ")"
+ + ", Lexeme: \"" + std::string(lexeme) + "\""
+ + " }" + '\n';
+ }
};
inline bool operator==(const Token & lhs, const Token & rhs) {
--
Gitblit v1.9.3