mirror of
https://git.tesses.org/tesses50/crosslang.git
synced 2026-08-02 08:35:32 +00:00
Add embeddir finally and embedstrm
This commit is contained in:
@@ -83,6 +83,18 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class PushResourceStreamChunkInstruction : public ChunkInstruction {
|
||||
public:
|
||||
PushResourceStreamChunkInstruction(std::string v) : value(v)
|
||||
{}
|
||||
std::string value;
|
||||
size_t Size()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
};
|
||||
|
||||
class LabelChunkInstruction : public ChunkInstruction {
|
||||
public:
|
||||
LabelChunkInstruction(std::string lbl) : lbl(lbl)
|
||||
@@ -285,6 +297,10 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
instrs.push_back(std::make_shared<SimpleChunkInstruction>(LINEINFO));
|
||||
}
|
||||
else if(name == "embeddir")
|
||||
{
|
||||
instrs.push_back(std::make_shared<SimpleChunkInstruction>(PUSHRESOUURCEDIR));
|
||||
}
|
||||
else if(name == "pushclosure")
|
||||
{
|
||||
auto closure = std::make_shared<ClosureChunkInstruction>(true);
|
||||
@@ -325,6 +341,14 @@ namespace Tesses::CrossLang {
|
||||
instrs.push_back(std::make_shared<PushResourceChunkInstruction>(str));
|
||||
}
|
||||
}
|
||||
else if(name == "embedstrm")
|
||||
{
|
||||
if(i < tokens.size() && tokens[i].type == LexTokenType::String)
|
||||
{
|
||||
std::string str = tokens[i++].text;
|
||||
instrs.push_back(std::make_shared<PushResourceStreamChunkInstruction>(str));
|
||||
}
|
||||
}
|
||||
else if(name == "push")
|
||||
{
|
||||
if(IsSym("."))
|
||||
@@ -1031,6 +1055,7 @@ namespace Tesses::CrossLang {
|
||||
auto chr = std::dynamic_pointer_cast<PushCharChunkInstruction>(item);
|
||||
auto chk = std::dynamic_pointer_cast<ClosureChunkInstruction>(item);
|
||||
auto reso = std::dynamic_pointer_cast<PushResourceChunkInstruction>(item);
|
||||
auto resos = std::dynamic_pointer_cast<PushResourceStreamChunkInstruction>(item);
|
||||
auto jmp = std::dynamic_pointer_cast<JumpStyleChunkInstruction>(item);
|
||||
auto scopeend = std::dynamic_pointer_cast<ScopeEndTimesChunkInstruction>(item);
|
||||
if(lbl)
|
||||
@@ -1066,6 +1091,10 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<EmbedInstruction>(GetResource(reso->value)));
|
||||
}
|
||||
if(resos)
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<EmbedStreamInstruction>(GetResource(reso->value)));
|
||||
}
|
||||
if(jmp)
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<JumpStyleInstruction>(jmp->instr,jmp->lbl));
|
||||
|
||||
Reference in New Issue
Block a user