[Feat] 模块系统支持,使用 import x.x.x导入

[Fix] Context内部辅助函数修改, getStructName ....
[Feat] 增加字符串下标获取操作,和修改字符操作,实现使用了第四点的函数
[Impl] FString添加新方法 getRealChar, realReplace
[Fun] 在utf8_iterator中辱骂了C++
This commit is contained in:
2025-12-26 20:47:57 +08:00
parent 6e1df63507
commit 00240f1ed1
21 changed files with 578 additions and 140 deletions

View File

@@ -4,6 +4,7 @@
#include <Error/error.hpp>
#include <Module/builtins.hpp>
#include <Value/LvObject.hpp>
#include <filesystem>
namespace Fig
@@ -52,6 +53,12 @@ namespace Fig
private:
ContextPtr global;
public:
FString sourcePath;
void SetSourcePath(const FString &sp)
{
sourcePath = sp;
}
void SetGlobalContext(ContextPtr ctx)
{
@@ -110,8 +117,13 @@ namespace Fig
StatementResult evalBlockStatement(Ast::BlockStatement, ContextPtr); // block
StatementResult evalStatement(Ast::Statement, ContextPtr); // statement
std::filesystem::path resolveModulePath(const std::vector<FString> &);
ContextPtr loadModule(const std::filesystem::path &);
StatementResult evalImportSt(Ast::Import, ContextPtr);
StatementResult Run(std::vector<Ast::AstBase>); // Entry
void printStackTrace();
};
}; // namespace Fig