From 79859b57fc3556c2ed74950a5a5668c64face4e3 Mon Sep 17 00:00:00 2001 From: Georgi Kirilov Date: Sun, 27 Jan 2019 18:07:14 +0200 Subject: lexers: fix incorrect (and *very* slow) YAML lexer token TODO: keys should only be highlighted in {} mappings. --- lua/lexers/yaml.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lua/lexers/yaml.lua') diff --git a/lua/lexers/yaml.lua b/lua/lexers/yaml.lua index 4ec85ea..7b22451 100644 --- a/lua/lexers/yaml.lua +++ b/lua/lexers/yaml.lua @@ -60,12 +60,7 @@ local word = (l.alpha + '-' * -l.space) * (l.alnum + '-')^0 -- Keys and literals. local colon = S(' \t')^0 * ':' * (l.space + -1) -local key = token(l.KEYWORD, - #word * (l.nonnewline - colon)^1 * #colon * - P(function(input, index) - local line = input:sub(1, index - 1):match('[^\r\n]+$') - return not line:find('[%w-]+:') and index - end)) +local key = token(l.KEYWORD, (l.alnum + '_' + '-')^1 * #(':' * l.space)) local value = #word * (l.nonnewline - l.space^0 * S(',]}'))^1 local block = S('|>') * S('+-')^-1 * (l.newline + -1) * function(input, index) local rest = input:sub(index) -- cgit v1.2.3