Approaching Alt expression parsing

This commit is contained in:
2019-03-16 20:45:13 -06:00
parent e446256c97
commit 2344a36eee
5 changed files with 78 additions and 32 deletions

View File

@@ -4,6 +4,8 @@ import hank.Parser;
import hank.Parser.HankAST;
import hank.Output;
import hank.Output.OutputType;
import hank.Alt;
import hank.Alt.AltBehavior;
class ParserTest extends utest.Test {
var ast: HankAST;
@@ -25,6 +27,21 @@ class ParserTest extends utest.Test {
assertNextExpr(EOutput(new Output([Text("A line won't be interrupted or anything.")])));
assertNextExpr(EOutput(new Output([Text("Multiline comments an output expression. This should parse as one line of output.")])));
assertNextExpr(EOutput(new Output([Text("Comments at the end of lines won't parse as part of the Output.")])));
assertNextExpr(EOutput(new Output([Text("You can "), HExpression("insert"), Text(" the values of expressions.")])));
assertNextExpr(EOutput(new Output([HExpression("you"), Text(" can start an output line with an insert expression. "), HExpression("and_end_one")])));
assertNextExpr(
EOutput(new Output([
AltExpression(
new Alt(
Shuffle,
[
new Output([Text("Things get weird"), Text("when you start to use sequence expressions.")])
]
)
)
]))
);
}