1 |
/* Definitions for data structures and routines for the regular |
/* Definitions for data structures and routines for the regular |
2 |
expression library, version 0.12. |
expression library, version 0.12. |
3 |
|
|
4 |
Copyright (C) 1985, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. |
Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 |
5 |
|
Free Software Foundation, Inc. |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or modify |
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 |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2 of the License, or |
10 |
any later version. |
(at your option) any later version. |
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
18 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
19 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
20 |
|
02110-1301 USA |
21 |
|
*/ |
22 |
|
|
23 |
#ifndef __REGEXP_LIBRARY_H__ |
#ifndef __REGEXP_LIBRARY_H__ |
24 |
#define __REGEXP_LIBRARY_H__ |
#define __REGEXP_LIBRARY_H__ |
45 |
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1) |
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1) |
46 |
|
|
47 |
/* If this bit is not set, then + and ? are operators, and \+ and \? are |
/* If this bit is not set, then + and ? are operators, and \+ and \? are |
48 |
literals. |
literals. |
49 |
If set, then \+ and \? are operators and + and ? are literals. */ |
If set, then \+ and \? are operators and + and ? are literals. */ |
50 |
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) |
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) |
51 |
|
|
61 |
^ is an anchor if it is at the beginning of a regular |
^ is an anchor if it is at the beginning of a regular |
62 |
expression or after an open-group or an alternation operator; |
expression or after an open-group or an alternation operator; |
63 |
$ is an anchor if it is at the end of a regular expression, or |
$ is an anchor if it is at the end of a regular expression, or |
64 |
before a close-group or an alternation operator. |
before a close-group or an alternation operator. |
65 |
|
|
66 |
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because |
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because |
67 |
POSIX draft 11.2 says that * etc. in leading positions is undefined. |
POSIX draft 11.2 says that * etc. in leading positions is undefined. |
72 |
/* If this bit is set, then special characters are always special |
/* If this bit is set, then special characters are always special |
73 |
regardless of where they are in the pattern. |
regardless of where they are in the pattern. |
74 |
If this bit is not set, then special characters are special only in |
If this bit is not set, then special characters are special only in |
75 |
some contexts; otherwise they are ordinary. Specifically, |
some contexts; otherwise they are ordinary. Specifically, |
76 |
* + ? and intervals are only special when not after the beginning, |
* + ? and intervals are only special when not after the beginning, |
77 |
open-group, or alternation operator. */ |
open-group, or alternation operator. */ |
78 |
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) |
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) |
94 |
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) |
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) |
95 |
|
|
96 |
/* If this bit is set, either \{...\} or {...} defines an |
/* If this bit is set, either \{...\} or {...} defines an |
97 |
interval, depending on RE_NO_BK_BRACES. |
interval, depending on RE_NO_BK_BRACES. |
98 |
If not set, \{, \}, {, and } are literals. */ |
If not set, \{, \}, {, and } are literals. */ |
99 |
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) |
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) |
100 |
|
|
119 |
If not set, then \<digit> is a back-reference. */ |
If not set, then \<digit> is a back-reference. */ |
120 |
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) |
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) |
121 |
|
|
122 |
/* If this bit is set, then | is an alternation operator, and \| is literal. |
/* If this bit is set, then | is an alternation operator, and \| is literal. |
123 |
If not set, then \| is an alternation operator, and | is literal. */ |
If not set, then \| is an alternation operator, and | is literal. */ |
124 |
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) |
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) |
125 |
|
|
141 |
|
|
142 |
/* Define combinations of the above bits for the standard possibilities. |
/* Define combinations of the above bits for the standard possibilities. |
143 |
(The [[[ comments delimit what gets put into the Texinfo file, so |
(The [[[ comments delimit what gets put into the Texinfo file, so |
144 |
don't delete them!) */ |
don't delete them!) */ |
145 |
/* [[[begin syntaxes]]] */ |
/* [[[begin syntaxes]]] */ |
146 |
#define RE_SYNTAX_EMACS 0 |
#define RE_SYNTAX_EMACS 0 |
147 |
|
|
208 |
#ifdef RE_DUP_MAX |
#ifdef RE_DUP_MAX |
209 |
#undef RE_DUP_MAX |
#undef RE_DUP_MAX |
210 |
#endif |
#endif |
211 |
#define RE_DUP_MAX ((1 << 15) - 1) |
#define RE_DUP_MAX ((1 << 15) - 1) |
212 |
|
|
213 |
|
|
214 |
/* POSIX `cflags' bits (i.e., information for `regcomp'). */ |
/* POSIX `cflags' bits (i.e., information for `regcomp'). */ |
220 |
/* If this bit is set, then ignore case when matching. |
/* If this bit is set, then ignore case when matching. |
221 |
If not set, then case is significant. */ |
If not set, then case is significant. */ |
222 |
#define REG_ICASE (REG_EXTENDED << 1) |
#define REG_ICASE (REG_EXTENDED << 1) |
223 |
|
|
224 |
/* If this bit is set, then anchors do not match at newline |
/* If this bit is set, then anchors do not match at newline |
225 |
characters in the string. |
characters in the string. |
226 |
If not set, then anchors do match at newlines. */ |
If not set, then anchors do match at newlines. */ |
259 |
REG_EESCAPE, /* Trailing backslash. */ |
REG_EESCAPE, /* Trailing backslash. */ |
260 |
REG_ESUBREG, /* Invalid back reference. */ |
REG_ESUBREG, /* Invalid back reference. */ |
261 |
REG_EBRACK, /* Unmatched left bracket. */ |
REG_EBRACK, /* Unmatched left bracket. */ |
262 |
REG_EPAREN, /* Parenthesis imbalance. */ |
REG_EPAREN, /* Parenthesis imbalance. */ |
263 |
REG_EBRACE, /* Unmatched \{. */ |
REG_EBRACE, /* Unmatched \{. */ |
264 |
REG_BADBR, /* Invalid contents of \{\}. */ |
REG_BADBR, /* Invalid contents of \{\}. */ |
265 |
REG_ERANGE, /* Invalid range end. */ |
REG_ERANGE, /* Invalid range end. */ |
290 |
unsigned long allocated; |
unsigned long allocated; |
291 |
|
|
292 |
/* Number of bytes actually used in `buffer'. */ |
/* Number of bytes actually used in `buffer'. */ |
293 |
unsigned long used; |
unsigned long used; |
294 |
|
|
295 |
/* Syntax setting with which the pattern was compiled. */ |
/* Syntax setting with which the pattern was compiled. */ |
296 |
reg_syntax_t syntax; |
reg_syntax_t syntax; |
334 |
unsigned no_sub : 1; |
unsigned no_sub : 1; |
335 |
|
|
336 |
/* If set, a beginning-of-line anchor doesn't match at the |
/* If set, a beginning-of-line anchor doesn't match at the |
337 |
beginning of the string. */ |
beginning of the string. */ |
338 |
unsigned not_bol : 1; |
unsigned not_bol : 1; |
339 |
|
|
340 |
/* Similarly for an end-of-line anchor. */ |
/* Similarly for an end-of-line anchor. */ |
441 |
|
|
442 |
|
|
443 |
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ |
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ |
444 |
extern int re_match_2 |
extern int re_match_2 |
445 |
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
446 |
int length1, const char *string2, int length2, |
int length1, const char *string2, int length2, |
447 |
int start, struct re_registers *regs, int stop)); |
int start, struct re_registers *regs, int stop)); |