Gathers no longer contain the next instruction
Some checks failed
/ test (push) Has been cancelled

This commit is contained in:
2025-10-28 17:49:50 -05:00
parent b631e7d0ee
commit 05e6bc30c3
3 changed files with 7 additions and 17 deletions

View File

@@ -77,15 +77,10 @@ class ASTExtension {
for (i in startingIndex...findEOF(ast, currentFile)) { for (i in startingIndex...findEOF(ast, currentFile)) {
switch (ast[i].expr) { switch (ast[i].expr) {
// Gather choices of the current depth // Gather choices of the current depth
case EChoice(choice): case EChoice(choice) if (tryAdd(choice, [])):
if (tryAdd(choice, [])) lastChoiceIndex = i; lastChoiceIndex = i;
case ETagged(EChoice(choice), tags): case ETagged(EChoice(choice), tags) if (tryAdd(choice, tags)):
if (tryAdd(choice, tags)) lastChoiceIndex = i; lastChoiceIndex = i;
// Choice immediatly after gather at current depth:
case EGather(_, d, EChoice(choice)) if(i == startingIndex && d == depth):
if (tryAdd(choice, [])) lastChoiceIndex = i;
case EGather(_, d, ETagged(EChoice(choice), tags)) if(i == startingIndex && d == depth):
if (tryAdd(choice, tags)) lastChoiceIndex = i;
// Stop at the next gather of this depth // Stop at the next gather of this depth
case EGather(_, d, _) if (d == depth): case EGather(_, d, _) if (d == depth):
break; break;

View File

@@ -192,13 +192,7 @@ class Parser {
var label = buffer.expressionIfNext('(', ')'); var label = buffer.expressionIfNext('(', ')');
buffer.skipWhitespace('\n'); buffer.skipWhitespace('\n');
var gatherOp = switch (buffer.peekLine()) { return EGather(label, depth, ENoOp);
case Some("") | None:
ENoOp;
default:
parseExpr(buffer, buffer.position());
}
return EGather(label, depth, gatherOp);
} }
static var choices:Int = 0; static var choices:Int = 0;

View File

@@ -319,7 +319,8 @@ class Story {
case None: case None:
} }
weaveDepth = depth; weaveDepth = depth;
return processExpr(nextExpr); ++exprIndex;
return nextFrame();
case EChoice(choice): case EChoice(choice):
if (choice.depth > weaveDepth) { if (choice.depth > weaveDepth) {