]>
Commit | Line | Data |
---|---|---|
5ab8558d AL |
1 | /* |
2 | * JSON lexer | |
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 | ||
14 | #ifndef QEMU_JSON_LEXER_H | |
15 | #define QEMU_JSON_LEXER_H | |
16 | ||
5ab8558d AL |
17 | |
18 | typedef enum json_token_type { | |
b8d3b1da | 19 | JSON_MIN = 100, |
c5461660 MA |
20 | JSON_LCURLY = JSON_MIN, |
21 | JSON_RCURLY, | |
22 | JSON_LSQUARE, | |
23 | JSON_RSQUARE, | |
24 | JSON_COLON, | |
25 | JSON_COMMA, | |
5ab8558d AL |
26 | JSON_INTEGER, |
27 | JSON_FLOAT, | |
28 | JSON_KEYWORD, | |
29 | JSON_STRING, | |
61030280 | 30 | JSON_INTERP, |
5ab8558d | 31 | JSON_SKIP, |
b011f619 | 32 | JSON_ERROR, |
5ab8558d AL |
33 | } JSONTokenType; |
34 | ||
037f2440 | 35 | typedef struct JSONLexer { |
5ab8558d | 36 | int state; |
d2ca7c0b | 37 | GString *token; |
5ab8558d | 38 | int x, y; |
037f2440 | 39 | } JSONLexer; |
5ab8558d | 40 | |
037f2440 | 41 | void json_lexer_init(JSONLexer *lexer); |
5ab8558d | 42 | |
7c1e1d54 | 43 | void json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); |
5ab8558d | 44 | |
7c1e1d54 | 45 | void json_lexer_flush(JSONLexer *lexer); |
5ab8558d AL |
46 | |
47 | void json_lexer_destroy(JSONLexer *lexer); | |
48 | ||
49 | #endif |