viml/parser/expressions: Add support for string parsing

This commit is contained in:
ZyX
2017-10-08 21:52:38 +03:00
parent c484613ce0
commit af38cea133
8 changed files with 1938 additions and 13 deletions

View File

@@ -330,9 +330,10 @@ format_luav = function(v, indent)
end
local ret = ''
if type(v) == 'string' then
ret = '\'' .. tostring(v):gsub('[\'\\]', '\\%0'):gsub('[%z\1-\31]', function(match)
return SUBTBL[match:byte()]
end) .. '\''
ret = tostring(v):gsub('[\'\\]', '\\%0'):gsub('[%z\1-\31]', function(match)
return SUBTBL[match:byte() + 1]
end)
ret = '\'' .. ret .. '\''
elseif type(v) == 'table' then
local processed_keys = {}
ret = '{' .. linesep