Failing parser test for alt syntax bug
This commit is contained in:
@@ -8,6 +8,7 @@ You can {insert} the values of expressions.
|
||||
{shuffle: Things get weird|when you start to use sequence expressions.}
|
||||
// If you don't believe me, just look at ParserTest.hx!!
|
||||
{once: And they don't get any {easier}|{> when you nest them|{insert}}}!
|
||||
{This is a sequence, too|}
|
||||
|
||||
You can {
|
||||
if (flag) "insert" else "interpolate"
|
||||
|
||||
@@ -51,6 +51,8 @@ class Alt {
|
||||
}
|
||||
}
|
||||
|
||||
// Sequences can also occur without the prefix
|
||||
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,11 +163,9 @@ class Output {
|
||||
if (!altInstances.exists(a)) {
|
||||
altInstances[a] = new AltInstance(a.behavior, a.outputs, random);
|
||||
}
|
||||
trace(a);
|
||||
trace([for(key in altInstances.keys()) key].length);
|
||||
trace(altInstances[a]);
|
||||
fullOutput += altInstances[a].next().format(story, hInterface, random, altInstances, scope, displayToggles);
|
||||
case HExpression(h):
|
||||
trace(h);
|
||||
fullOutput += hInterface.evaluateExpr(h, scope);
|
||||
case InlineDivert(t):
|
||||
// follow the divert. If the next expression is an output, concatenate the pieces together. Otherwise, terminate formatting
|
||||
|
||||
@@ -44,23 +44,33 @@ class ParserTest extends utest.Test {
|
||||
);
|
||||
assertNextExpr(
|
||||
EOutput(new Output([
|
||||
AltExpression(
|
||||
new Alt(
|
||||
OnceOnly,
|
||||
[
|
||||
new Output([Text("And they don't get any "), HExpression("easier")]),
|
||||
new Output([AltExpression(
|
||||
new Alt(
|
||||
Sequence,
|
||||
[
|
||||
new Output([Text("when you nest them")]),
|
||||
new Output([HExpression("insert")])
|
||||
]
|
||||
)
|
||||
)]
|
||||
AltExpression(new Alt(
|
||||
OnceOnly,
|
||||
[
|
||||
new Output([Text("And they don't get any "), HExpression("easier")]),
|
||||
new Output([AltExpression(
|
||||
new Alt(
|
||||
Sequence,
|
||||
[
|
||||
new Output([Text("when you nest them")]),
|
||||
new Output([HExpression("insert")])
|
||||
]
|
||||
)
|
||||
)]
|
||||
)
|
||||
), Text("!")
|
||||
)]
|
||||
)),
|
||||
Text("!")
|
||||
]))
|
||||
);
|
||||
assertNextExpr(
|
||||
EOutput(new Output([
|
||||
AltExpression(new Alt(
|
||||
Sequence,
|
||||
[
|
||||
new Output([Text('This is a sequence, too')]),
|
||||
new Output([OutputType.Text('')])
|
||||
]
|
||||
))
|
||||
]))
|
||||
);
|
||||
|
||||
@@ -110,5 +120,6 @@ class ParserTest extends utest.Test {
|
||||
assertNextExpr(EChoice({id: 1, onceOnly: false, label: None, condition: Some("condition"), depth: 2, output: new Output([Text("Choice that ends with a divert")]),divertTarget: Some("target")}));
|
||||
assertNextExpr(EChoice({id: 2, onceOnly: true, label: None, condition: None, depth: 1, output: new Output([]), divertTarget: Some("fallback_choice")}));
|
||||
assertNextExpr(EChoice({id: 3, onceOnly: true, label: None, condition: None, depth: 1, output: new Output([]), divertTarget: Some("")}));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user