Lua予約語判定を追加

このコミットが含まれているのは:
routersys committed 2026-07-03 21:30:44 +09:00
1 親 669b24c2b3
コミット ba20fc8187
1ファイル変更
+23
+23
ファイルの表示
@@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace LuaScript.Compat.Syntax
{
internal static class LuaKeywords
{
private static readonly HashSet<string> Reserved = new()
{
"and", "break", "do", "else", "elseif", "end", "false", "for", "function",
"goto", "if", "in", "local", "nil", "not", "or", "repeat", "return",
"then", "true", "until", "while",
};
private static readonly HashSet<string> ExpressionSafe = new()
{
"and", "or", "not", "nil", "true", "false",
};
public static bool IsReserved(string name) => Reserved.Contains(name);
public static bool IsExpressionBoundary(string name) => Reserved.Contains(name) && !ExpressionSafe.Contains(name);
}
}