完成Parser定义以及表达式解析

This commit is contained in:
2026-02-14 23:03:46 +08:00
parent 35e479fd05
commit 878157c2fc
19 changed files with 771 additions and 102 deletions
+9 -1
View File
@@ -10,6 +10,8 @@
#include <Ast/Base.hpp>
#include <Token/Token.hpp>
#include <Deps/Deps.hpp>
namespace Fig
{
struct LiteralExpr final : Expr
@@ -20,9 +22,15 @@ namespace Fig
{
type = AstType::LiteralExpr;
}
LiteralExpr(const Token& token) : token(token)
LiteralExpr(const Token& token, SourceLocation _location) : token(token)
{
type = AstType::LiteralExpr;
location = std::move(_location);
}
virtual String toString() const override
{
return std::format("<LiteralExpr: {}>", magic_enum::enum_name(token.type));
}
};
}; // namespace Fig