Method: OkJson#pairparse

Defined in:
lib/okjson.rb

#pairparse(ts) ⇒ Object

Parses a “member” in the sense of RFC 4627. Returns the parsed values and any trailing tokens.



121
122
123
124
125
126
127
128
129
# File 'lib/okjson.rb', line 121

def pairparse(ts)
  (typ, _, k), ts = ts[0], ts[1..-1]
  if typ != :str
    raise Error, "unexpected #{k.inspect}"
  end
  ts = eat(':', ts)
  v, ts = valparse(ts)
  [k, v, ts]
end