33 lines
719 B
C
33 lines
719 B
C
|
// This file is part of noxos and licensed under the MIT open source license
|
||
|
|
||
|
#ifndef NOXOS_JSON_H
|
||
|
#define NOXOS_JSON_H
|
||
|
|
||
|
#include <utils/string.h>
|
||
|
#include <utils/stdtypes.h>
|
||
|
|
||
|
typedef enum {
|
||
|
JSON_TOKEN_NUMERIC,
|
||
|
JSON_TOKEN_TEXT,
|
||
|
JSON_TOKEN_STRING,
|
||
|
JSON_TOKEN_SPECIAL
|
||
|
} json_token_type_E;
|
||
|
|
||
|
typedef struct {
|
||
|
json_token_type_E type;
|
||
|
uint64_t value;
|
||
|
string_t string;
|
||
|
} json_token_T;
|
||
|
|
||
|
typedef struct {
|
||
|
json_token_T* tokens;
|
||
|
uint64_t num_tokens;
|
||
|
void* string_buffer;
|
||
|
} json_T;
|
||
|
|
||
|
json_T* json_from_string(string_t str);
|
||
|
void json_destruct (json_T* json);
|
||
|
void json_tokenize (json_T* json, string_t str);
|
||
|
|
||
|
#endif //NOXOS_JSON_H
|