vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 934169cea840e49555050f1198bd6ebfde294570
parent 9ee3db4575b6eaa561a00615e1ce6a444dc609d5
Author: Georgi Kirilov <in.the@repo>
Date: Sun, 27 Jan 2019 18:07:14 +0200
lexers: fix incorrect (and *very* slow) YAML lexer token
TODO: keys should only be highlighted in {} mappings.
Diffstat:
| M | lua/lexers/yaml.lua | | | 7 | +------ |
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git 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)