Api のトップレベル型を1ファイル1クラス化
このコミットが含まれているのは:
15ファイル変更
+174
-154
検索条件に一致するファイルはありません
@@ -1,38 +0,0 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
|
||||
internal sealed class LuaTableAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaFunctionAttribute(string name, params string[] parameters) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string[] Parameters { get; } = parameters;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false)]
|
||||
internal sealed class LuaConstantAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly | AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaVariableAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
public bool InCatalog { get; init; } = true;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaBuiltinAttribute(string name, params string[] parameters) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string[] Parameters { get; } = parameters;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,5 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
internal enum LuaApiMemberKind
|
||||
{
|
||||
Function,
|
||||
Variable,
|
||||
}
|
||||
|
||||
internal sealed record LuaApiMember(
|
||||
string Table,
|
||||
string Name,
|
||||
LuaApiMemberKind Kind,
|
||||
IReadOnlyList<string> Parameters)
|
||||
{
|
||||
public string QualifiedName => Table.Length == 0 ? Name : $"{Table}.{Name}";
|
||||
}
|
||||
|
||||
internal static class LuaApiCatalog
|
||||
{
|
||||
private static readonly object s_gate = new();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
internal sealed record LuaApiMember(
|
||||
string Table,
|
||||
string Name,
|
||||
LuaApiMemberKind Kind,
|
||||
IReadOnlyList<string> Parameters)
|
||||
{
|
||||
public string QualifiedName => Table.Length == 0 ? Name : $"{Table}.{Name}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
internal enum LuaApiMemberKind
|
||||
{
|
||||
Function,
|
||||
Variable,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("")]
|
||||
[LuaBuiltin("type", "v")]
|
||||
[LuaBuiltin("tostring", "v")]
|
||||
[LuaBuiltin("tonumber", "e", "base")]
|
||||
[LuaBuiltin("select", "n", "...")]
|
||||
[LuaBuiltin("error", "message", "level")]
|
||||
[LuaBuiltin("assert", "v", "message")]
|
||||
[LuaBuiltin("print", "...")]
|
||||
[LuaBuiltin("ipairs", "t")]
|
||||
[LuaBuiltin("pairs", "t")]
|
||||
[LuaBuiltin("next", "table", "index")]
|
||||
[LuaBuiltin("unpack", "list", "i", "j")]
|
||||
[LuaBuiltin("setmetatable", "table", "metatable")]
|
||||
[LuaBuiltin("getmetatable", "object")]
|
||||
[LuaBuiltin("rawget", "table", "index")]
|
||||
[LuaBuiltin("rawset", "table", "index", "value")]
|
||||
[LuaBuiltin("rawequal", "v1", "v2")]
|
||||
[LuaBuiltin("rawlen", "v")]
|
||||
[LuaBuiltin("pcall", "f", "...")]
|
||||
[LuaBuiltin("xpcall", "f", "msgh", "...")]
|
||||
internal static class LuaBasicLibrary;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("bit32")]
|
||||
[LuaBuiltin("band", "...")]
|
||||
[LuaBuiltin("bor", "...")]
|
||||
[LuaBuiltin("bxor", "...")]
|
||||
[LuaBuiltin("bnot", "x")]
|
||||
[LuaBuiltin("lshift", "x", "disp")]
|
||||
[LuaBuiltin("rshift", "x", "disp")]
|
||||
[LuaBuiltin("arshift", "x", "disp")]
|
||||
[LuaBuiltin("extract", "n", "field", "width")]
|
||||
[LuaBuiltin("replace", "n", "v", "field", "width")]
|
||||
[LuaBuiltin("btest", "...")]
|
||||
[LuaBuiltin("countlz", "x")]
|
||||
[LuaBuiltin("countrz", "x")]
|
||||
internal static class LuaBit32Library;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaBuiltinAttribute(string name, params string[] parameters) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string[] Parameters { get; } = parameters;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false)]
|
||||
internal sealed class LuaConstantAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaFunctionAttribute(string name, params string[] parameters) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string[] Parameters { get; } = parameters;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("math")]
|
||||
[LuaBuiltin("abs", "x")]
|
||||
[LuaBuiltin("ceil", "x")]
|
||||
[LuaBuiltin("cos", "x")]
|
||||
[LuaBuiltin("exp", "x")]
|
||||
[LuaBuiltin("floor", "x")]
|
||||
[LuaBuiltin("fmod", "x", "y")]
|
||||
[LuaVariable("huge")]
|
||||
[LuaBuiltin("log", "x", "base")]
|
||||
[LuaBuiltin("max", "x", "...")]
|
||||
[LuaBuiltin("min", "x", "...")]
|
||||
[LuaBuiltin("modf", "x")]
|
||||
[LuaVariable("pi")]
|
||||
[LuaBuiltin("random", "m", "n")]
|
||||
[LuaBuiltin("randomseed", "x")]
|
||||
[LuaBuiltin("sin", "x")]
|
||||
[LuaBuiltin("sqrt", "x")]
|
||||
[LuaBuiltin("tan", "x")]
|
||||
[LuaBuiltin("atan", "y", "x")]
|
||||
[LuaBuiltin("atan2", "y", "x")]
|
||||
[LuaBuiltin("deg", "x")]
|
||||
[LuaBuiltin("rad", "x")]
|
||||
[LuaBuiltin("ldexp", "m", "e")]
|
||||
[LuaBuiltin("frexp", "x")]
|
||||
[LuaBuiltin("sinh", "x")]
|
||||
[LuaBuiltin("cosh", "x")]
|
||||
[LuaBuiltin("tanh", "x")]
|
||||
[LuaBuiltin("type", "x")]
|
||||
[LuaBuiltin("tointeger", "x")]
|
||||
[LuaVariable("maxinteger")]
|
||||
[LuaVariable("mininteger")]
|
||||
internal static class LuaMathLibrary;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("math")]
|
||||
[LuaBuiltin("abs", "x")]
|
||||
[LuaBuiltin("ceil", "x")]
|
||||
[LuaBuiltin("cos", "x")]
|
||||
[LuaBuiltin("exp", "x")]
|
||||
[LuaBuiltin("floor", "x")]
|
||||
[LuaBuiltin("fmod", "x", "y")]
|
||||
[LuaVariable("huge")]
|
||||
[LuaBuiltin("log", "x", "base")]
|
||||
[LuaBuiltin("max", "x", "...")]
|
||||
[LuaBuiltin("min", "x", "...")]
|
||||
[LuaBuiltin("modf", "x")]
|
||||
[LuaVariable("pi")]
|
||||
[LuaBuiltin("random", "m", "n")]
|
||||
[LuaBuiltin("randomseed", "x")]
|
||||
[LuaBuiltin("sin", "x")]
|
||||
[LuaBuiltin("sqrt", "x")]
|
||||
[LuaBuiltin("tan", "x")]
|
||||
[LuaBuiltin("atan", "y", "x")]
|
||||
[LuaBuiltin("atan2", "y", "x")]
|
||||
[LuaBuiltin("deg", "x")]
|
||||
[LuaBuiltin("rad", "x")]
|
||||
[LuaBuiltin("ldexp", "m", "e")]
|
||||
[LuaBuiltin("frexp", "x")]
|
||||
[LuaBuiltin("sinh", "x")]
|
||||
[LuaBuiltin("cosh", "x")]
|
||||
[LuaBuiltin("tanh", "x")]
|
||||
[LuaBuiltin("type", "x")]
|
||||
[LuaBuiltin("tointeger", "x")]
|
||||
[LuaVariable("maxinteger")]
|
||||
[LuaVariable("mininteger")]
|
||||
internal static class LuaMathLibrary;
|
||||
|
||||
[LuaTable("string")]
|
||||
[LuaBuiltin("format", "formatstring", "...")]
|
||||
[LuaBuiltin("len", "s")]
|
||||
[LuaBuiltin("sub", "s", "i", "j")]
|
||||
[LuaBuiltin("upper", "s")]
|
||||
[LuaBuiltin("lower", "s")]
|
||||
[LuaBuiltin("rep", "s", "n", "sep")]
|
||||
[LuaBuiltin("reverse", "s")]
|
||||
[LuaBuiltin("find", "s", "pattern", "init", "plain")]
|
||||
[LuaBuiltin("match", "s", "pattern", "init")]
|
||||
[LuaBuiltin("gmatch", "s", "pattern")]
|
||||
[LuaBuiltin("gsub", "s", "pattern", "repl", "n")]
|
||||
[LuaBuiltin("byte", "s", "i", "j")]
|
||||
[LuaBuiltin("char", "...")]
|
||||
[LuaBuiltin("dump", "function")]
|
||||
[LuaBuiltin("pack", "fmt", "...")]
|
||||
[LuaBuiltin("unpack", "fmt", "s", "pos")]
|
||||
[LuaBuiltin("packsize", "fmt")]
|
||||
internal static class LuaStringLibrary;
|
||||
|
||||
[LuaTable("table")]
|
||||
[LuaBuiltin("insert", "list", "pos", "value")]
|
||||
[LuaBuiltin("remove", "list", "pos")]
|
||||
[LuaBuiltin("sort", "list", "comp")]
|
||||
[LuaBuiltin("concat", "list", "sep", "i", "j")]
|
||||
[LuaBuiltin("unpack", "list", "i", "j")]
|
||||
[LuaBuiltin("move", "a1", "f", "e", "t", "a2")]
|
||||
internal static class LuaTableLibrary;
|
||||
|
||||
[LuaTable("bit32")]
|
||||
[LuaBuiltin("band", "...")]
|
||||
[LuaBuiltin("bor", "...")]
|
||||
[LuaBuiltin("bxor", "...")]
|
||||
[LuaBuiltin("bnot", "x")]
|
||||
[LuaBuiltin("lshift", "x", "disp")]
|
||||
[LuaBuiltin("rshift", "x", "disp")]
|
||||
[LuaBuiltin("arshift", "x", "disp")]
|
||||
[LuaBuiltin("extract", "n", "field", "width")]
|
||||
[LuaBuiltin("replace", "n", "v", "field", "width")]
|
||||
[LuaBuiltin("btest", "...")]
|
||||
[LuaBuiltin("countlz", "x")]
|
||||
[LuaBuiltin("countrz", "x")]
|
||||
internal static class LuaBit32Library;
|
||||
|
||||
[LuaTable("")]
|
||||
[LuaBuiltin("type", "v")]
|
||||
[LuaBuiltin("tostring", "v")]
|
||||
[LuaBuiltin("tonumber", "e", "base")]
|
||||
[LuaBuiltin("select", "n", "...")]
|
||||
[LuaBuiltin("error", "message", "level")]
|
||||
[LuaBuiltin("assert", "v", "message")]
|
||||
[LuaBuiltin("print", "...")]
|
||||
[LuaBuiltin("ipairs", "t")]
|
||||
[LuaBuiltin("pairs", "t")]
|
||||
[LuaBuiltin("next", "table", "index")]
|
||||
[LuaBuiltin("unpack", "list", "i", "j")]
|
||||
[LuaBuiltin("setmetatable", "table", "metatable")]
|
||||
[LuaBuiltin("getmetatable", "object")]
|
||||
[LuaBuiltin("rawget", "table", "index")]
|
||||
[LuaBuiltin("rawset", "table", "index", "value")]
|
||||
[LuaBuiltin("rawequal", "v1", "v2")]
|
||||
[LuaBuiltin("rawlen", "v")]
|
||||
[LuaBuiltin("pcall", "f", "...")]
|
||||
[LuaBuiltin("xpcall", "f", "msgh", "...")]
|
||||
internal static class LuaBasicLibrary;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("string")]
|
||||
[LuaBuiltin("format", "formatstring", "...")]
|
||||
[LuaBuiltin("len", "s")]
|
||||
[LuaBuiltin("sub", "s", "i", "j")]
|
||||
[LuaBuiltin("upper", "s")]
|
||||
[LuaBuiltin("lower", "s")]
|
||||
[LuaBuiltin("rep", "s", "n", "sep")]
|
||||
[LuaBuiltin("reverse", "s")]
|
||||
[LuaBuiltin("find", "s", "pattern", "init", "plain")]
|
||||
[LuaBuiltin("match", "s", "pattern", "init")]
|
||||
[LuaBuiltin("gmatch", "s", "pattern")]
|
||||
[LuaBuiltin("gsub", "s", "pattern", "repl", "n")]
|
||||
[LuaBuiltin("byte", "s", "i", "j")]
|
||||
[LuaBuiltin("char", "...")]
|
||||
[LuaBuiltin("dump", "function")]
|
||||
[LuaBuiltin("pack", "fmt", "...")]
|
||||
[LuaBuiltin("unpack", "fmt", "s", "pos")]
|
||||
[LuaBuiltin("packsize", "fmt")]
|
||||
internal static class LuaStringLibrary;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
|
||||
internal sealed class LuaTableAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[LuaTable("table")]
|
||||
[LuaBuiltin("insert", "list", "pos", "value")]
|
||||
[LuaBuiltin("remove", "list", "pos")]
|
||||
[LuaBuiltin("sort", "list", "comp")]
|
||||
[LuaBuiltin("concat", "list", "sep", "i", "j")]
|
||||
[LuaBuiltin("unpack", "list", "i", "j")]
|
||||
[LuaBuiltin("move", "a1", "f", "e", "t", "a2")]
|
||||
internal static class LuaTableLibrary;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace LuaScript.Api
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly | AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class LuaVariableAttribute(string name) : Attribute
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
public string Table { get; init; } = string.Empty;
|
||||
public bool InCatalog { get; init; } = true;
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする