robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
65b40e69ac
master
1--- @meta 2-- This file is NOT generated, edit it directly. 3error ( 'Cannot require a meta file' ) 4 5-- Documentations and Lua types for vim.re (vendored re.lua, lpeg-1.1.0) 6-- https://www.inf.puc-rio.br/~roberto/lpeg/re.html 7-- 8-- Copyright © 2007-2023 Lua.org, PUC-Rio. 9-- See 'lpeg.html' for license 10 11--- @brief 12--- The `vim.re` module provides a conventional regex-like syntax for pattern usage within LPeg 13--- |vim.lpeg|. (Unrelated to |vim.regex| which provides Vim |regexp| from Lua.) 14--- 15--- See https://www.inf.puc-rio.br/~roberto/lpeg/re.html for the original documentation including 16--- regex syntax and examples. 17 18--- Compiles the given {string} and returns an equivalent LPeg pattern. The given string may define 19--- either an expression or a grammar. The optional {defs} table provides extra Lua values to be used 20--- by the pattern. 21--- @param string string 22--- @param defs? table 23--- @return vim.lpeg.Pattern 24function vim . re . compile ( string , defs ) end 25 26--- Searches the given {pattern} in the given {subject}. If it finds a match, returns the index 27--- where this occurrence starts and the index where it ends. Otherwise, returns nil. 28--- 29--- An optional numeric argument {init} makes the search starts at that position in the subject 30--- string. As usual in Lua libraries, a negative value counts from the end. 31--- @param subject string 32--- @param pattern vim.lpeg.Pattern|string 33--- @param init? integer 34--- @return integer|nil : the index where the occurrence starts, nil if no match 35--- @return integer|nil : the index where the occurrence ends, nil if no match 36function vim . re . find ( subject , pattern , init ) end 37 38--- Does a global substitution, replacing all occurrences of {pattern} in the given {subject} by 39--- {replacement}. 40--- @param subject string 41--- @param pattern vim.lpeg.Pattern|string 42--- @param replacement string 43--- @return string 44function vim . re . gsub ( subject , pattern , replacement ) end 45 46--- Matches the given {pattern} against the given {subject}, returning all captures. 47--- @param subject string 48--- @param pattern vim.lpeg.Pattern|string 49--- @param init? integer 50--- @return integer|vim.lpeg.Capture|nil 51--- @see vim.lpeg.match() 52function vim . re . match ( subject , pattern , init ) end 53 54--- Updates the pre-defined character classes to the current locale. 55function vim . re . updatelocale () end