File size: 3,383 Bytes
1ae2e8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using Microsoft.CodeAnalysis.CSharp;

namespace RobloxCS
{
    internal static class Constants
    {
        public static readonly HashSet<string> UNSUPPORTED_BITWISE_TYPES =
        [
            "UInt128",
            "ulong",
            "long",
            "Int128"
        ];

        public static readonly HashSet<string> LENGTH_READABLE_TYPES =
        [
            "String",
            "string",
            "Array"
        ];

        public static readonly Dictionary<string, string> MAPPED_STRING_METHODS = new Dictionary<string, string>
        {
            { "Replace", "gsub" },
            { "Split", "split" },
            { "ToLower", "lower" },
            { "ToUpper", "upper" },
            { "Reverse", "reverse" }
        };

        public static readonly HashSet<string> GLOBAL_LIBRARIES =
        [
            "task",
            "math",
            "table",
            "os",
            "buffer",
            "coroutine",
            "utf8",
            "debug"
        ];

        public static readonly HashSet<string> METAMETHODS =
        [
            "__tostring",
            "__add",
            "__sub",
            "__mul",
            "__div",
            "__idiv",
            "__mod",
            "__pow",
            "__unm",
            "__eq",
            "__le",
            "__lte",
            "__len",
            "__iter",
            "__call",
            "__concat",
            "__mode",
            "__index",
            "__newindex",
            "__metatable",
        ];

        public static readonly HashSet<string> LUAU_KEYWORDS =
        [
            "local",
            "and",
            "or",
            "if",
            "else",
            "elseif",
            "then",
            "do",
            "end",
            "function",
            "for",
            "while",
            "in",
            "export",
            "type",
            "typeof"
        ];

        public static readonly HashSet<SyntaxKind> MEMBER_PARENT_SYNTAXES =
        [
            SyntaxKind.NamespaceDeclaration,
            SyntaxKind.ClassDeclaration,
            SyntaxKind.InterfaceDeclaration,
            SyntaxKind.StructDeclaration
        ];

        public static readonly HashSet<string> NO_FULL_QUALIFICATION_TYPES =
        [
            "System",
            "Roblox",
            "Globals",
            "PluginClasses"
        ];

        public static readonly HashSet<string> IGNORED_BINARY_OPERATORS =
        [
            "as"
        ];

        public static readonly Dictionary<List<string>, (string, string)> PER_TYPE_BINARY_OPERATOR_MAP = new Dictionary<List<string>, (string, string)>
        {
            { ["String", "string"], ("+", "..") }
        };

        public static readonly HashSet<string> DECIMAL_TYPES =
        [
            "float",
            "double",
            "Single",
            "Double"
        ];

        public static readonly HashSet<string> INTEGER_TYPES =
        [
            "sbyte",
            "byte",
            "short",
            "ushort",
            "int",
            "uint",
            "long",
            "ulong",
            "SByte",
            "Byte",
            "Int16",
            "Int32",
            "Int64",
            "Int128",
            "UInt16",
            "UInt32",
            "UInt64",
            "UInt128",
        ];
    }
}