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