127 lines
3.1 KiB
C#
127 lines
3.1 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 visitIdentifierExpr(Identifier 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);
|
|
}
|
|
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 Identifier(Name Value) : Expr()
|
|
{
|
|
public override T accept<T>(IExprVisitor<T> visitor)
|
|
{
|
|
return visitor.visitIdentifierExpr(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);
|
|
}
|
|
}
|