mycroforge/MycroForge.CLI/CodeGen/PythonSourceModifier.cs

17 lines
446 B
C#

using Antlr4.Runtime;
namespace MycroForge.CLI.CodeGen;
public abstract class PythonSourceModifier : PythonSourceVisitor
{
protected PythonSourceModifier(string source) : base(source)
{
}
public abstract string Rewrite();
protected void Rewrite(ParserRuleContext context, params string[] text)
{
Rewriter.Replace(from: context.start, to: context.Stop, text: string.Join('\n', text));
}
}