regexp.h - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
regexp.h (1521B) | |
--- | |
1 /* Copyright (c) 1998 Lucent Technologies - All rights reserved. */ | |
2 | |
3 typedef struct Resub Resub; | |
4 typedef struct Reclass Reclass; | |
5 typedef struct Reinst Reinst; | |
6 typedef struct Reprog Reprog; | |
7 | |
8 /* | |
9 * Sub expression matches | |
10 */ | |
11 struct Resub{ | |
12 union | |
13 { | |
14 char *sp; | |
15 wchar_t *rsp; | |
16 }s; | |
17 union | |
18 { | |
19 char *ep; | |
20 wchar_t *rep; | |
21 }e; | |
22 }; | |
23 | |
24 /* | |
25 * character class, each pair of rune's defines a range | |
26 */ | |
27 struct Reclass{ | |
28 wchar_t *end; | |
29 wchar_t spans[64]; | |
30 }; | |
31 | |
32 /* | |
33 * Machine instructions | |
34 */ | |
35 struct Reinst{ | |
36 int type; | |
37 union { | |
38 Reclass *cp; /* class pointer */ | |
39 wchar_t r; /* character */ | |
40 int subid; /* sub-expression id for RBRA and LBRA */ | |
41 Reinst *right; /* right child of OR */ | |
42 }u1; | |
43 union { /* regexp relies on these two being in the same union */ | |
44 Reinst *left; /* left child of OR */ | |
45 Reinst *next; /* next instruction for CAT & LBRA */ | |
46 }u2; | |
47 }; | |
48 | |
49 /* | |
50 * Reprogram definition | |
51 */ | |
52 struct Reprog{ | |
53 Reinst *startinst; /* start pc */ | |
54 Reclass class[16]; /* .data */ | |
55 Reinst firstinst[5]; /* .text */ | |
56 }; | |
57 | |
58 extern Reprog *regcomp(char*); | |
59 extern Reprog *regcomplit(char*); | |
60 extern Reprog *regcompnl(char*); | |
61 extern void regerror(char*); | |
62 extern int regexec(Reprog*, char*, Resub*, int); | |
63 extern void regsub(char*, char*, Resub*, int); | |
64 extern int rregexec(Reprog*, wchar_t*, Resub*, int); | |
65 extern void rregsub(wchar_t*, wchar_t*, Resub*, int); |