neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

pi_msgpack.txt (5698B)


      1 *pi_msgpack.txt*   msgpack utilities
      2 
      3 Author:  Nikolay Pavlov <kp-pav@yandex.ru>
      4 Copyright: (c) 2015 by Nikolay Pavlov
      5 
      6 The Apache license applies to the files in this package, including
      7 runtime/autoload/msgpack.vim, runtime/doc/pi_msgpack.txt and
      8 test/functional/plugin/msgpack_spec.lua.  Like anything else that's free,
      9 msgpack.vim and its associated files are provided as is and comes with no
     10 warranty of any kind, either expressed or implied.  No guarantees of
     11 merchantability.  No guarantees of suitability for any purpose.  By using this
     12 plugin, you agree that in no event will the copyright holder be liable for any
     13 damages resulting from the use of this software. Use at your own risk!
     14 
     15                                       Type |gO| to see the table of contents.
     16 
     17 ==============================================================================
     18 Msgpack.vim introduction			*msgpack.vim-intro*
     19 
     20 This plugin contains utility functions to be used in conjunction with
     21 |msgpackdump()| and |msgpackparse()| functions.
     22 
     23 ==============================================================================
     24 Msgpack.vim manual				*msgpack.vim-manual*
     25 
     26 FUNCTION ARGUMENTS				*msgpack.vim-arguments*
     27 
     28 Disambiguation of arguments described below.  Note: if e.g. function is listed
     29 as accepting |{msgpack-integer}| (or anything else) it means that function
     30 does not check whether argument matches its description.
     31 
     32 *{msgpack-value}*	Either |msgpack-special-dict| or a regular value, but
     33 		not function reference.
     34 *{msgpack-integer}*	Any value for which |msgpack#type()| will return
     35 		"integer".
     36 *{msgpack-special-int}*	|msgpack-special-dict| representing integer.
     37 
     38 msgpack#is_int({msgpack-value})				*msgpack#is_int()*
     39 Returns 1 if given {msgpack-value} is integer value, 0 otherwise.
     40 
     41 msgpack#is_uint({msgpack-value})			*msgpack#is_uint()*
     42 Returns 1 if given {msgpack-value} is integer value greater or equal
     43 to zero, 0 otherwise.
     44 
     45 						*msgpack#strftime*
     46 msgpack#strftime({format}, {msgpack-integer})		*msgpack#strftime()*
     47 Same as |strftime()|, but second argument may be
     48 |msgpack-special-dict|.  Requires |Python| to really work with
     49 |msgpack-special-dict|s.
     50 
     51 						*msgpack#strptime*
     52 msgpack#strptime({format}, {time})			*msgpack#strptime()*
     53 Reverse of |msgpack#strftime()|: for any time and format
     54 |msgpack#equal|( |msgpack#strptime|(format, |msgpack#strftime|(format,
     55 time)), time) be true.  Requires ||Python|, without it only supports
     56 non-|msgpack-special-dict| nonnegative times and format equal to
     57 `%Y-%m-%dT%H:%M:%S`.
     58 
     59 msgpack#int_dict_to_str({msgpack-special-int})	*msgpack#int_dict_to_str()*
     60 Function which converts |msgpack-special-dict| integer value to
     61 a hexadecimal value like 0x1234567890ABCDEF (always returns exactly 16
     62 hexadecimal digits).
     63 
     64 msgpack#special_type({msgpack-value})		*msgpack#special_type()*
     65 Returns zero if {msgpack-value} is not |msgpack-special-dict|.  If it
     66 is it returns name of the key in |v:msgpack_types| which represents
     67 {msgpack-value} type.
     68 
     69 msgpack#type({msgpack-value})				*msgpack#type()*
     70 Returns name of the key in |v:msgpack_types| that represents
     71 {msgpack-value} type.  Never returns zero: this function returns
     72 msgpack type which will be dumped by |msgpackdump()| should it receive
     73 a list with single {msgpack-value} as input.
     74 
     75 msgpack#deepcopy({msgpack-value})			*msgpack#deepcopy()*
     76 Like |deepcopy()|, but works correctly with |msgpack-special-dict|
     77 values.  Plain |deepcopy()| will destroy all types in
     78 |msgpack-special-dict| values because it will copy _TYPE key values,
     79 while they should be preserved.
     80 
     81 msgpack#string({msgpack-value})				*msgpack#string()*
     82 Like |string()|, but saves information about msgpack types.  Values
     83 dumped by msgpack#string may be read back by |msgpack#eval()|.
     84 Returns is the following:
     85 
     86 - Dictionaries are dumped as "{key1: value1, key2: value2}". Note:
     87   msgpack allows any values in keys, so with some
     88   |msgpack-special-dict| values |msgpack#string()| may produce even
     89   "{{1: 2}: 3, [4]: 5}".
     90 - Lists are dumped as "[value1, value2]".
     91 - Strings are dumped as
     92   1. `"abc"`: binary string.
     93   2. `="abc"`: string.
     94   3. `+(10)"ext"`: extension strings (10 may be replaced with any
     95      8-bit signed integer).
     96   Inside strings the following escape sequences may be present: "\0"
     97   (represents NUL byte), "\n" (represents line feed) and "\""
     98   (represents double quote).
     99 - Floating-point and integer values are dumped using |string()| or
    100   |msgpack#int_dict_to_str()|.
    101 - Booleans are dumped as "TRUE" or "FALSE".
    102 - Nil values are dumped as "NIL".
    103 
    104 msgpack#eval({string}, {dict})				*msgpack#eval()*
    105 Transforms string created by |msgpack#string()| into a value suitable
    106 for |msgpackdump()|.  Second argument allows adding special values
    107 that start with head characters (|/\h|) and contain only word
    108 characters (|/\w|).  Built-in special values are "TRUE", "FALSE",
    109 "NIL", "nan" and "inf" and they cannot be overridden.  Map values are
    110 always evaluated to |msgpack-special-dict| values, as well as
    111 hexadecimal digits.  When evaluating maps order of keys is preserved.
    112 
    113 Note that in addition to regular integer representations that may be
    114 obtained using |msgpack#string()| msgpack#eval() also supports C-style
    115 “character” integer constants like `'/'` (equivalent to
    116 `char2nr('/')`: `47`). This also allows `'\0'` (number is decimal).
    117 
    118 						*msgpack#equal*
    119 msgpack#equal({msgpack-value}, {msgpack-value})		*msgpack#equal()*
    120 Returns 1 if given values are equal, 0 otherwise.  When comparing
    121 msgpack map values order of keys is ignored.  Comparing
    122 |msgpack-special-dict| with equivalent non-special-dict value
    123 evaluates to 1.
    124 
    125 vim:tw=78:ts=8:ft=help:fdm=marker