feat: first chunk of lexer/parser translation.

This commit is contained in:
mattia
2025-02-16 20:49:20 +01:00
parent d386c50499
commit 4f8e83da9d
15 changed files with 2593 additions and 49 deletions

View File

@@ -10,11 +10,10 @@ public partial class Listener
public override void ExitStory(InkBlotAntlrGrammarParser.StoryContext context)
{
var storyNodes = context.children.Select(child => child switch
{
InkBlotAntlrGrammarParser.ContentTextContext contentText => new Content(GetContentText(contentText)),
_ => throw new InvalidOperationException($"unknown context of type {child.GetType()}")
});
var storyNodes = context
.topLevelStatements()
.contentText()
.Select(child => new Content(GetContentText(child)));
_story = new Story(storyNodes);
}
}