forked from PuqiAR/Fig-TreeWalker
[Feat] 模块系统支持,使用 import x.x.x导入
[Fix] Context内部辅助函数修改, getStructName .... [Feat] 增加字符串下标获取操作,和修改字符操作,实现使用了第四点的函数 [Impl] FString添加新方法 getRealChar, realReplace [Fun] 在utf8_iterator中辱骂了C++
This commit is contained in:
9
src/Module/Library/std/io/io.fig
Normal file
9
src/Module/Library/std/io/io.fig
Normal file
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Official Module `std.io`
|
||||
Library/std/io/io.fig
|
||||
*/
|
||||
|
||||
public func print(value) -> Null
|
||||
{
|
||||
__fstdout_print(value);
|
||||
}
|
||||
6
src/Module/Library/std/std.fig
Normal file
6
src/Module/Library/std/std.fig
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
Official Module `std`
|
||||
Library/std/std.fig
|
||||
*/
|
||||
|
||||
import io; // link std io
|
||||
@@ -1,47 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <Core/fig_string.hpp>
|
||||
#include <Value/value.hpp>
|
||||
#include <Context/context.hpp>
|
||||
|
||||
namespace Fig
|
||||
{
|
||||
// class Module
|
||||
// {
|
||||
// public:
|
||||
// const FString name;
|
||||
// const FString spec;
|
||||
// const FString path;
|
||||
|
||||
// std::shared_ptr<Context> context; // module-level context
|
||||
|
||||
// /*
|
||||
|
||||
// import module -> automatically create a module context and call function `init` if exists
|
||||
// all global functions, variables, structs, etc will be stored in module context
|
||||
// then module context will be linked to the current context
|
||||
|
||||
// */
|
||||
// Module(const FString &moduleName, const FString &moduleSpec, const FString &modulePath) :
|
||||
// name(moduleName), spec(moduleSpec), path(modulePath)
|
||||
// {
|
||||
// context = std::make_shared<Context>(FString(std::format("<Module {}>", name.toBasicString())), nullptr);
|
||||
// }
|
||||
|
||||
// bool hasSymbol(const FString &symbolName)
|
||||
// {
|
||||
// return context->contains(symbolName);
|
||||
// }
|
||||
// Object getSymbol(const FString &symbolName)
|
||||
// {
|
||||
// auto valOpt = context->get(symbolName);
|
||||
// if (!valOpt.has_value())
|
||||
// {
|
||||
// throw RuntimeError(FStringView(std::format("Symbol '{}' not found in module '{}'", symbolName.toBasicString(), name.toBasicString())));
|
||||
// }
|
||||
// return valOpt.value();
|
||||
// }
|
||||
// };
|
||||
};
|
||||
Reference in New Issue
Block a user