1 /*
2  * Copyright (c) 2009, 2010
3  *	Tama Communications Corporation
4  *
5  * This file is part of GNU GLOBAL.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _PARSER_H_
22 #define _PARSER_H_
23 
24 /*
25  * Built-in parser base on gctags
26  */
27 
28 void parser_init(const char *, const char *);
29 void parser_exit(void);
30 
31 /* tag type */
32 			/** definition */
33 #define PARSER_DEF		1
34 			/** reference or other symbol */
35 #define PARSER_REF_SYM		2
36 
37 /* flags */
38 			/** debug mode */
39 #define PARSER_DEBUG		1
40 			/** verbose mode */
41 #define PARSER_VERBOSE		2
42 			/** print warning message */
43 #define PARSER_WARNING		4
44 			/** force level 1 block end */
45 #define PARSER_END_BLOCK	8
46 			/** force level 1 block start */
47 #define PARSER_BEGIN_BLOCK	16
48 			/** gtags --explain */
49 #define PARSER_EXPLAIN		32
50 
51 typedef void (*PARSER_CALLBACK)(int, const char *, int, const char *, const char *, void *);
52 
53 struct parser_param {
54 	int size;		/**< size of this structure */
55 	int flags;
56 	const char *file;
57 	PARSER_CALLBACK put;
58 	void *arg;
59 	int (*isnotfunction)(const char *);
60 	const char *langmap;
61 	char *(*getconf)(const char *);
62 	void (*die)(const char *, ...);
63 	void (*warning)(const char *, ...);
64 	void (*message)(const char *, ...);
65 };
66 
67 typedef void (*PARSER)(const struct parser_param *);
68 void parse_file(const char *, int, PARSER_CALLBACK, void *);
69 const struct lang_entry *get_parser(const char *);
70 void execute_parser(const struct lang_entry *, const char *, int, PARSER_CALLBACK, void *);
71 const char *get_explain(const char *, const struct lang_entry *);
72 
73 #endif
74