diff options
author | Justin Bedo <cu@cua0.org> | 2012-06-12 12:08:35 +0200 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2012-06-12 12:08:35 +0200 |
commit | 06a376f7f913bd57a1256898a04882818deaefa4 (patch) | |
tree | 33423384477ee90ccf022f29f4685bccc2a3874e /json.h |
Initial implementation
Diffstat (limited to 'json.h')
-rw-r--r-- | json.h | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,38 @@ +#pragma src "/usr/doc/src/json" +#pragma lib "json.a" + +enum{ + JStksz= 32, +}; + +typedef enum{ + JBool, + JNum, + JNil, + JObj, + JArr, + JStr, +} Jtype; + +typedef struct{ + Jtype type; + char *start; + char *end; + uint nsub; +} Jtok; + +typedef struct{ + uint ntok, mtok; + Jtok *tokens; + uint stktop; + uint tokstk[JStksz]; +} Jparser; + +void Jinit(Jparser *); +void Jterm(Jparser *); + +int Jtokenise(Jparser *, char *); +char *Jtokstr(Jtok *); + +int Jfind(Jparser *, uint, char *); +uint Jnext(Jparser *, uint); |