aboutsummaryrefslogtreecommitdiff
path: root/lua/lexers/yaml.lua
diff options
context:
space:
mode:
authorGeorgi Kirilov <in.the@repo>2019-01-27 18:07:14 +0200
committerMarc André Tanner <mat@brain-dump.org>2020-01-27 07:25:25 +0100
commit79859b57fc3556c2ed74950a5a5668c64face4e3 (patch)
tree2be4b51cc4fe02080f036ab90b37f718267ac848 /lua/lexers/yaml.lua
parent3a1023ee5022071b46f659a82290bb0b3da42137 (diff)
downloadvis-79859b57fc3556c2ed74950a5a5668c64face4e3.tar.gz
vis-79859b57fc3556c2ed74950a5a5668c64face4e3.tar.xz
lexers: fix incorrect (and *very* slow) YAML lexer token
TODO: keys should only be highlighted in {} mappings.
Diffstat (limited to 'lua/lexers/yaml.lua')
-rw-r--r--lua/lexers/yaml.lua7
1 files changed, 1 insertions, 6 deletions
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)