41 lines
701 B
C#
41 lines
701 B
C#
using System.CodeDom.Compiler;
|
|
|
|
namespace Finn.AST;
|
|
|
|
public record Name(string Value, bool Quoted)
|
|
{
|
|
public override string ToString()
|
|
{
|
|
if (this.Quoted) return $"@\"{this.Value}\"";
|
|
return this.Value;
|
|
}
|
|
};
|
|
|
|
public record Field(Name Name, Expr? Value);
|
|
|
|
public record BaseRecord(Expr Value, Field[] Updates);
|
|
|
|
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()!;
|
|
}
|
|
}
|