xref: /Universal-ctags/main/lregex.h (revision bde49ae4a5d4d5fc93d1ff26960b5c52fa1d6ad4)
1 /*
2 *   Copyright (c) 2000-2003, Darren Hiebert
3 *   Copyright (c) 2017, Red Hat, Inc.
4 *   Copyright (c) 2017, Masatake YAMATO
5 *
6 *   This source code is released for free distribution under the terms of the
7 *   GNU General Public License version 2 or (at your option) any later version.
8 *
9 *   This module contains functions for applying regular expression matching.
10 *
11 *   The code for utilizing the Gnu regex package with regards to processing the
12 *   regex option and checking for regex matches was adapted from routines in
13 *   Gnu etags.
14 */
15 
16 #ifndef CTAGS_MAIN_LREGEX_H
17 #define CTAGS_MAIN_LREGEX_H
18 
19 /*
20 *   INCLUDE FILES
21 */
22 #include "general.h"
23 
24 /*
25 *   DATA DECLARATIONS
26 */
27 typedef struct sTagRegexTable {
28 	const char *const regex;
29 	const char* const name;
30 	const char* const kinds;
31 	const char *const flags;
32 	bool    *disabled;
33 	bool  mline;
34 } tagRegexTable;
35 
36 typedef struct {
37 	size_t start;   /* character index in line where match starts */
38 	size_t length;  /* length of match */
39 } regexMatch;
40 
41 /* Return value is referred when {exclusive} is also specified.
42    The input line is consumed when "{exclusive}" is specified and
43    the value returned from the callback function is true. */
44 typedef bool (*regexCallback) (const char *line, const regexMatch *matches, unsigned int count,
45 			       void *userData);
46 
47 #endif	/* CTAGS_MAIN_LREGEX_H */
48