Add regex.find_offsets, regex.find, improve regex.match (#1232)

`regex.match` now behaves like `string.match`.
This required changes in the `tokenizer` and in the `detectindent` 
plugin.
This commit is contained in:
Guldoman
2022-12-11 22:25:42 -04:00
committed by GitHub
parent e13f265fac
commit 9d48441685
4 changed files with 88 additions and 28 deletions
+3 -3
View File
@@ -41,8 +41,8 @@ regex.NOTEMPTY_ATSTART = 0x00000008
---@param pattern string
---@param options? regex.modifiers A string of one or more pattern modifiers.
---
---@return regex|string regex Ready to use regular expression object or error
---message if compiling the pattern failed.
---@return regex|nil regex Ready to use regular expression object or nil on error.
---@return string? error The error message if compiling the pattern failed.
function regex.compile(pattern, options) end
---
@@ -53,7 +53,7 @@ function regex.compile(pattern, options) end
---@param options? integer A bit field of matching options, eg:
---regex.NOTBOL | regex.NOTEMPTY
---
---@return table<integer, integer> list List of offsets where a match was found.
---@return integer ... list List of offsets where a match was found.
function regex:cmatch(subject, offset, options) end