vnc: add a more descriptive error message
[qemu/kevin.git] / json-lexer.h
blob10bc0a77984df5e607b3382c9b455907fa4edbc2
1 /*
2 * JSON lexer
4 * Copyright IBM, Corp. 2009
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
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.
14 #ifndef QEMU_JSON_LEXER_H
15 #define QEMU_JSON_LEXER_H
17 #include "qstring.h"
18 #include "qlist.h"
20 typedef enum json_token_type {
21 JSON_OPERATOR = 100,
22 JSON_INTEGER,
23 JSON_FLOAT,
24 JSON_KEYWORD,
25 JSON_STRING,
26 JSON_ESCAPE,
27 JSON_SKIP,
28 JSON_ERROR,
29 } JSONTokenType;
31 typedef struct JSONLexer JSONLexer;
33 typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y);
35 struct JSONLexer
37 JSONLexerEmitter *emit;
38 int state;
39 QString *token;
40 int x, y;
43 void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func);
45 int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size);
47 int json_lexer_flush(JSONLexer *lexer);
49 void json_lexer_destroy(JSONLexer *lexer);
51 #endif