Inline ground

This commit is contained in:
2026-01-12 15:24:37 +11:00
parent c5b67bff72
commit 6bc483b1db
5 changed files with 46 additions and 2 deletions

View File

@@ -747,6 +747,15 @@ namespace Solstice {
}
break;
}
case SolNodeType::InlineGround: {
GroundProgram program = groundParseFile(ground.c_str());
SolGroundCodeBlock codeBlock;
for (size_t i = 0; i < program.size; i++) {
codeBlock.code.push_back(program.instructions[i]);
}
code.push_back(codeBlock);
break;
}
default: {}
}
return code;
@@ -883,6 +892,9 @@ namespace Solstice {
if (in == "return") {
return SolNodeType::Return;
}
if (in == "ground") {
return SolNodeType::InlineGround;
}
if (in == "{") {
return SolNodeType::CodeBlockStart;
}
@@ -1428,6 +1440,20 @@ namespace Solstice {
rootNode.addNode(returnNode);
break;
}
case SolNodeType::InlineGround: {
SolNode groundNode(SolNodeType::InlineGround);
consume(); // some funny token
consume(); // {
consume(); // new line token
while (auto tokenopt = consume()) {
if (tokenopt.value().value == "}") {
break;
}
groundNode.ground += tokenopt.value().value + " ";
}
rootNode.addNode(groundNode);
break;
}
}
}
return rootNode;