cb32be70373e599a3cc4c02765186f065d9a06c3
[vuplus_bitbake] / lib / bb / parse / parse_c / lexer.h
1 /*
2 Copyright (C) 2005 Holger Hans Peter Freyther
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20 THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 */
23
24 #ifndef LEXER_H
25 #define LEXER_H
26
27 #include "Python.h"
28
29 extern "C" {
30
31 struct lex_t {
32     void* parser;
33     void* scanner;
34     FILE* file;
35     char *name;
36     PyObject *data;
37     int config;
38
39     void* (*parse)(void*, int, token_t, lex_t*);
40
41     void accept(int token, const char* sz = NULL);
42     void input(char *buf, int *result, int max_size);
43     int  line()const;
44 };
45
46 }
47
48 #endif