123 lines
3.0 KiB
C#
123 lines
3.0 KiB
C#
////////////////////////////////////////////////////////////
|
|
// THIS FILE IS GENERATED. //
|
|
// DO NOT EDIT. //
|
|
////////////////////////////////////////////////////////////
|
|
|
|
using System;
|
|
|
|
namespace Finn.AST;
|
|
|
|
public abstract class Expr {
|
|
public abstract T accept<T>(IVisitor<T> visitor);
|
|
}
|
|
public interface IVisitor<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);
|
|
}
|
|
public class Sequence : Expr
|
|
{
|
|
public required Expr Left { get; init; }
|
|
public required Expr Right { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitSequenceExpr(this);
|
|
}
|
|
}
|
|
public class Binary : Expr
|
|
{
|
|
public required Expr Left { get; init; }
|
|
public required Token Op { get; init; }
|
|
public required Expr Right { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitBinaryExpr(this);
|
|
}
|
|
}
|
|
public class Grouping : Expr
|
|
{
|
|
public required Expr Expression { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitGroupingExpr(this);
|
|
}
|
|
}
|
|
public class Literal : Expr
|
|
{
|
|
public required System.Object Value { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitLiteralExpr(this);
|
|
}
|
|
}
|
|
public class Unary : Expr
|
|
{
|
|
public required Token Op { get; init; }
|
|
public required Expr Right { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitUnaryExpr(this);
|
|
}
|
|
}
|
|
public class If : Expr
|
|
{
|
|
public required Expr Condition { get; init; }
|
|
public required Expr Then { get; init; }
|
|
public required Expr Else { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitIfExpr(this);
|
|
}
|
|
}
|
|
public class Identifier : Expr
|
|
{
|
|
public required Name Value { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitIdentifierExpr(this);
|
|
}
|
|
}
|
|
public class List : Expr
|
|
{
|
|
public required Expr[] Elements { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitListExpr(this);
|
|
}
|
|
}
|
|
public class Variant : Expr
|
|
{
|
|
public required Name Tag { get; init; }
|
|
public required Expr? Argument { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitVariantExpr(this);
|
|
}
|
|
}
|
|
public class Record : Expr
|
|
{
|
|
public required Field[] Extensions { get; init; }
|
|
public required BaseRecord? Base { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitRecordExpr(this);
|
|
}
|
|
}
|
|
public class Selector : Expr
|
|
{
|
|
public required Expr Left { get; init; }
|
|
public required Name FieldName { get; init; }
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
{
|
|
return visitor.visitSelectorExpr(this);
|
|
}
|
|
}
|