summaryrefslogtreecommitdiff
path: root/mpv/scripts/file-browser/modules/defs/parser.lua
blob: d196bf286107fd2f203f4f49c55aa2b0e3ddbdc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---@meta _

---A ParserConfig object returned by addons
---@class (partial) ParserConfig: ParserAPI
---@field priority number?
---@field api_version string    The minimum API version the string requires.
---@field version string?        The minimum API version the string requires. @deprecated.
---
---@field can_parse (async fun(self: Parser, directory: string, parse_state: ParseState): boolean)?
---@field parse (async fun(self: Parser, directory: string, parse_state: ParseState): List?, Opts?)?
---@field setup fun(self: Parser)?
---
---@field name string?
---@field keybind_name string?
---@field keybinds KeybindList?


---The parser object used by file-browser once the parsers have been loaded and initialised.
---@class Parser: ParserAPI, ParserConfig
---@field name string
---@field priority number
---@field api_version string
---@field can_parse async fun(self: Parser, directory: string, parse_state: ParseState): boolean
---@field parse async fun(self: Parser, directory: string, parse_state: ParseState): List?, Opts?


---@alias ParseStateSource 'browser'|'loadlist'|'script-message'|'addon'|string
---@alias ParseProperties table<string,any>

---The Parse State object passed to the can_parse and parse methods
---@class ParseStateFields
---@field source ParseStateSource
---@field directory string
---@field already_deferred boolean?
---@field properties ParseProperties

---@class ParseState: ParseStateFields, ParseStateAPI

---@class ParseStateTemplate
---@field source ParseStateSource?
---@field properties ParseProperties?