47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
////////////////////////////////////////////////////////////
|
|
// THIS FILE IS GENERATED. //
|
|
// DO NOT EDIT. //
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#nullable enable
|
|
|
|
namespace Finn.AST;
|
|
|
|
public abstract record Pattern() {
|
|
public abstract TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor);
|
|
}
|
|
public interface IPatternVisitor<TContext, TResult> {
|
|
TResult visitSimplePatternPattern(TContext context, SimplePattern pattern);
|
|
TResult visitVariantPatternPattern(TContext context, VariantPattern pattern);
|
|
TResult visitFieldPatternPattern(TContext context, FieldPattern pattern);
|
|
TResult visitRecordPatternPattern(TContext context, RecordPattern pattern);
|
|
}
|
|
public partial record SimplePattern(Token? Identifier) : Pattern()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitSimplePatternPattern(context, this);
|
|
}
|
|
}
|
|
public partial record VariantPattern(Token Tag, Pattern? Argument) : Pattern()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitVariantPatternPattern(context, this);
|
|
}
|
|
}
|
|
public partial record FieldPattern(Token Name, Pattern? Pattern) : Pattern()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitFieldPatternPattern(context, this);
|
|
}
|
|
}
|
|
public partial record RecordPattern(FieldPattern[] Fields, SimplePattern? Rest) : Pattern()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitRecordPatternPattern(context, this);
|
|
}
|
|
}
|