~200LoC. It has one function:
char *data = ... see c.txt ...;
struct Parse p;
json_get(&p, data, "['amendments'][10]");
The output of the JS-like 'intent' will be stored in p.str
with length p.str_len
. This will just point to an offset in the buffer you gave the parser.
Optionally, you can call char *json_fixup_string(struct Parse *p)
to get a formatted output.
Advantages:
- Very fast lexer & recursive descent parser
- Simple API
- No memory allocation required
- Correct (?) It parsed the entire bible.
Disadvantages:
- May not throw error on invalid syntax / invalid accesses
- Not written with memory safety in mind
- Doesn't parse into a tree for reformatting back to text