Skip to content

Commit 4a99889

Browse files
committed
add annotations for resty.core.regex
1 parent 45373e5 commit 4a99889

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed
Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,55 @@
11
---@meta
2-
local resty_core_regex={}
3-
function resty_core_regex.collect_captures(compiled, rc, subj, flags, res) end
4-
function resty_core_regex.set_buf_grow_ratio(ratio) end
5-
function resty_core_regex.re_sub_compile(regex, opts, replace, fun) end
6-
function resty_core_regex.is_regex_cache_empty() end
7-
function resty_core_regex.check_buf_size(buf, buf_size, pos, len, new_len, must_alloc) end
8-
function resty_core_regex.re_match_compile(regex, opts) end
9-
function resty_core_regex.destroy_compiled_regex(compiled) end
10-
resty_core_regex.version = require("resty.core.base").version
11-
return resty_core_regex
2+
3+
---@class resty.core.regex
4+
---@field no_pcre boolean
5+
local regex = {}
6+
7+
---@param ratio integer
8+
function regex.set_buf_grow_ratio(ratio) end
9+
10+
---@return boolean is_empty
11+
function regex.is_regex_cache_empty() end
12+
13+
---@class resty.core.regex.compiled : ffi.cdata*
14+
---@field captures ffi.cdata*
15+
---@field ncaptures integer
16+
---@field name_count integer
17+
---@field name_table ffi.cdata*
18+
---@field name_entry_size integer
19+
20+
---@param compiled resty.core.regex.compiled
21+
---@param flags integer
22+
---@param res ngx.re.captures
23+
function regex.collect_captures(compiled, flags, res) end
24+
25+
---@param compiled resty.core.regex.compiled
26+
function regex.destroy_compiled_regex(compiled) end
27+
28+
---@param re string
29+
---@param opts ngx.re.options
30+
---@return resty.core.regex.compiled? compiled
31+
---@return boolean|string compile_once_or_error
32+
---@return integer? flags
33+
function regex.re_match_compile(re, opts) end
34+
35+
---@param buf ffi.cdata*
36+
---@param buf_size integer
37+
---@param pos integer
38+
---@param len integer
39+
---@param new_len integer
40+
---@param must_alloc boolean
41+
---@return ffi.cdata* buf
42+
---@return integer buf_size
43+
---@return integer new_len
44+
function regex.check_buf_size(buf, buf_size, pos, len, new_len, must_alloc) end
45+
46+
---@param re string
47+
---@param opts ngx.re.options
48+
---@param replace? string
49+
---@param func? fun(match:string):string
50+
---@return resty.core.regex.compiled? compiled
51+
---@return boolean|string compile_once_or_error
52+
---@return integer? flags
53+
function regex.re_sub_compile(re, opts, replace, func) end
54+
55+
return regex

0 commit comments

Comments
 (0)