2023-07-02 20:56:50 +00:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// THIS FILE IS GENERATED. //
|
|
|
|
// DO NOT EDIT. //
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#nullable enable
|
|
|
|
|
|
|
|
namespace Finn.AST;
|
|
|
|
|
2023-08-06 21:44:15 +00:00
|
|
|
public abstract record Pattern(Token Start) {
|
2023-07-11 06:51:51 +00:00
|
|
|
public abstract TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
2023-07-11 06:51:51 +00:00
|
|
|
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);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record SimplePattern(Token? Identifier, Token Token) : Pattern(Token)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitSimplePatternPattern(context, this);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record VariantPattern(Token Tag, Pattern? Argument, Token Backtick) : Pattern(Backtick)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitVariantPatternPattern(context, this);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record FieldPattern(Token Name, Pattern? Pattern) : Pattern(Name)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitFieldPatternPattern(context, this);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record RecordPattern(FieldPattern[] Fields, SimplePattern? Rest, Token LBrace) : Pattern(LBrace)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IPatternVisitor<TContext, TResult> visitor)
|
2023-07-02 20:56:50 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitRecordPatternPattern(context, this);
|
2023-07-02 20:56:50 +00:00
|
|
|
}
|
|
|
|
}
|