♻️ 重构符号表相关内容

🚀 优化`ast`相关代码
This commit is contained in:
csh
2025-11-16 21:20:47 +08:00
parent 8f25f212a7
commit cee6e614bf
27 changed files with 3740 additions and 2811 deletions
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -3,6 +3,7 @@
#include <iostream>
#include <string>
#include <optional>
#include <functional>
#include "../../src/language/ast/types.hpp"
#include "../../src/language/ast/deserializer.hpp"
@@ -188,6 +189,7 @@ namespace lsp::language::ast::debug
void PrintIndent(std::optional<bool> is_last = std::nullopt);
void PrintTreePrefix(bool is_last = false);
std::string GetIndent() const;
void EmitChildren(std::vector<std::function<void(bool)>>&& children);
// 颜色辅助
const char* GetColor(const char* color) const;
@@ -196,11 +198,11 @@ namespace lsp::language::ast::debug
// 节点信息输出
void PrintNodeHeader(const std::string& type_name, const Location& loc);
void PrintLocation(const Location& loc);
void PrintSourceSnippet(const Location& loc);
void PrintKeyValue(const std::string& key, const std::string& value, const Location& location, const char* value_color);
void PrintKeyValue(const std::string& key, const std::string& value, const char* value_color = nullptr);
void PrintKeyValue(const std::string& key, int value);
void PrintKeyValue(const std::string& key, bool value);
void PrintSourceSnippet(const Location& loc, bool is_last_child);
void PrintKeyValue(const std::string& key, const std::string& value, const Location& location, const char* value_color, std::optional<bool> is_last = std::nullopt);
void PrintKeyValue(const std::string& key, const std::string& value, const char* value_color = nullptr, std::optional<bool> is_last = std::nullopt);
void PrintKeyValue(const std::string& key, int value, std::optional<bool> is_last = std::nullopt);
void PrintKeyValue(const std::string& key, bool value, std::optional<bool> is_last = std::nullopt);
// 表达式和语句打印
void PrintExpression(const Expression* expr, const std::string& label = "", bool is_last = false);