Files
Fig/src/Ast/Stmt/ImportStmt.hpp
PuqiAR 680197aafe Refactor: 重构Parser和AST结构,以支持新的语言特性
- 更新了 ParserTest,以改进文件路径处理和输出格式。
- 在 StmtParser 中新增了 parseConstDecl 和 parseForStmt 方法,用于处理常量声明和 for 循环。
- TypeExpr现归类为Expr。TypeExpr属于Expr,语义阶段视为Expr
- 添加了新的 AST 节点:PostfixExpr、TernaryExpr、ForStmt 和 ImportStmt,用于表示新的语法结构。
2026-06-06 22:12:04 +08:00

34 lines
760 B
C++

/*!
@file src/Ast/Stmt/ImportStmt.hpp
@brief import
@author PuqiAR (im@puqiar.top)
@date 2026-06-06
*/
#pragma once
#include <Ast/Base.hpp>
namespace Fig
{
struct ImportStmt final : public Stmt
{
String path;
bool isFileImport;
ImportStmt() { type = AstType::ImportStmt; }
ImportStmt(String _path, bool _isFileImport, SourceLocation _loc) :
path(std::move(_path)), isFileImport(_isFileImport)
{
type = AstType::ImportStmt;
location = std::move(_loc);
}
virtual String toString() const override
{
return std::format("<ImportStmt '{}'{}>", path, isFileImport ? " [file]" : "");
}
};
} // namespace Fig