2023-07-02 20:27:12 +00:00
|
|
|
using System.CodeDom.Compiler;
|
|
|
|
|
2023-07-01 06:12:02 +00:00
|
|
|
namespace Finn.AST;
|
|
|
|
|
2023-07-02 20:27:12 +00:00
|
|
|
public record Name(string Value, bool Quoted)
|
|
|
|
{
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
if (this.Quoted) return $"@\"{this.Value}\"";
|
|
|
|
return this.Value;
|
|
|
|
}
|
|
|
|
};
|
2023-07-02 17:38:48 +00:00
|
|
|
|
|
|
|
public record Field(Name Name, Expr? Value);
|
|
|
|
|
|
|
|
public record BaseRecord(Expr Value, Field[] Updates);
|
2023-07-02 20:27:12 +00:00
|
|
|
|
|
|
|
public partial record Identifier
|
|
|
|
{
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return this.Value.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public partial record Binary
|
|
|
|
{
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return $"Binary {{ Left = {this.Left}, Op = {this.Op.lexeme}, Right = {this.Right} }}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public partial record Literal
|
|
|
|
{
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
return this.Value.ToString()!;
|
|
|
|
}
|
|
|
|
}
|