...
This commit is contained in:
39
compiler/NubLang/Generation/QBE/QBEWriter.cs
Normal file
39
compiler/NubLang/Generation/QBE/QBEWriter.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user