482504: Bad CapsLock grab on certain keyboard configurations
[nedit.git] / source / regularExp.h
bloba033ea21abb42cae3cb3d58a6c6889c20a25b0a0
1 /* $Id: regularExp.h,v 1.6 2001/08/25 15:24:52 amai Exp $ */
2 /*----------------------------------------------------------------------*
3 * This is regularExp.h: NEdit Regular Expression Package Header File
4 *----------------------------------------------------------------------*/
6 /* Number of text capturing parentheses allowed. */
8 #define NSUBEXP 50
10 /* Structure to contain the compiled form of a regular expression plus
11 pointers to matched text. `program' is the actual compiled regex code. */
13 typedef struct regexp {
14 char *startp [NSUBEXP]; /* Captured text starting locations. */
15 char *endp [NSUBEXP]; /* Captured text ending locations. */
16 char *extentp; /* Points to the maximum extent of text scanned by
17 ExecRE to achieve a match (needed because of
18 positive look-ahead.) */
19 char match_start; /* Internal use only. */
20 char anchor; /* Internal use only. */
21 char program [1]; /* Unwarranted chumminess with compiler. */
22 } regexp;
24 /* Flags for CompileRE default settings (Markus Schwarzenberg) */
26 typedef enum {
27 REDFLT_STANDARD = 0,
28 REDFLT_CASE_INSENSITIVE = 1
29 /* REDFLT_MATCH_NEWLINE = 2 Currently not used. */
30 } RE_DEFAULT_FLAG;
32 /* Compiles a regular expression into the internal format used by `ExecRE'. */
34 regexp * CompileRE (
35 const char *exp, /* String containing the regex specification. */
36 char **errorText, /* Text of any error message produced. */
37 int defaultFlags); /* Flags for default RE-operation */
39 /* Match a `regexp' structure against a string. */
41 int ExecRE (
42 regexp *prog, /* Compiled regex. */
43 regexp *cross_regex_backref, /* Pointer to a `regexp' that was used in a
44 previous execution of ExecRE. Used to
45 implement back references across regular
46 expressions for use in syntax
47 highlighting.*/
48 const char *string, /* Text to search within. */
49 const char *end, /* Pointer to the end of `string'. If NULL will
50 scan from `string' until '\0' is found. */
51 int reverse, /* Backward search. */
52 char prev_char, /* Character immediately prior to `string'. Set
53 to '\n' or '\0' if true beginning of text. */
54 char succ_char, /* Character immediately after `end'. Set
55 to '\n' or '\0' if true beginning of text. */
56 const char *delimiters); /* Word delimiters to use (NULL for default) */
58 /* Perform substitutions after a `regexp' match. */
60 void SubstituteRE (
61 regexp *prog,
62 const char *source,
63 char *dest,
64 int max);
66 /* Builds a default delimiter table that persists across `ExecRE' calls that
67 is identical to `delimiters'. Pass NULL for "default default" set of
68 delimiters. */
70 void SetREDefaultWordDelimiters (
71 char *delimiters);
73 /* Enable (or disable) brace counting quantifiers, e.g. `(foo){0,3}'. */
75 void EnableCountingQuantifier (int is_enabled);