2023-06-25 01:15:37 +00:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// THIS FILE IS GENERATED. //
|
|
|
|
// DO NOT EDIT. //
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
2023-07-02 19:19:42 +00:00
|
|
|
#nullable enable
|
2023-07-02 05:13:24 +00:00
|
|
|
|
2023-06-25 01:15:37 +00:00
|
|
|
namespace Finn.AST;
|
|
|
|
|
2023-07-02 20:27:12 +00:00
|
|
|
public abstract record Expr() {
|
2023-06-25 01:15:37 +00:00
|
|
|
public abstract T accept<T>(IVisitor<T> visitor);
|
|
|
|
}
|
|
|
|
public interface IVisitor<T> {
|
2023-06-28 23:18:31 +00:00
|
|
|
T visitSequenceExpr(Sequence expr);
|
2023-06-25 01:15:37 +00:00
|
|
|
T visitBinaryExpr(Binary expr);
|
|
|
|
T visitGroupingExpr(Grouping expr);
|
|
|
|
T visitLiteralExpr(Literal expr);
|
|
|
|
T visitUnaryExpr(Unary expr);
|
2023-06-28 22:26:08 +00:00
|
|
|
T visitIfExpr(If expr);
|
2023-07-01 06:12:02 +00:00
|
|
|
T visitIdentifierExpr(Identifier expr);
|
2023-07-02 05:13:24 +00:00
|
|
|
T visitListExpr(List expr);
|
2023-07-02 05:30:24 +00:00
|
|
|
T visitVariantExpr(Variant expr);
|
2023-07-02 17:38:48 +00:00
|
|
|
T visitRecordExpr(Record expr);
|
2023-07-01 06:12:02 +00:00
|
|
|
T visitSelectorExpr(Selector expr);
|
2023-07-02 17:46:18 +00:00
|
|
|
T visitIndexerExpr(Indexer expr);
|
2023-07-02 18:05:46 +00:00
|
|
|
T visitCallExpr(Call expr);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Sequence(Expr Left, Expr Right) : Expr()
|
2023-06-28 23:18:31 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitSequenceExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Binary(Expr Left, Token Op, Expr Right) : Expr()
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitBinaryExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Grouping(Expr Expression) : Expr()
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitGroupingExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Literal(System.Object Value) : Expr()
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitLiteralExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Unary(Token Op, Expr Right) : Expr()
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitUnaryExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record If(Expr Condition, Expr Then, Expr Else) : Expr()
|
2023-06-28 22:26:08 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitIfExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Identifier(Name Value) : Expr()
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitIdentifierExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record List(Expr[] Elements) : Expr()
|
2023-07-02 05:13:24 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitListExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Variant(Name Tag, Expr? Argument) : Expr()
|
2023-07-02 05:30:24 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitVariantExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Record(Field[] Extensions, BaseRecord? Base) : Expr()
|
2023-07-02 17:38:48 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitRecordExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Selector(Expr Left, Name FieldName) : Expr()
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitSelectorExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Indexer(Expr Left, Expr Index) : Expr()
|
2023-07-02 17:46:18 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitIndexerExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 20:27:12 +00:00
|
|
|
public partial record Call(Expr Left, Expr?[] Arguments) : Expr()
|
2023-07-02 18:05:46 +00:00
|
|
|
{
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitCallExpr(this);
|
|
|
|
}
|
|
|
|
}
|