finn-lang/Expr.g.cs

135 lines
5.0 KiB
C#

////////////////////////////////////////////////////////////
// THIS FILE IS GENERATED. //
// DO NOT EDIT. //
////////////////////////////////////////////////////////////
#nullable enable
namespace Finn.AST;
public abstract record Expr(Token Start) {
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(Left.Start)
{
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(Left.Start)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitBinaryExpr(context, this);
}
}
public partial record Grouping(Expr Expression, Token LParen) : Expr(LParen)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitGroupingExpr(context, this);
}
}
public partial record Literal(System.Object Value, Token Token) : Expr(Token)
{
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(Op)
{
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, Token IfToken) : Expr(IfToken)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitIfExpr(context, this);
}
}
public partial record Variable(Token Value) : Expr(Value)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitVariableExpr(context, this);
}
}
public partial record List(Expr[] Elements, Token LBracket) : Expr(LBracket)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitListExpr(context, this);
}
}
public partial record Variant(Token Tag, Expr? Argument, Token Backtick) : Expr(Backtick)
{
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, Token LBrace) : Expr(LBrace)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitRecordExpr(context, this);
}
}
public partial record Selector(Expr Left, Token FieldName) : Expr(Left.Start)
{
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(Left.Start)
{
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, Token LParen) : Expr(Left.Start)
{
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, Token LetToken) : Expr(LetToken)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitLetExpr(context, this);
}
}
public partial record When(Expr Head, VarBinding[] Cases, Token WhenToken) : Expr(WhenToken)
{
public override TResult accept<TContext, TResult>(TContext context, IExprVisitor<TContext, TResult> visitor)
{
return visitor.visitWhenExpr(context, this);
}
}