| 1 | /* regexp.h
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
|
|---|
| 4 | * by Larry Wall and others
|
|---|
| 5 | *
|
|---|
| 6 | * You may distribute under the terms of either the GNU General Public
|
|---|
| 7 | * License or the Artistic License, as specified in the README file.
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | /*
|
|---|
| 12 | * Definitions etc. for regexp(3) routines.
|
|---|
| 13 | *
|
|---|
| 14 | * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
|
|---|
| 15 | * not the System V one.
|
|---|
| 16 | */
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 | struct regnode {
|
|---|
| 20 | U8 flags;
|
|---|
| 21 | U8 type;
|
|---|
| 22 | U16 next_off;
|
|---|
| 23 | };
|
|---|
| 24 |
|
|---|
| 25 | typedef struct regnode regnode;
|
|---|
| 26 |
|
|---|
| 27 | struct reg_substr_data;
|
|---|
| 28 |
|
|---|
| 29 | struct reg_data;
|
|---|
| 30 |
|
|---|
| 31 | typedef struct regexp {
|
|---|
| 32 | I32 *startp;
|
|---|
| 33 | I32 *endp;
|
|---|
| 34 | regnode *regstclass;
|
|---|
| 35 | struct reg_substr_data *substrs;
|
|---|
| 36 | char *precomp; /* pre-compilation regular expression */
|
|---|
| 37 | struct reg_data *data; /* Additional data. */
|
|---|
| 38 | char *subbeg; /* saved or original string
|
|---|
| 39 | so \digit works forever. */
|
|---|
| 40 | U32 *offsets; /* offset annotations 20001228 MJD */
|
|---|
| 41 | I32 sublen; /* Length of string pointed by subbeg */
|
|---|
| 42 | I32 refcnt;
|
|---|
| 43 | I32 minlen; /* mininum possible length of $& */
|
|---|
| 44 | I32 prelen; /* length of precomp */
|
|---|
| 45 | U32 nparens; /* number of parentheses */
|
|---|
| 46 | U32 lastparen; /* last paren matched */
|
|---|
| 47 | U32 lastcloseparen; /* last paren matched */
|
|---|
| 48 | U32 reganch; /* Internal use only +
|
|---|
| 49 | Tainted information used by regexec? */
|
|---|
| 50 | regnode program[1]; /* Unwarranted chumminess with compiler. */
|
|---|
| 51 | } regexp;
|
|---|
| 52 |
|
|---|
| 53 | #define ROPT_ANCH (ROPT_ANCH_BOL|ROPT_ANCH_MBOL|ROPT_ANCH_GPOS|ROPT_ANCH_SBOL)
|
|---|
| 54 | #define ROPT_ANCH_SINGLE (ROPT_ANCH_SBOL|ROPT_ANCH_GPOS)
|
|---|
| 55 | #define ROPT_ANCH_BOL 0x00001
|
|---|
| 56 | #define ROPT_ANCH_MBOL 0x00002
|
|---|
| 57 | #define ROPT_ANCH_SBOL 0x00004
|
|---|
| 58 | #define ROPT_ANCH_GPOS 0x00008
|
|---|
| 59 | #define ROPT_SKIP 0x00010
|
|---|
|
|---|