Apply the "frame around text area" patch and associated geometry fixes. Looks
[nedit.git] / source / regularExp.h
blob0d9e9efaebfb9cc37eb2172a584a16c0c679d917
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. */
12 #define NSUBEXP 50
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. */
31 } regexp;
33 /* Flags for CompileRE default settings (Markus Schwarzenberg) */
35 typedef enum {
36 REDFLT_STANDARD = 0,
37 REDFLT_CASE_INSENSITIVE = 1
38 /* REDFLT_MATCH_NEWLINE = 2 Currently not used. */
39 } RE_DEFAULT_FLAG;
41 /* Compiles a regular expression into the internal format used by `ExecRE'. */
43 regexp * CompileRE (
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. */
50 int ExecRE (
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
56 highlighting.*/
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
67 "string" if NULL */
69 /* Perform substitutions after a `regexp' match. */
71 void SubstituteRE (
72 regexp *prog,
73 const char *source,
74 char *dest,
75 int max);
77 /* Builds a default delimiter table that persists across `ExecRE' calls that
78 is identical to `delimiters'. Pass NULL for "default default" set of
79 delimiters. */
81 void SetREDefaultWordDelimiters (
82 char *delimiters);
84 /* Enable (or disable) brace counting quantifiers, e.g. `(foo){0,3}'. */
86 void EnableCountingQuantifier (int is_enabled);
88 #endif /* NEDIT_REGULAREXP_H_INCLUDED */