2020-05-07 09:27:37 +00:00
|
|
|
local common = require "core.common"
|
2019-12-28 11:16:32 +00:00
|
|
|
|
2020-05-07 09:27:37 +00:00
|
|
|
local syntax = {}
|
2019-12-28 11:16:32 +00:00
|
|
|
syntax.items = {}
|
|
|
|
|
|
|
|
local plain_text_syntax = { patterns = {}, symbols = {} }
|
|
|
|
|
|
|
|
|
|
|
|
function syntax.add(t)
|
|
|
|
table.insert(syntax.items, t)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function syntax.get(filename)
|
|
|
|
for i = #syntax.items, 1, -1 do
|
|
|
|
local t = syntax.items[i]
|
2020-05-07 13:18:46 +00:00
|
|
|
if common.match_pattern(filename, t.files) then
|
2019-12-28 11:16:32 +00:00
|
|
|
return t
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return plain_text_syntax
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return syntax
|