mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Fix Regex types (#250)
This commit is contained in:
parent
010cd36375
commit
0f4cac29aa
1 changed files with 57 additions and 42 deletions
|
@ -19,42 +19,56 @@ local RegexMatch = {
|
||||||
|
|
||||||
type RegexMatch = typeof(RegexMatch)
|
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
|
@class RegexCaptures
|
||||||
|
|
||||||
Captures from a regular expression.
|
Captures from a regular expression.
|
||||||
]=]
|
]=]
|
||||||
local RegexCaptures = {}
|
export type RegexCaptures = typeof(setmetatable(
|
||||||
|
{} :: {
|
||||||
--[=[
|
--[=[
|
||||||
@within RegexCaptures
|
@within RegexCaptures
|
||||||
@tag Method
|
@tag Method
|
||||||
|
@method get
|
||||||
|
|
||||||
Returns the match at the given index, if one exists.
|
Returns the match at the given index, if one exists.
|
||||||
|
|
||||||
@param index -- The index of the match to get
|
@param index -- The index of the match to get
|
||||||
@return RegexMatch -- The match, if one exists
|
@return RegexMatch -- The match, if one exists
|
||||||
]=]
|
]=]
|
||||||
function RegexCaptures.get(self: RegexCaptures, index: number): RegexMatch?
|
|
||||||
return nil :: any
|
get: (self: RegexCaptures, index: number) -> RegexMatch?,
|
||||||
end
|
|
||||||
|
|
||||||
--[=[
|
--[=[
|
||||||
@within RegexCaptures
|
@within RegexCaptures
|
||||||
@tag Method
|
@tag Method
|
||||||
|
@method group
|
||||||
|
|
||||||
Returns the match for the given named match group, if one exists.
|
Returns the match for the given named match group, if one exists.
|
||||||
|
|
||||||
@param group -- The name of the group to get
|
@param group -- The name of the group to get
|
||||||
@return RegexMatch -- The match, if one exists
|
@return RegexMatch -- The match, if one exists
|
||||||
]=]
|
]=]
|
||||||
function RegexCaptures.group(self: RegexCaptures, group: string): RegexMatch?
|
group: (self: RegexCaptures, group: string) -> RegexMatch?,
|
||||||
return nil :: any
|
|
||||||
end
|
|
||||||
|
|
||||||
--[=[
|
--[=[
|
||||||
@within RegexCaptures
|
@within RegexCaptures
|
||||||
@tag Method
|
@tag Method
|
||||||
|
@method format
|
||||||
|
|
||||||
Formats the captures using the given format string.
|
Formats the captures using the given format string.
|
||||||
|
|
||||||
|
@ -75,11 +89,12 @@ end
|
||||||
@param format -- The format string to use
|
@param format -- The format string to use
|
||||||
@return string -- The formatted string
|
@return string -- The formatted string
|
||||||
]=]
|
]=]
|
||||||
function RegexCaptures.format(self: RegexCaptures, format: string): string
|
format: (self: RegexCaptures, format: string) -> string,
|
||||||
return nil :: any
|
},
|
||||||
end
|
{} :: {
|
||||||
|
__len: (self: RegexCaptures) -> number,
|
||||||
export type RegexCaptures = typeof(RegexCaptures)
|
}
|
||||||
|
))
|
||||||
|
|
||||||
local Regex = {}
|
local Regex = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue