aboutsummaryrefslogtreecommitdiff
path: root/lua/colorizer/matcher.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/colorizer/matcher.lua')
-rw-r--r--lua/colorizer/matcher.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lua/colorizer/matcher.lua b/lua/colorizer/matcher.lua
index dba67c0..d55a673 100644
--- a/lua/colorizer/matcher.lua
+++ b/lua/colorizer/matcher.lua
@@ -17,7 +17,7 @@ local parser = {
["_rgb"] = color.rgb_function_parser,
["_rgba"] = color.rgba_function_parser,
["_hsl"] = color.hsl_function_parser,
- ["_hsla"] = color.hsla_function_parser,
+ ["_hsla"] = color.hsl_function_parser,
}
local matcher = {}
@@ -49,7 +49,7 @@ function matcher.compile(matchers, matchers_trie)
if prefix then
local fn = "_" .. prefix
if parser[fn] then
- return parser[fn](line, i, matchers[fn])
+ return parser[fn](line, i, matchers[prefix])
end
end
@@ -145,6 +145,10 @@ function matcher.make(options)
table.insert(matchers_prefix, "hsl")
end
+ for _, value in ipairs(matchers_prefix) do
+ matchers[value] = { prefix = value }
+ end
+
loop_parse_fn = matcher.compile(matchers, matchers_prefix)
MATCHER_CACHE[matcher_key] = loop_parse_fn