feat: temporary grammar

This commit is contained in:
Mattia Belletti
2025-03-01 12:30:36 +01:00
parent aa3baa780d
commit eed28168ad
31 changed files with 1409 additions and 479 deletions

View File

@@ -1,3 +1,3 @@
namespace InkBlot.ParseHierarchy;
public record Content(string Text) : StoryNode;
public record Content(string Text) : IStoryNode;

View File

@@ -3,4 +3,4 @@
/// <summary>
/// Any node in the parsed story
/// </summary>
public record StoryNode;
public interface IStoryNode;

View File

@@ -1,3 +1,27 @@
namespace InkBlot.ParseHierarchy;
using OneOf;
public record MultiDivert : StoryNode;
namespace InkBlot.ParseHierarchy;
[GenerateOneOf]
public partial class
MultiDivert : OneOfBase<ThreadDivert, DivertsListWithReturnFromTunnel, DivertsListWithoutReturnFromTunnel>,
IStoryNode
{
}
public record Identifier(string[] Elements /* TODO: expressions */);
// <- thread_name
public record ThreadDivert(Identifier Identifier) : IStoryNode;
// -> ... ->-> // return from tunnel
// or
// -> ... ->-> tunnelReplacement // return from tunnel, but replace destination
public record DivertsListWithReturnFromTunnel(Identifier[] Identifiers, Identifier? TunnelReplacement)
: IStoryNode;
// -> ... -> div // not a tunnel
// or
// -> ... -> div -> // is tunnel
public record DivertsListWithoutReturnFromTunnel(Identifier[] Identifiers, bool IsTunnel)
: IStoryNode;

View File

@@ -1,3 +1,3 @@
namespace InkBlot.ParseHierarchy;
public record Story(IEnumerable<StoryNode> StoryNodes) : StoryNode;
public record Story(IEnumerable<IStoryNode> StoryNodes) : IStoryNode;