@trioforge/brigadier 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +73 -2
- package/out/arguments.d.ts +91 -0
- package/out/arguments.luau +475 -0
- package/out/command-dispatcher.d.ts +38 -0
- package/out/command-dispatcher.luau +394 -0
- package/out/command.d.ts +13 -0
- package/out/command.luau +8 -0
- package/out/context.d.ts +121 -0
- package/out/context.luau +576 -0
- package/out/exceptions.d.ts +118 -0
- package/out/exceptions.luau +415 -0
- package/out/index.d.ts +10 -0
- package/out/init.luau +44 -0
- package/out/java.d.ts +40 -0
- package/out/java.luau +424 -0
- package/out/literal-message.d.ts +9 -0
- package/out/literal-message.luau +29 -0
- package/out/string-reader.d.ts +41 -0
- package/out/string-reader.luau +271 -0
- package/out/suggestion.d.ts +60 -0
- package/out/suggestion.luau +340 -0
- package/out/tree.d.ts +126 -0
- package/out/tree.luau +579 -0
- package/package.json +40 -3
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _java = TS.import(script, script.Parent, "java")
|
|
4
|
+
local formatDouble = _java.formatDouble
|
|
5
|
+
local formatFloat = _java.formatFloat
|
|
6
|
+
local formatInteger = _java.formatInteger
|
|
7
|
+
local rethrow = _java.rethrow
|
|
8
|
+
local str = _java.str
|
|
9
|
+
local substring = _java.substring
|
|
10
|
+
local LiteralMessage = TS.import(script, script.Parent, "literal-message").LiteralMessage
|
|
11
|
+
-- A marker, as in Java: any value that names a kind of syntax error.
|
|
12
|
+
local CommandSyntaxException
|
|
13
|
+
do
|
|
14
|
+
CommandSyntaxException = setmetatable({}, {
|
|
15
|
+
__tostring = function()
|
|
16
|
+
return "CommandSyntaxException"
|
|
17
|
+
end,
|
|
18
|
+
})
|
|
19
|
+
CommandSyntaxException.__index = CommandSyntaxException
|
|
20
|
+
function CommandSyntaxException.new(...)
|
|
21
|
+
local self = setmetatable({}, CommandSyntaxException)
|
|
22
|
+
return self:constructor(...) or self
|
|
23
|
+
end
|
|
24
|
+
function CommandSyntaxException:constructor(exceptionType, message, input, cursor)
|
|
25
|
+
self.exceptionType = exceptionType
|
|
26
|
+
self.message = message
|
|
27
|
+
self.input = input
|
|
28
|
+
local _result
|
|
29
|
+
if input == nil then
|
|
30
|
+
_result = -1
|
|
31
|
+
else
|
|
32
|
+
local _condition = cursor
|
|
33
|
+
if _condition == nil then
|
|
34
|
+
_condition = -1
|
|
35
|
+
end
|
|
36
|
+
_result = _condition
|
|
37
|
+
end
|
|
38
|
+
self.cursor = _result
|
|
39
|
+
if CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES then
|
|
40
|
+
self.stackTrace = debug.traceback(nil, 2)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
function CommandSyntaxException:getMessage()
|
|
44
|
+
local message = self.message:getString()
|
|
45
|
+
local context = self:getContext()
|
|
46
|
+
if context ~= nil then
|
|
47
|
+
message ..= ` at position {self.cursor}: {context}`
|
|
48
|
+
end
|
|
49
|
+
return message
|
|
50
|
+
end
|
|
51
|
+
function CommandSyntaxException:getRawMessage()
|
|
52
|
+
return self.message
|
|
53
|
+
end
|
|
54
|
+
function CommandSyntaxException:getContext()
|
|
55
|
+
local input = self.input
|
|
56
|
+
if input == nil or self.cursor < 0 then
|
|
57
|
+
return nil
|
|
58
|
+
end
|
|
59
|
+
local cursor = math.min(#input, self.cursor)
|
|
60
|
+
local builder = ""
|
|
61
|
+
if cursor > CommandSyntaxException.CONTEXT_AMOUNT then
|
|
62
|
+
builder ..= "..."
|
|
63
|
+
end
|
|
64
|
+
builder ..= substring(input, math.max(0, cursor - CommandSyntaxException.CONTEXT_AMOUNT), cursor)
|
|
65
|
+
builder ..= "<--[HERE]"
|
|
66
|
+
return builder
|
|
67
|
+
end
|
|
68
|
+
function CommandSyntaxException:getType()
|
|
69
|
+
return self.exceptionType
|
|
70
|
+
end
|
|
71
|
+
function CommandSyntaxException:getInput()
|
|
72
|
+
return self.input
|
|
73
|
+
end
|
|
74
|
+
function CommandSyntaxException:getCursor()
|
|
75
|
+
return self.cursor
|
|
76
|
+
end
|
|
77
|
+
function CommandSyntaxException:getStackTrace()
|
|
78
|
+
return self.stackTrace
|
|
79
|
+
end
|
|
80
|
+
function CommandSyntaxException:toString()
|
|
81
|
+
return `com.mojang.brigadier.exceptions.CommandSyntaxException: {self:getMessage()}`
|
|
82
|
+
end
|
|
83
|
+
function CommandSyntaxException:__tostring()
|
|
84
|
+
return self:toString()
|
|
85
|
+
end
|
|
86
|
+
CommandSyntaxException.CONTEXT_AMOUNT = 10
|
|
87
|
+
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = true
|
|
88
|
+
end
|
|
89
|
+
-- Runs `body`, handing a CommandSyntaxException it throws to `onSyntaxException`. Java catches only that checked
|
|
90
|
+
-- exception, so any other error propagates unchanged.
|
|
91
|
+
local function catchSyntax(body, onSyntaxException)
|
|
92
|
+
local _exitType, _returns = TS.try(function()
|
|
93
|
+
return TS.TRY_RETURN, { body() }
|
|
94
|
+
end, function(err)
|
|
95
|
+
if TS.instanceof(err, CommandSyntaxException) then
|
|
96
|
+
return TS.TRY_RETURN, { onSyntaxException(err) }
|
|
97
|
+
end
|
|
98
|
+
return TS.TRY_RETURN, { rethrow(err) }
|
|
99
|
+
end)
|
|
100
|
+
if _exitType then
|
|
101
|
+
return unpack(_returns)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
local SimpleCommandExceptionType
|
|
105
|
+
do
|
|
106
|
+
SimpleCommandExceptionType = setmetatable({}, {
|
|
107
|
+
__tostring = function()
|
|
108
|
+
return "SimpleCommandExceptionType"
|
|
109
|
+
end,
|
|
110
|
+
})
|
|
111
|
+
SimpleCommandExceptionType.__index = SimpleCommandExceptionType
|
|
112
|
+
function SimpleCommandExceptionType.new(...)
|
|
113
|
+
local self = setmetatable({}, SimpleCommandExceptionType)
|
|
114
|
+
return self:constructor(...) or self
|
|
115
|
+
end
|
|
116
|
+
function SimpleCommandExceptionType:constructor(message)
|
|
117
|
+
self.message = message
|
|
118
|
+
end
|
|
119
|
+
function SimpleCommandExceptionType:create()
|
|
120
|
+
return CommandSyntaxException.new(self, self.message)
|
|
121
|
+
end
|
|
122
|
+
function SimpleCommandExceptionType:createWithContext(reader)
|
|
123
|
+
return CommandSyntaxException.new(self, self.message, reader:getString(), reader:getCursor())
|
|
124
|
+
end
|
|
125
|
+
function SimpleCommandExceptionType:toString()
|
|
126
|
+
return self.message:getString()
|
|
127
|
+
end
|
|
128
|
+
function SimpleCommandExceptionType:__tostring()
|
|
129
|
+
return self:toString()
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
local DynamicCommandExceptionType
|
|
133
|
+
do
|
|
134
|
+
DynamicCommandExceptionType = setmetatable({}, {
|
|
135
|
+
__tostring = function()
|
|
136
|
+
return "DynamicCommandExceptionType"
|
|
137
|
+
end,
|
|
138
|
+
})
|
|
139
|
+
DynamicCommandExceptionType.__index = DynamicCommandExceptionType
|
|
140
|
+
function DynamicCommandExceptionType.new(...)
|
|
141
|
+
local self = setmetatable({}, DynamicCommandExceptionType)
|
|
142
|
+
return self:constructor(...) or self
|
|
143
|
+
end
|
|
144
|
+
function DynamicCommandExceptionType:constructor(fn)
|
|
145
|
+
self.fn = fn
|
|
146
|
+
end
|
|
147
|
+
function DynamicCommandExceptionType:create(arg)
|
|
148
|
+
return CommandSyntaxException.new(self, self.fn(arg))
|
|
149
|
+
end
|
|
150
|
+
function DynamicCommandExceptionType:createWithContext(reader, arg)
|
|
151
|
+
return CommandSyntaxException.new(self, self.fn(arg), reader:getString(), reader:getCursor())
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
local Dynamic2CommandExceptionType
|
|
155
|
+
do
|
|
156
|
+
Dynamic2CommandExceptionType = setmetatable({}, {
|
|
157
|
+
__tostring = function()
|
|
158
|
+
return "Dynamic2CommandExceptionType"
|
|
159
|
+
end,
|
|
160
|
+
})
|
|
161
|
+
Dynamic2CommandExceptionType.__index = Dynamic2CommandExceptionType
|
|
162
|
+
function Dynamic2CommandExceptionType.new(...)
|
|
163
|
+
local self = setmetatable({}, Dynamic2CommandExceptionType)
|
|
164
|
+
return self:constructor(...) or self
|
|
165
|
+
end
|
|
166
|
+
function Dynamic2CommandExceptionType:constructor(fn)
|
|
167
|
+
self.fn = fn
|
|
168
|
+
end
|
|
169
|
+
function Dynamic2CommandExceptionType:create(a, b)
|
|
170
|
+
return CommandSyntaxException.new(self, self.fn(a, b))
|
|
171
|
+
end
|
|
172
|
+
function Dynamic2CommandExceptionType:createWithContext(reader, a, b)
|
|
173
|
+
return CommandSyntaxException.new(self, self.fn(a, b), reader:getString(), reader:getCursor())
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
local Dynamic3CommandExceptionType
|
|
177
|
+
do
|
|
178
|
+
Dynamic3CommandExceptionType = setmetatable({}, {
|
|
179
|
+
__tostring = function()
|
|
180
|
+
return "Dynamic3CommandExceptionType"
|
|
181
|
+
end,
|
|
182
|
+
})
|
|
183
|
+
Dynamic3CommandExceptionType.__index = Dynamic3CommandExceptionType
|
|
184
|
+
function Dynamic3CommandExceptionType.new(...)
|
|
185
|
+
local self = setmetatable({}, Dynamic3CommandExceptionType)
|
|
186
|
+
return self:constructor(...) or self
|
|
187
|
+
end
|
|
188
|
+
function Dynamic3CommandExceptionType:constructor(fn)
|
|
189
|
+
self.fn = fn
|
|
190
|
+
end
|
|
191
|
+
function Dynamic3CommandExceptionType:create(a, b, c)
|
|
192
|
+
return CommandSyntaxException.new(self, self.fn(a, b, c))
|
|
193
|
+
end
|
|
194
|
+
function Dynamic3CommandExceptionType:createWithContext(reader, a, b, c)
|
|
195
|
+
return CommandSyntaxException.new(self, self.fn(a, b, c), reader:getString(), reader:getCursor())
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
local Dynamic4CommandExceptionType
|
|
199
|
+
do
|
|
200
|
+
Dynamic4CommandExceptionType = setmetatable({}, {
|
|
201
|
+
__tostring = function()
|
|
202
|
+
return "Dynamic4CommandExceptionType"
|
|
203
|
+
end,
|
|
204
|
+
})
|
|
205
|
+
Dynamic4CommandExceptionType.__index = Dynamic4CommandExceptionType
|
|
206
|
+
function Dynamic4CommandExceptionType.new(...)
|
|
207
|
+
local self = setmetatable({}, Dynamic4CommandExceptionType)
|
|
208
|
+
return self:constructor(...) or self
|
|
209
|
+
end
|
|
210
|
+
function Dynamic4CommandExceptionType:constructor(fn)
|
|
211
|
+
self.fn = fn
|
|
212
|
+
end
|
|
213
|
+
function Dynamic4CommandExceptionType:create(a, b, c, d)
|
|
214
|
+
return CommandSyntaxException.new(self, self.fn(a, b, c, d))
|
|
215
|
+
end
|
|
216
|
+
function Dynamic4CommandExceptionType:createWithContext(reader, a, b, c, d)
|
|
217
|
+
return CommandSyntaxException.new(self, self.fn(a, b, c, d), reader:getString(), reader:getCursor())
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
local DynamicNCommandExceptionType
|
|
221
|
+
do
|
|
222
|
+
DynamicNCommandExceptionType = setmetatable({}, {
|
|
223
|
+
__tostring = function()
|
|
224
|
+
return "DynamicNCommandExceptionType"
|
|
225
|
+
end,
|
|
226
|
+
})
|
|
227
|
+
DynamicNCommandExceptionType.__index = DynamicNCommandExceptionType
|
|
228
|
+
function DynamicNCommandExceptionType.new(...)
|
|
229
|
+
local self = setmetatable({}, DynamicNCommandExceptionType)
|
|
230
|
+
return self:constructor(...) or self
|
|
231
|
+
end
|
|
232
|
+
function DynamicNCommandExceptionType:constructor(fn)
|
|
233
|
+
self.fn = fn
|
|
234
|
+
end
|
|
235
|
+
function DynamicNCommandExceptionType:create(_a, ...)
|
|
236
|
+
local args = { ... }
|
|
237
|
+
return CommandSyntaxException.new(self, self.fn(args))
|
|
238
|
+
end
|
|
239
|
+
function DynamicNCommandExceptionType:createWithContext(reader, ...)
|
|
240
|
+
local args = { ... }
|
|
241
|
+
return CommandSyntaxException.new(self, self.fn(args), reader:getString(), reader:getCursor())
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
local function literal(text)
|
|
245
|
+
return LiteralMessage.new(text)
|
|
246
|
+
end
|
|
247
|
+
local DOUBLE_TOO_SMALL = Dynamic2CommandExceptionType.new(function(found, min)
|
|
248
|
+
return literal(`Double must not be less than {formatDouble(min)}, found {formatDouble(found)}`)
|
|
249
|
+
end)
|
|
250
|
+
local DOUBLE_TOO_BIG = Dynamic2CommandExceptionType.new(function(found, max)
|
|
251
|
+
return literal(`Double must not be more than {formatDouble(max)}, found {formatDouble(found)}`)
|
|
252
|
+
end)
|
|
253
|
+
local FLOAT_TOO_SMALL = Dynamic2CommandExceptionType.new(function(found, min)
|
|
254
|
+
return literal(`Float must not be less than {formatFloat(min)}, found {formatFloat(found)}`)
|
|
255
|
+
end)
|
|
256
|
+
local FLOAT_TOO_BIG = Dynamic2CommandExceptionType.new(function(found, max)
|
|
257
|
+
return literal(`Float must not be more than {formatFloat(max)}, found {formatFloat(found)}`)
|
|
258
|
+
end)
|
|
259
|
+
local INTEGER_TOO_SMALL = Dynamic2CommandExceptionType.new(function(found, min)
|
|
260
|
+
return literal(`Integer must not be less than {formatInteger(min)}, found {formatInteger(found)}`)
|
|
261
|
+
end)
|
|
262
|
+
local INTEGER_TOO_BIG = Dynamic2CommandExceptionType.new(function(found, max)
|
|
263
|
+
return literal(`Integer must not be more than {formatInteger(max)}, found {formatInteger(found)}`)
|
|
264
|
+
end)
|
|
265
|
+
local LONG_TOO_SMALL = Dynamic2CommandExceptionType.new(function(found, min)
|
|
266
|
+
return literal(`Long must not be less than {formatInteger(min)}, found {formatInteger(found)}`)
|
|
267
|
+
end)
|
|
268
|
+
local LONG_TOO_BIG = Dynamic2CommandExceptionType.new(function(found, max)
|
|
269
|
+
return literal(`Long must not be more than {formatInteger(max)}, found {formatInteger(found)}`)
|
|
270
|
+
end)
|
|
271
|
+
local LITERAL_INCORRECT = DynamicCommandExceptionType.new(function(expected)
|
|
272
|
+
return literal(`Expected literal {str(expected)}`)
|
|
273
|
+
end)
|
|
274
|
+
local READER_EXPECTED_START_OF_QUOTE = SimpleCommandExceptionType.new(literal("Expected quote to start a string"))
|
|
275
|
+
local READER_EXPECTED_END_OF_QUOTE = SimpleCommandExceptionType.new(literal("Unclosed quoted string"))
|
|
276
|
+
local READER_INVALID_ESCAPE = DynamicCommandExceptionType.new(function(character)
|
|
277
|
+
return literal(`Invalid escape sequence '{str(character)}' in quoted string`)
|
|
278
|
+
end)
|
|
279
|
+
local READER_INVALID_BOOL = DynamicCommandExceptionType.new(function(value)
|
|
280
|
+
return literal(`Invalid bool, expected true or false but found '{str(value)}'`)
|
|
281
|
+
end)
|
|
282
|
+
local READER_INVALID_INT = DynamicCommandExceptionType.new(function(value)
|
|
283
|
+
return literal(`Invalid integer '{str(value)}'`)
|
|
284
|
+
end)
|
|
285
|
+
local READER_EXPECTED_INT = SimpleCommandExceptionType.new(literal("Expected integer"))
|
|
286
|
+
local READER_INVALID_LONG = DynamicCommandExceptionType.new(function(value)
|
|
287
|
+
return literal(`Invalid long '{str(value)}'`)
|
|
288
|
+
end)
|
|
289
|
+
local READER_EXPECTED_LONG = SimpleCommandExceptionType.new(literal("Expected long"))
|
|
290
|
+
local READER_INVALID_DOUBLE = DynamicCommandExceptionType.new(function(value)
|
|
291
|
+
return literal(`Invalid double '{str(value)}'`)
|
|
292
|
+
end)
|
|
293
|
+
local READER_EXPECTED_DOUBLE = SimpleCommandExceptionType.new(literal("Expected double"))
|
|
294
|
+
local READER_INVALID_FLOAT = DynamicCommandExceptionType.new(function(value)
|
|
295
|
+
return literal(`Invalid float '{str(value)}'`)
|
|
296
|
+
end)
|
|
297
|
+
local READER_EXPECTED_FLOAT = SimpleCommandExceptionType.new(literal("Expected float"))
|
|
298
|
+
local READER_EXPECTED_BOOL = SimpleCommandExceptionType.new(literal("Expected bool"))
|
|
299
|
+
local READER_EXPECTED_SYMBOL = DynamicCommandExceptionType.new(function(symbol)
|
|
300
|
+
return literal(`Expected '{str(symbol)}'`)
|
|
301
|
+
end)
|
|
302
|
+
local DISPATCHER_UNKNOWN_COMMAND = SimpleCommandExceptionType.new(literal("Unknown command"))
|
|
303
|
+
local DISPATCHER_UNKNOWN_ARGUMENT = SimpleCommandExceptionType.new(literal("Incorrect argument for command"))
|
|
304
|
+
local DISPATCHER_EXPECTED_ARGUMENT_SEPARATOR = SimpleCommandExceptionType.new(literal("Expected whitespace to end one argument, but found trailing data"))
|
|
305
|
+
local DISPATCHER_PARSE_EXCEPTION = DynamicCommandExceptionType.new(function(message)
|
|
306
|
+
return literal(`Could not parse command: {str(message)}`)
|
|
307
|
+
end)
|
|
308
|
+
local BuiltInExceptions
|
|
309
|
+
do
|
|
310
|
+
BuiltInExceptions = setmetatable({}, {
|
|
311
|
+
__tostring = function()
|
|
312
|
+
return "BuiltInExceptions"
|
|
313
|
+
end,
|
|
314
|
+
})
|
|
315
|
+
BuiltInExceptions.__index = BuiltInExceptions
|
|
316
|
+
function BuiltInExceptions.new(...)
|
|
317
|
+
local self = setmetatable({}, BuiltInExceptions)
|
|
318
|
+
return self:constructor(...) or self
|
|
319
|
+
end
|
|
320
|
+
function BuiltInExceptions:constructor()
|
|
321
|
+
end
|
|
322
|
+
function BuiltInExceptions:doubleTooLow()
|
|
323
|
+
return DOUBLE_TOO_SMALL
|
|
324
|
+
end
|
|
325
|
+
function BuiltInExceptions:doubleTooHigh()
|
|
326
|
+
return DOUBLE_TOO_BIG
|
|
327
|
+
end
|
|
328
|
+
function BuiltInExceptions:floatTooLow()
|
|
329
|
+
return FLOAT_TOO_SMALL
|
|
330
|
+
end
|
|
331
|
+
function BuiltInExceptions:floatTooHigh()
|
|
332
|
+
return FLOAT_TOO_BIG
|
|
333
|
+
end
|
|
334
|
+
function BuiltInExceptions:integerTooLow()
|
|
335
|
+
return INTEGER_TOO_SMALL
|
|
336
|
+
end
|
|
337
|
+
function BuiltInExceptions:integerTooHigh()
|
|
338
|
+
return INTEGER_TOO_BIG
|
|
339
|
+
end
|
|
340
|
+
function BuiltInExceptions:longTooLow()
|
|
341
|
+
return LONG_TOO_SMALL
|
|
342
|
+
end
|
|
343
|
+
function BuiltInExceptions:longTooHigh()
|
|
344
|
+
return LONG_TOO_BIG
|
|
345
|
+
end
|
|
346
|
+
function BuiltInExceptions:literalIncorrect()
|
|
347
|
+
return LITERAL_INCORRECT
|
|
348
|
+
end
|
|
349
|
+
function BuiltInExceptions:readerExpectedStartOfQuote()
|
|
350
|
+
return READER_EXPECTED_START_OF_QUOTE
|
|
351
|
+
end
|
|
352
|
+
function BuiltInExceptions:readerExpectedEndOfQuote()
|
|
353
|
+
return READER_EXPECTED_END_OF_QUOTE
|
|
354
|
+
end
|
|
355
|
+
function BuiltInExceptions:readerInvalidEscape()
|
|
356
|
+
return READER_INVALID_ESCAPE
|
|
357
|
+
end
|
|
358
|
+
function BuiltInExceptions:readerInvalidBool()
|
|
359
|
+
return READER_INVALID_BOOL
|
|
360
|
+
end
|
|
361
|
+
function BuiltInExceptions:readerInvalidInt()
|
|
362
|
+
return READER_INVALID_INT
|
|
363
|
+
end
|
|
364
|
+
function BuiltInExceptions:readerExpectedInt()
|
|
365
|
+
return READER_EXPECTED_INT
|
|
366
|
+
end
|
|
367
|
+
function BuiltInExceptions:readerInvalidLong()
|
|
368
|
+
return READER_INVALID_LONG
|
|
369
|
+
end
|
|
370
|
+
function BuiltInExceptions:readerExpectedLong()
|
|
371
|
+
return READER_EXPECTED_LONG
|
|
372
|
+
end
|
|
373
|
+
function BuiltInExceptions:readerInvalidDouble()
|
|
374
|
+
return READER_INVALID_DOUBLE
|
|
375
|
+
end
|
|
376
|
+
function BuiltInExceptions:readerExpectedDouble()
|
|
377
|
+
return READER_EXPECTED_DOUBLE
|
|
378
|
+
end
|
|
379
|
+
function BuiltInExceptions:readerInvalidFloat()
|
|
380
|
+
return READER_INVALID_FLOAT
|
|
381
|
+
end
|
|
382
|
+
function BuiltInExceptions:readerExpectedFloat()
|
|
383
|
+
return READER_EXPECTED_FLOAT
|
|
384
|
+
end
|
|
385
|
+
function BuiltInExceptions:readerExpectedBool()
|
|
386
|
+
return READER_EXPECTED_BOOL
|
|
387
|
+
end
|
|
388
|
+
function BuiltInExceptions:readerExpectedSymbol()
|
|
389
|
+
return READER_EXPECTED_SYMBOL
|
|
390
|
+
end
|
|
391
|
+
function BuiltInExceptions:dispatcherUnknownCommand()
|
|
392
|
+
return DISPATCHER_UNKNOWN_COMMAND
|
|
393
|
+
end
|
|
394
|
+
function BuiltInExceptions:dispatcherUnknownArgument()
|
|
395
|
+
return DISPATCHER_UNKNOWN_ARGUMENT
|
|
396
|
+
end
|
|
397
|
+
function BuiltInExceptions:dispatcherExpectedArgumentSeparator()
|
|
398
|
+
return DISPATCHER_EXPECTED_ARGUMENT_SEPARATOR
|
|
399
|
+
end
|
|
400
|
+
function BuiltInExceptions:dispatcherParseException()
|
|
401
|
+
return DISPATCHER_PARSE_EXCEPTION
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
CommandSyntaxException.BUILT_IN_EXCEPTIONS = BuiltInExceptions.new()
|
|
405
|
+
return {
|
|
406
|
+
catchSyntax = catchSyntax,
|
|
407
|
+
CommandSyntaxException = CommandSyntaxException,
|
|
408
|
+
SimpleCommandExceptionType = SimpleCommandExceptionType,
|
|
409
|
+
DynamicCommandExceptionType = DynamicCommandExceptionType,
|
|
410
|
+
Dynamic2CommandExceptionType = Dynamic2CommandExceptionType,
|
|
411
|
+
Dynamic3CommandExceptionType = Dynamic3CommandExceptionType,
|
|
412
|
+
Dynamic4CommandExceptionType = Dynamic4CommandExceptionType,
|
|
413
|
+
DynamicNCommandExceptionType = DynamicNCommandExceptionType,
|
|
414
|
+
BuiltInExceptions = BuiltInExceptions,
|
|
415
|
+
}
|
package/out/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./arguments";
|
|
2
|
+
export * from "./command";
|
|
3
|
+
export * from "./command-dispatcher";
|
|
4
|
+
export * from "./context";
|
|
5
|
+
export { BuiltInExceptions, type BuiltInExceptionProvider, type CommandExceptionType, CommandSyntaxException, Dynamic2CommandExceptionType, Dynamic3CommandExceptionType, Dynamic4CommandExceptionType, DynamicCommandExceptionType, DynamicNCommandExceptionType, SimpleCommandExceptionType, } from "./exceptions";
|
|
6
|
+
export { IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, RuntimeException, StringIndexOutOfBoundsException, UnsupportedOperationException, } from "./java";
|
|
7
|
+
export * from "./literal-message";
|
|
8
|
+
export * from "./string-reader";
|
|
9
|
+
export * from "./suggestion";
|
|
10
|
+
export * from "./tree";
|
package/out/init.luau
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "arguments") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "command") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
10
|
+
for _k, _v in TS.import(script, script, "command-dispatcher") or {} do
|
|
11
|
+
exports[_k] = _v
|
|
12
|
+
end
|
|
13
|
+
for _k, _v in TS.import(script, script, "context") or {} do
|
|
14
|
+
exports[_k] = _v
|
|
15
|
+
end
|
|
16
|
+
local _exceptions = TS.import(script, script, "exceptions")
|
|
17
|
+
exports.BuiltInExceptions = _exceptions.BuiltInExceptions
|
|
18
|
+
exports.CommandSyntaxException = _exceptions.CommandSyntaxException
|
|
19
|
+
exports.Dynamic2CommandExceptionType = _exceptions.Dynamic2CommandExceptionType
|
|
20
|
+
exports.Dynamic3CommandExceptionType = _exceptions.Dynamic3CommandExceptionType
|
|
21
|
+
exports.Dynamic4CommandExceptionType = _exceptions.Dynamic4CommandExceptionType
|
|
22
|
+
exports.DynamicCommandExceptionType = _exceptions.DynamicCommandExceptionType
|
|
23
|
+
exports.DynamicNCommandExceptionType = _exceptions.DynamicNCommandExceptionType
|
|
24
|
+
exports.SimpleCommandExceptionType = _exceptions.SimpleCommandExceptionType
|
|
25
|
+
local _java = TS.import(script, script, "java")
|
|
26
|
+
exports.IllegalArgumentException = _java.IllegalArgumentException
|
|
27
|
+
exports.IllegalStateException = _java.IllegalStateException
|
|
28
|
+
exports.IndexOutOfBoundsException = _java.IndexOutOfBoundsException
|
|
29
|
+
exports.RuntimeException = _java.RuntimeException
|
|
30
|
+
exports.StringIndexOutOfBoundsException = _java.StringIndexOutOfBoundsException
|
|
31
|
+
exports.UnsupportedOperationException = _java.UnsupportedOperationException
|
|
32
|
+
for _k, _v in TS.import(script, script, "literal-message") or {} do
|
|
33
|
+
exports[_k] = _v
|
|
34
|
+
end
|
|
35
|
+
for _k, _v in TS.import(script, script, "string-reader") or {} do
|
|
36
|
+
exports[_k] = _v
|
|
37
|
+
end
|
|
38
|
+
for _k, _v in TS.import(script, script, "suggestion") or {} do
|
|
39
|
+
exports[_k] = _v
|
|
40
|
+
end
|
|
41
|
+
for _k, _v in TS.import(script, script, "tree") or {} do
|
|
42
|
+
exports[_k] = _v
|
|
43
|
+
end
|
|
44
|
+
return exports
|
package/out/java.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare class RuntimeException {
|
|
2
|
+
private readonly message?;
|
|
3
|
+
protected readonly simpleName: string;
|
|
4
|
+
constructor(message?: string | undefined);
|
|
5
|
+
getMessage(): string | undefined;
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
export declare class IllegalArgumentException extends RuntimeException {
|
|
9
|
+
protected readonly simpleName: string;
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare class IllegalStateException extends RuntimeException {
|
|
13
|
+
protected readonly simpleName: string;
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|
|
16
|
+
export declare class UnsupportedOperationException extends RuntimeException {
|
|
17
|
+
protected readonly simpleName: string;
|
|
18
|
+
toString(): string;
|
|
19
|
+
}
|
|
20
|
+
export declare class IndexOutOfBoundsException extends RuntimeException {
|
|
21
|
+
protected readonly simpleName: string;
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
24
|
+
export declare class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
|
|
25
|
+
protected readonly simpleName: string;
|
|
26
|
+
toString(): string;
|
|
27
|
+
}
|
|
28
|
+
export declare function rethrow(err: unknown): never;
|
|
29
|
+
export declare function str(value: unknown): string;
|
|
30
|
+
export declare function substring(text: string, beginIndex: number, endIndex?: number): string;
|
|
31
|
+
export declare function charAt(text: string, index: number): string;
|
|
32
|
+
export declare function startsWith(text: string, prefix: string): boolean;
|
|
33
|
+
export declare function toLowerCase(text: string): string;
|
|
34
|
+
export declare function compareStrings(a: string, b: string): number;
|
|
35
|
+
export declare function objectsEquals(a: unknown, b: unknown): boolean;
|
|
36
|
+
export declare function stableSort<T extends defined>(list: T[], compare: (a: T, b: T) => number): void;
|
|
37
|
+
export declare function formatInteger(value: number): string;
|
|
38
|
+
export declare function toFloat(value: number): number;
|
|
39
|
+
export declare function formatDouble(value: number): string;
|
|
40
|
+
export declare function formatFloat(value: number): string;
|