diff --git a/src/test.cpp b/src/test.cpp index 5f0aa52..846cda2 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -175,7 +175,7 @@ bool whitespace(char x) { } // 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 { Parser1(char *buf, int len, const Callbacks *callbacks, void *data) : buf(buf), len(len), callbacks(callbacks), data(data) {} @@ -416,6 +416,8 @@ private: #define MUSTTAIL #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 { Parser2(char *buf, int len, const Callbacks *callbacks, void *data) : buf(buf), len(len), callbacks(callbacks), data(data) {}