[Feat] 模块系统支持,使用 import x.x.x导入
[Fix] Context内部辅助函数修改, getStructName .... [Feat] 增加字符串下标获取操作,和修改字符操作,实现使用了第四点的函数 [Impl] FString添加新方法 getRealChar, realReplace [Fun] 在utf8_iterator中辱骂了C++
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <Lexer/lexer.hpp>
|
||||
#include <Core/fig_string.hpp>
|
||||
#include <string>
|
||||
#include <locale>
|
||||
@@ -9,6 +10,32 @@
|
||||
|
||||
namespace Fig::Utils
|
||||
{
|
||||
|
||||
inline std::vector<FString> splitSource(FString source)
|
||||
{
|
||||
UTF8Iterator it(source);
|
||||
std::vector<FString> lines;
|
||||
FString currentLine;
|
||||
while (!it.isEnd())
|
||||
{
|
||||
UTF8Char c = *it;
|
||||
if (c == U'\n')
|
||||
{
|
||||
lines.push_back(currentLine);
|
||||
currentLine = FString(u8"");
|
||||
}
|
||||
else
|
||||
{
|
||||
currentLine += c.getString();
|
||||
}
|
||||
++it;
|
||||
}
|
||||
if (!currentLine.empty())
|
||||
{
|
||||
lines.push_back(currentLine);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
inline std::u32string utf8ToUtf32(const FString &s)
|
||||
{
|
||||
std::u32string result;
|
||||
|
||||
Reference in New Issue
Block a user