39 lines
676 B
C#
39 lines
676 B
C#
using System.Text;
|
|
|
|
namespace NubLang.Generation.QBE;
|
|
|
|
internal class QBEWriter
|
|
{
|
|
private readonly StringBuilder _builder = new();
|
|
|
|
public void Indented(string value)
|
|
{
|
|
_builder.Append('\t');
|
|
_builder.AppendLine(value);
|
|
}
|
|
|
|
public void Comment(string comment)
|
|
{
|
|
_builder.AppendLine("# " + comment);
|
|
}
|
|
|
|
public void WriteLine(string text)
|
|
{
|
|
_builder.AppendLine(text);
|
|
}
|
|
|
|
public void Write(string text)
|
|
{
|
|
_builder.Append(text);
|
|
}
|
|
|
|
public void NewLine()
|
|
{
|
|
_builder.AppendLine();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return _builder.ToString();
|
|
}
|
|
} |