2023-06-25 01:15:37 +00:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// THIS FILE IS GENERATED. //
|
|
|
|
// DO NOT EDIT. //
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
using System;
|
2023-07-02 05:13:24 +00:00
|
|
|
|
2023-06-25 01:15:37 +00:00
|
|
|
namespace Finn.AST;
|
|
|
|
|
|
|
|
public abstract class Expr {
|
|
|
|
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-01 06:12:02 +00:00
|
|
|
T visitSelectorExpr(Selector expr);
|
2023-06-25 01:15:37 +00:00
|
|
|
}
|
2023-06-28 23:18:31 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2023-06-25 01:15:37 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2023-06-28 22:26:08 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2023-07-01 06:12:02 +00:00
|
|
|
public class Identifier : Expr
|
|
|
|
{
|
|
|
|
public required Name Value { get; init; }
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitIdentifierExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-02 05:13:24 +00:00
|
|
|
public class List : Expr
|
|
|
|
{
|
|
|
|
public required Expr[] Elements { get; init; }
|
|
|
|
public override T accept<T>(IVisitor<T> visitor)
|
|
|
|
{
|
|
|
|
return visitor.visitListExpr(this);
|
|
|
|
}
|
|
|
|
}
|
2023-07-01 06:12:02 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|