1 /* $Id: regularExp.h,v 1.10 2002/07/17 15:14:37 edg Exp $ */
3 #ifndef NEDIT_REGULAREXP_H_INCLUDED
4 #define NEDIT_REGULAREXP_H_INCLUDED
6 /*----------------------------------------------------------------------*
7 * This is regularExp.h: NEdit Regular Expression Package Header File
8 *----------------------------------------------------------------------*/
10 /* Number of text capturing parentheses allowed. */
14 /* Structure to contain the compiled form of a regular expression plus
15 pointers to matched text. `program' is the actual compiled regex code. */
17 typedef struct regexp
{
18 char *startp
[NSUBEXP
]; /* Captured text starting locations. */
19 char *endp
[NSUBEXP
]; /* Captured text ending locations. */
20 char *extentpBW
; /* Points to the maximum extent of text scanned by
21 ExecRE in front of the string to achieve a match
22 (needed because of positive look-behind.) */
23 char *extentpFW
; /* Points to the maximum extent of text scanned by
24 ExecRE to achieve a match (needed because of
25 positive look-ahead.) */
26 int top_branch
; /* Zero-based index of the top branch that matches.
27 Used by syntax highlighting only. */
28 char match_start
; /* Internal use only. */
29 char anchor
; /* Internal use only. */
30 char program
[1]; /* Unwarranted chumminess with compiler. */
33 /* Flags for CompileRE default settings (Markus Schwarzenberg) */
37 REDFLT_CASE_INSENSITIVE
= 1
38 /* REDFLT_MATCH_NEWLINE = 2 Currently not used. */
41 /* Compiles a regular expression into the internal format used by `ExecRE'. */
44 const char *exp
, /* String containing the regex specification. */
45 char **errorText
, /* Text of any error message produced. */
46 int defaultFlags
); /* Flags for default RE-operation */
48 /* Match a `regexp' structure against a string. */
51 regexp
*prog
, /* Compiled regex. */
52 regexp
*cross_regex_backref
, /* Pointer to a `regexp' that was used in a
53 previous execution of ExecRE. Used to
54 implement back references across regular
55 expressions for use in syntax
57 const char *string
, /* Text to search within. */
58 const char *end
, /* Pointer to the end of `string'. If NULL will
59 scan from `string' until '\0' is found. */
60 int reverse
, /* Backward search. */
61 char prev_char
, /* Character immediately prior to `string'. Set
62 to '\n' or '\0' if true beginning of text. */
63 char succ_char
, /* Character immediately after `end'. Set
64 to '\n' or '\0' if true beginning of text. */
65 const char *delimiters
, /* Word delimiters to use (NULL for default) */
66 const char *look_behind_to
); /* Boundary for look-behind; defaults to
69 /* Perform substitutions after a `regexp' match. */
77 /* Builds a default delimiter table that persists across `ExecRE' calls that
78 is identical to `delimiters'. Pass NULL for "default default" set of
81 void SetREDefaultWordDelimiters (
84 /* Enable (or disable) brace counting quantifiers, e.g. `(foo){0,3}'. */
86 void EnableCountingQuantifier (int is_enabled
);
88 #endif /* NEDIT_REGULAREXP_H_INCLUDED */