mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
plugin/msgpack: Support character constants like '\0'
This commit is contained in:
parent
a934144e04
commit
d82f5d1ba2
@ -665,11 +665,15 @@ function msgpack#eval(s, special_objs) abort
|
||||
call add(expr, ']}')
|
||||
let s = s[1:]
|
||||
elseif s[0] is# ''''
|
||||
let char = matchstr(s, '\m\C^''\zs.\ze''')
|
||||
let char = matchstr(s, '\v\C^\''\zs%(\\\d+|.)\ze\''')
|
||||
if empty(char)
|
||||
throw 'char-invalid:Invalid integer character literal format: ' . s
|
||||
endif
|
||||
call add(expr, char2nr(char))
|
||||
if char[0] is# '\'
|
||||
call add(expr, +char[1:])
|
||||
else
|
||||
call add(expr, char2nr(char))
|
||||
endif
|
||||
let s = s[len(char) + 2:]
|
||||
else
|
||||
throw 'unknown:Invalid non-space character: ' . s
|
||||
|
@ -652,6 +652,8 @@ describe('In autoload/msgpack.vim', function()
|
||||
|
||||
eval_eq('integer', ('a'):byte(), '\'a\'')
|
||||
eval_eq('integer', 0xAB, '\'«\'')
|
||||
eval_eq('integer', 0, '\'\\0\'')
|
||||
eval_eq('integer', 10246567, '\'\\10246567\'')
|
||||
end)
|
||||
|
||||
it('correctly loads constants', function()
|
||||
|
Loading…
Reference in New Issue
Block a user