Update parser descriptions

This commit is contained in:
2025-05-13 14:00:20 -04:00
parent d0447e64b2
commit a04a558276

View File

@@ -175,7 +175,7 @@ bool whitespace(char x) {
} }
// Straightforward recursive descent that doesn't handle string escaping and // Straightforward recursive descent that doesn't handle string escaping and
// treats numbers as [0-9]+ // treats numbers as [0-9.]+. May stack overflow on deeply nested json documents
struct Parser1 { struct Parser1 {
Parser1(char *buf, int len, const Callbacks *callbacks, void *data) Parser1(char *buf, int len, const Callbacks *callbacks, void *data)
: buf(buf), len(len), callbacks(callbacks), data(data) {} : buf(buf), len(len), callbacks(callbacks), data(data) {}
@@ -416,6 +416,8 @@ private:
#define MUSTTAIL #define MUSTTAIL
#endif #endif
// Table-based ll(1) parser that doesn't handle escaping and treats numbers as
// [0-9.]+. Could be adapted to have a streaming interface. Uses O(1) memory.
struct Parser2 { struct Parser2 {
Parser2(char *buf, int len, const Callbacks *callbacks, void *data) Parser2(char *buf, int len, const Callbacks *callbacks, void *data)
: buf(buf), len(len), callbacks(callbacks), data(data) {} : buf(buf), len(len), callbacks(callbacks), data(data) {}