kmx.io/kv/README.md

Download

kv 1.0

Synopsis

kv-1.0.jpg

Specification

     KV : SP* K SP* ':' SP* V SP*

     M1 : KV (',' KV)* ','? SP*

     M2 : SP* '{' M1 '}' SP*

     M3 : SP*

      M : M2 | M1 | M3

K1 = V1 : [^<{}:,"\s][^{}:,"\s]*

K2 = V2 : '"' ([^"] | Q)+ '"'

      Q : '\"' | '\\' | '\n' | '\r' | '\t' | '\v'

K3 = V3 : '"""\n' .*? '\n"""'

K4 = V4 : '<<' D \s .*? D

     V5 : M2

      K : K1 | K2 | K3 | K4
      
      V : V1 | V2 | V3 | V4 | V5

Parser

The parser will emit events for KV.

Command line interface

Usage:
  kv INPUT <<EOF
A
B B1
C C1 C2
EOF

Will output concatenated values of INPUT for keys A, B.B1 and C.C1.C2.

  kv -quote < INPUT

Will quote INPUT according to (K1 | K2 | K3 | K4) whichever is best.

Reference implementation

The reference implementation of kv is implemented in ANSI C.

Other implementations

TODO


Source

Download