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-08-06 21:44:15 +00:00
|
|
|
public abstract record Expr(Token Start) {
|
2023-07-11 06:51:51 +00:00
|
|
|
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);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Sequence(Expr Left, Expr Right) : Expr(Left.Start)
|
2023-06-28 23:18:31 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-28 23:18:31 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitSequenceExpr(context, this);
|
2023-06-28 23:18:31 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Binary(Expr Left, Token Op, Expr Right) : Expr(Left.Start)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitBinaryExpr(context, this);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Grouping(Expr Expression, Token LParen) : Expr(LParen)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitGroupingExpr(context, this);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Literal(System.Object Value, Token Token) : Expr(Token)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitLiteralExpr(context, this);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Unary(Token Op, Expr Right) : Expr(Op)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-25 01:15:37 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitUnaryExpr(context, this);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record If(Expr Condition, Expr Then, Expr Else, Token IfToken) : Expr(IfToken)
|
2023-06-28 22:26:08 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-06-28 22:26:08 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitIfExpr(context, this);
|
2023-06-28 22:26:08 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Variable(Token Value) : Expr(Value)
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitVariableExpr(context, this);
|
2023-07-01 06:12:02 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record List(Expr[] Elements, Token LBracket) : Expr(LBracket)
|
2023-07-02 05:13:24 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 05:13:24 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitListExpr(context, this);
|
2023-07-02 05:13:24 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Variant(Token Tag, Expr? Argument, Token Backtick) : Expr(Backtick)
|
2023-07-02 05:30:24 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 05:30:24 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitVariantExpr(context, this);
|
2023-07-02 05:30:24 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Record(Field[] Extensions, BaseRecord? Base, Token LBrace) : Expr(LBrace)
|
2023-07-02 17:38:48 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 17:38:48 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitRecordExpr(context, this);
|
2023-07-02 17:38:48 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Selector(Expr Left, Token FieldName) : Expr(Left.Start)
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-01 06:12:02 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitSelectorExpr(context, this);
|
2023-07-01 06:12:02 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Indexer(Expr Left, Expr Index) : Expr(Left.Start)
|
2023-07-02 17:46:18 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 17:46:18 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitIndexerExpr(context, this);
|
2023-07-02 17:46:18 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-28 00:16:19 +00:00
|
|
|
public partial record Call(Expr Left, Expr?[] Arguments, Token LParen) : Expr(Left.Start)
|
2023-07-02 18:05:46 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 18:05:46 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitCallExpr(context, this);
|
2023-07-02 18:05:46 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record Let(Binding[] Bindings, Expr Body, Token LetToken) : Expr(LetToken)
|
2023-07-02 22:37:06 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-02 22:37:06 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitLetExpr(context, this);
|
2023-07-02 22:37:06 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-06 21:44:15 +00:00
|
|
|
public partial record When(Expr Head, VarBinding[] Cases, Token WhenToken) : Expr(WhenToken)
|
2023-07-05 14:52:14 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
|
2023-07-05 14:52:14 +00:00
|
|
|
{
|
2023-07-11 06:51:51 +00:00
|
|
|
return visitor.visitWhenExpr(context, this);
|
2023-07-05 14:52:14 +00:00
|
|
|
}
|
|
|
|
}
|