135 lines
4.7 KiB
C#
135 lines
4.7 KiB
C#
////////////////////////////////////////////////////////////
|
|
// THIS FILE IS GENERATED. //
|
|
// DO NOT EDIT. //
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#nullable enable
|
|
|
|
namespace Finn.AST;
|
|
|
|
public abstract record Expr() {
|
|
public abstract TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor);
|
|
}
|
|
public interface IExprVisitor<TContext, TResult> {
|
|
TResult visitSequenceExpr(TContext context, Sequence expr);
|
|
TResult visitBinaryExpr(TContext context, Binary expr);
|
|
TResult visitGroupingExpr(TContext context, Grouping expr);
|
|
TResult visitLiteralExpr(TContext context, Literal expr);
|
|
TResult visitUnaryExpr(TContext context, Unary expr);
|
|
TResult visitIfExpr(TContext context, If expr);
|
|
TResult visitVariableExpr(TContext context, Variable expr);
|
|
TResult visitListExpr(TContext context, List expr);
|
|
TResult visitVariantExpr(TContext context, Variant expr);
|
|
TResult visitRecordExpr(TContext context, Record expr);
|
|
TResult visitSelectorExpr(TContext context, Selector expr);
|
|
TResult visitIndexerExpr(TContext context, Indexer expr);
|
|
TResult visitCallExpr(TContext context, Call expr);
|
|
TResult visitLetExpr(TContext context, Let expr);
|
|
TResult visitWhenExpr(TContext context, When expr);
|
|
}
|
|
public partial record Sequence(Expr Left, Expr Right) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitSequenceExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Binary(Expr Left, Token Op, Expr Right) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitBinaryExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Grouping(Expr Expression) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitGroupingExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Literal(System.Object Value) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitLiteralExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Unary(Token Op, Expr Right) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitUnaryExpr(context, this);
|
|
}
|
|
}
|
|
public partial record If(Expr Condition, Expr Then, Expr Else) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitIfExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Variable(Name Value) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitVariableExpr(context, this);
|
|
}
|
|
}
|
|
public partial record List(Expr[] Elements) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitListExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Variant(Name Tag, Expr? Argument) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitVariantExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Record(Field[] Extensions, BaseRecord? Base) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitRecordExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Selector(Expr Left, Name FieldName) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitSelectorExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Indexer(Expr Left, Expr Index) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitIndexerExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Call(Expr Left, Expr?[] Arguments) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitCallExpr(context, this);
|
|
}
|
|
}
|
|
public partial record Let(Binding[] Bindings, Expr Body) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitLetExpr(context, this);
|
|
}
|
|
}
|
|
public partial record When(Expr Head, Binding[] Cases) : Expr()
|
|
{
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
|
{
|
|
return visitor.visitWhenExpr(context, this);
|
|
}
|
|
}
|