変更行を返す書き換えAPIを追加

このコミットが含まれているのは:
routersys committed 2026-07-03 23:07:11 +09:00
1 親 6e13a4d1c2
コミット 9bcab1ae28
1ファイル変更
+5 -3
+5 -3
ファイルの表示
@@ -4,10 +4,12 @@ namespace LuaScript.Compat
{
internal static class LuaSyntaxExtensions
{
public static string Rewrite(string source)
public static string Rewrite(string source) => RewriteWithMap(source).Code;
public static (string Code, int[] ChangedLines) RewriteWithMap(string source)
{
if (string.IsNullOrEmpty(source))
return source;
return (source, []);
var tokens = LuaSyntaxLexer.Tokenize(source);
var context = new LuaRewriteContext(tokens);
@@ -40,7 +42,7 @@ namespace LuaScript.Compat
}
}
return context.Changed ? context.Serialize() : source;
return context.Changed ? (context.Serialize(), context.ChangedLines) : (source, []);
}
}
}