]>
Commit | Line | Data |
---|---|---|
5ab8558d | 1 | /* |
86cdf9ec | 2 | * JSON Parser |
5ab8558d AL |
3 | * |
4 | * Copyright IBM, Corp. 2009 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <aliguori@us.ibm.com> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. | |
10 | * See the COPYING.LIB file in the top-level directory. | |
11 | * | |
12 | */ | |
13 | ||
86cdf9ec MA |
14 | #ifndef JSON_PARSER_INT_H |
15 | #define JSON_PARSER_INT_H | |
16 | ||
17 | #include "qapi/qmp/json-parser.h" | |
5ab8558d | 18 | |
5ab8558d AL |
19 | |
20 | typedef enum json_token_type { | |
b8d3b1da | 21 | JSON_MIN = 100, |
c5461660 MA |
22 | JSON_LCURLY = JSON_MIN, |
23 | JSON_RCURLY, | |
24 | JSON_LSQUARE, | |
25 | JSON_RSQUARE, | |
26 | JSON_COLON, | |
27 | JSON_COMMA, | |
5ab8558d AL |
28 | JSON_INTEGER, |
29 | JSON_FLOAT, | |
30 | JSON_KEYWORD, | |
31 | JSON_STRING, | |
61030280 | 32 | JSON_INTERP, |
5ab8558d | 33 | JSON_SKIP, |
b011f619 | 34 | JSON_ERROR, |
f9277915 | 35 | JSON_END_OF_INPUT, |
c0ee3afa | 36 | JSON_MAX = JSON_END_OF_INPUT |
5ab8558d AL |
37 | } JSONTokenType; |
38 | ||
86cdf9ec | 39 | typedef struct JSONToken JSONToken; |
5ab8558d | 40 | |
86cdf9ec | 41 | /* json-lexer.c */ |
2cbd15aa | 42 | void json_lexer_init(JSONLexer *lexer, bool enable_interpolation); |
7c1e1d54 | 43 | void json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); |
7c1e1d54 | 44 | void json_lexer_flush(JSONLexer *lexer); |
5ab8558d AL |
45 | void json_lexer_destroy(JSONLexer *lexer); |
46 | ||
86cdf9ec MA |
47 | /* json-streamer.c */ |
48 | void json_message_process_token(JSONLexer *lexer, GString *input, | |
49 | JSONTokenType type, int x, int y); | |
50 | ||
51 | /* json-parser.c */ | |
52 | JSONToken *json_token(JSONTokenType type, int x, int y, GString *tokstr); | |
53 | QObject *json_parser_parse(GQueue *tokens, va_list *ap, Error **errp); | |
54 | ||
5ab8558d | 55 | #endif |