Files
inkblot/InkBlot/ParseHierarchy/MultiDivert.cs

57 lines
1.5 KiB
C#

using OneOf;
namespace InkBlot.ParseHierarchy;
[GenerateOneOf]
public partial class
MultiDivert : OneOfBase<ThreadDivert, DivertsListWithReturnFromTunnel, DivertsListWithoutReturnFromTunnel>,
IStoryNode
{
public override bool Equals(object? obj)
{
if (obj is OneOfBase<ThreadDivert, DivertsListWithReturnFromTunnel, DivertsListWithoutReturnFromTunnel> divert)
Console.WriteLine("it actually is fuck");
var rv = base.Equals(obj);
return rv;
}
}
public record Identifier(string[] Elements /* TODO: expressions */)
{
public virtual bool Equals(Identifier? other)
{
return other is not null && Elements.SequenceEqual(other.Elements);
}
public override string ToString()
{
return "Identifier(" + string.Join('.', Elements) + ")";
}
public override int GetHashCode()
{
return Elements.GetHashCode();
}
}
// <- thread_name
public record ThreadDivert(Identifier Identifier) : IStoryNode
{
public override string ToString()
{
return $"ThreadDivert({Identifier})";
}
}
// -> ... ->-> // 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;