std_json icon indicating copy to clipboard operation
std_json copied to clipboard

template arguments, converters, flexibly lexing, and lazy parsing

Open cdunn2001 opened this issue 8 years ago • 0 comments

In my opinion, there should be several pieces:

  1. Json lexer (gason is excellent for this.)
    • One advantage is that the lexer could handle arbitrarily long ints and floats. The parser would later flag an error when data do not fit the datatypes. (Technically, very few Json parsers satisfy the JSON standard, which does not limit numerics.)
    • Also, lazy parsing becomes possible, which in some scenarios leads to much quicker sparse access than with most Json parsers available today.
    • It is also possible to stream the lexer to the parser.
  2. Json parser, templated on <Int, Float, String> and maybe also list and dict types.
    • If list/dict are also template arguments, then STL allocators are automatically included.
  3. An API for providing converters between array-of-char and those template-arg types

Several lexers, specializations, and converters could be provided. There could be obvious defaults, so convenience should not be the issue.

(For the record, I maintain JsonCpp, which is not even close to what I would want in standard C++.)

cdunn2001 avatar Jul 16 '17 21:07 cdunn2001