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