finn-lang/Pattern.g.cs

47 lines
1.9 KiB
C#

////////////////////////////////////////////////////////////
// THIS FILE IS GENERATED. //
// DO NOT EDIT. //
////////////////////////////////////////////////////////////
#nullable enable
namespace Finn.AST;
public abstract record Pattern(Token Start) {
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, Token Token) : Pattern(Token)
{
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, Token Backtick) : Pattern(Backtick)
{
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(Name)
{
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, Token LBrace) : Pattern(LBrace)
{
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
{
return visitor.visitRecordPatternPattern(context, this);
}
}