fixes regex types

This commit is contained in:
HowManySmall 2024-08-31 18:34:29 -06:00
parent ff83c401b8
commit d6e172bbb8

View file

@ -11,50 +11,64 @@
- `len` -- The length of the text that was matched.
]=]
local RegexMatch = {
start = 0,
finish = 0,
text = "",
len = 0,
start = 0;
finish = 0;
text = "";
len = 0;
}
type RegexMatch = typeof(RegexMatch)
local RegexCaptures = {}
function RegexCaptures.get(self: RegexCaptures, index: number): RegexMatch?
return nil :: any
end
function RegexCaptures.group(self: RegexCaptures, group: string): RegexMatch?
return nil :: any
end
function RegexCaptures.format(self: RegexCaptures, format: string): string
return nil :: any
end
--[=[
@class RegexCaptures
Captures from a regular expression.
]=]
local RegexCaptures = {}
export type RegexCaptures = typeof(setmetatable(
{} :: {
--[=[
@within RegexCaptures
@tag Method
@method get
Returns the match at the given index, if one exists.
@param index -- The index of the match to get
@return RegexMatch -- The match, if one exists
]=]
function RegexCaptures.get(self: RegexCaptures, index: number): RegexMatch?
return nil :: any
end
get: (self: RegexCaptures, index: number) -> RegexMatch?,
--[=[
@within RegexCaptures
@tag Method
@method group
Returns the match for the given named match group, if one exists.
@param group -- The name of the group to get
@return RegexMatch -- The match, if one exists
]=]
function RegexCaptures.group(self: RegexCaptures, group: string): RegexMatch?
return nil :: any
end
group: (self: RegexCaptures, group: string) -> RegexMatch?,
--[=[
@within RegexCaptures
@tag Method
@method format
Formats the captures using the given format string.
@ -75,11 +89,12 @@ end
@param format -- The format string to use
@return string -- The formatted string
]=]
function RegexCaptures.format(self: RegexCaptures, format: string): string
return nil :: any
end
export type RegexCaptures = typeof(RegexCaptures)
format: (self: RegexCaptures, format: string) -> string,
},
{} :: {
__len: (self: RegexCaptures) -> number,
}
))
local Regex = {}