-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathJSON_checker.h
39 lines (29 loc) · 914 Bytes
/
JSON_checker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* JSON_checker.h */
/* 2016-11-11 */
/*
The JSON_checker_struct is used to hold the state of the JSON_checker
so that the code can be reentrant.
*/
typedef struct JSON_checker_struct {
int valid;
int state;
int depth;
int top;
int* stack;
} * JSON_checker;
extern JSON_checker new_JSON_checker(int depth);
/*
Make a new JSON_checker. You indicate the maximum depth that is allowed.
It will return an object that you will pass to the other functions.
They will destroy the object for you.
*/
extern int JSON_checker_char(JSON_checker jc, int next_char);
/*
You should call JSON_checker_char for each character of the JSON text.
It will return false if the text is not right.
*/
extern int JSON_checker_done(JSON_checker jc);
/*
When there are no more JSON text characters, call JSON_checker_done.
It will return false if the text was not right.
*/