/[pcre]/code/trunk/internal.h
ViewVC logotype

Diff of /code/trunk/internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 21 by nigel, Sat Feb 24 21:38:37 2007 UTC revision 23 by nigel, Sat Feb 24 21:38:41 2007 UTC
# Line 3  Line 3 
3  *************************************************/  *************************************************/
4    
5    
6  #define PCRE_VERSION       "1.09 28-Apr-1998"  #define PCRE_VERSION       "2.00 24-Sep-1998"
7    
8    
9  /* This is a library of functions to support regular expressions whose syntax  /* This is a library of functions to support regular expressions whose syntax
# Line 46  define a macro for memmove() if USE_BCOP Line 46  define a macro for memmove() if USE_BCOP
46    
47  #include <ctype.h>  #include <ctype.h>
48  #include <limits.h>  #include <limits.h>
 #include <setjmp.h>  
49  #include <stddef.h>  #include <stddef.h>
50  #include <stdio.h>  #include <stdio.h>
51  #include <stdlib.h>  #include <stdlib.h>
# Line 60  Standard C system should have one. */ Line 59  Standard C system should have one. */
59  #define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))  #define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
60  #endif  #endif
61    
62    /* These are the public options that can change during matching. */
63    
64    #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
65    
66  /* Private options flags start at the most significant end of the two bytes.  /* Private options flags start at the most significant end of the two bytes.
67  The public options defined in pcre.h start at the least significant end. Make  The public options defined in pcre.h start at the least significant end. Make
68  sure they don't overlap! */  sure they don't overlap! */
69    
70  #define PCRE_FIRSTSET           0x8000  /* first_char is set */  #define PCRE_FIRSTSET           0x8000  /* first_char is set */
71  #define PCRE_STARTLINE          0x4000  /* start after \n for multiline */  #define PCRE_STARTLINE          0x4000  /* start after \n for multiline */
72  #define PCRE_COMPILED_CASELESS  0x2000  /* like it says */  #define PCRE_INGROUP            0x2000  /* compiling inside a group */
73    
74  /* Options for the "extra" block produced by pcre_study(). */  /* Options for the "extra" block produced by pcre_study(). */
75    
76  #define PCRE_STUDY_CASELESS 0x01     /* study was caseless */  #define PCRE_STUDY_MAPPED   0x01     /* a map of starting chars exists */
 #define PCRE_STUDY_MAPPED   0x02     /* a map of starting chars exists */  
77    
78  /* Masks for identifying the public options: all permitted at compile time,  /* Masks for identifying the public options which are permitted at compile
79  only some permitted at run or study time. */  time, run time or study time, respectively. */
80    
81  #define PUBLIC_OPTIONS \  #define PUBLIC_OPTIONS \
82    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
83     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY)     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY)
84    
85  #define PUBLIC_EXEC_OPTIONS \  #define PUBLIC_EXEC_OPTIONS (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL)
   (PCRE_CASELESS|PCRE_ANCHORED|PCRE_MULTILINE|PCRE_NOTBOL|PCRE_NOTEOL| \  
    PCRE_DOTALL|PCRE_DOLLAR_ENDONLY)  
86    
87  #define PUBLIC_STUDY_OPTIONS (PCRE_CASELESS)  #define PUBLIC_STUDY_OPTIONS 0   /* None defined */
88    
89  /* Magic number to provide a small check against being handed junk. */  /* Magic number to provide a small check against being handed junk. */
90    
# Line 100  typedef int BOOL; Line 100  typedef int BOOL;
100  /* These are escaped items that aren't just an encoding of a particular data  /* These are escaped items that aren't just an encoding of a particular data
101  value such as \n. They must have non-zero values, as check_escape() returns  value such as \n. They must have non-zero values, as check_escape() returns
102  their negation. Also, they must appear in the same order as in the opcode  their negation. Also, they must appear in the same order as in the opcode
103  definitions below, up to ESC_Z. The final one must be ESC_REF as subsequent  definitions below, up to ESC_z. The final one must be ESC_REF as subsequent
104  values are used for \1, \2, \3, etc. There is a test in the code for an escape  values are used for \1, \2, \3, etc. There is a test in the code for an escape
105  greater than ESC_b and less than ESC_X to detect the types that may be  greater than ESC_b and less than ESC_X to detect the types that may be
106  repeated. If any new escapes are put in-between that don't consume a character,  repeated. If any new escapes are put in-between that don't consume a character,
107  that code will have to change. */  that code will have to change. */
108    
109  enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w,  enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w,
110           ESC_Z, ESC_z, ESC_REF };
                     /* These are not Perl escapes, so can't appear in the */  
        ESC_X,       /* simple table-lookup because they must be conditional */  
                     /* on PCRE_EXTRA. */  
        ESC_Z,  
        ESC_REF };  
111    
112  /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets  /* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
113  that extract substrings. Starting from 1 (i.e. after OP_END), the values up to  that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
# Line 132  enum { Line 127  enum {
127    OP_WHITESPACE,         /* \s */    OP_WHITESPACE,         /* \s */
128    OP_NOT_WORDCHAR,       /* \W */    OP_NOT_WORDCHAR,       /* \W */
129    OP_WORDCHAR,           /* \w */    OP_WORDCHAR,           /* \w */
130    OP_CUT,            /* The analogue of Prolog's "cut" operation (extension) */    OP_EODN,           /* End of data or \n at end of data: \Z. */
131    OP_EOD,            /* End of data: \Z. */    OP_EOD,            /* End of data: \z */
132    
133      OP_OPT,            /* Set runtime options */
134    OP_CIRC,           /* Start of line - varies with multiline switch */    OP_CIRC,           /* Start of line - varies with multiline switch */
135    OP_DOLL,           /* End of line - varies with multiline switch */    OP_DOLL,           /* End of line - varies with multiline switch */
136    OP_ANY,            /* Match any character */    OP_ANY,            /* Match any character */
# Line 181  enum { Line 177  enum {
177    OP_CRMINRANGE,    OP_CRMINRANGE,
178    
179    OP_CLASS,          /* Match a character class */    OP_CLASS,          /* Match a character class */
   OP_NEGCLASS,       /* Match a character class, specified negatively */  
180    OP_REF,            /* Match a back reference */    OP_REF,            /* Match a back reference */
181    
182    OP_ALT,            /* Start of alternation */    OP_ALT,            /* Start of alternation */
# Line 189  enum { Line 184  enum {
184    OP_KETRMAX,        /* These two must remain together and in this */    OP_KETRMAX,        /* These two must remain together and in this */
185    OP_KETRMIN,        /* order. They are for groups the repeat for ever. */    OP_KETRMIN,        /* order. They are for groups the repeat for ever. */
186    
187    OP_ASSERT,    /* The assertions must come before ONCE and COND */
188    OP_ASSERT_NOT,  
189      OP_ASSERT,         /* Positive lookahead */
190      OP_ASSERT_NOT,     /* Negative lookahead */
191      OP_ASSERTBACK,     /* Positive lookbehind */
192      OP_ASSERTBACK_NOT, /* Negative lookbehind */
193      OP_REVERSE,        /* Move pointer back - used in lookbehind assertions */
194    
195      /* ONCE and COND must come after the assertions, with ONCE first, as there's
196      a test for >= ONCE for a subpattern that isn't an assertion. */
197    
198    OP_ONCE,           /* Once matched, don't back up into the subpattern */    OP_ONCE,           /* Once matched, don't back up into the subpattern */
199      OP_COND,           /* Conditional group */
200      OP_CREF,           /* Used to hold an extraction string number */
201    
202    OP_BRAZERO,        /* These two must remain together and in this */    OP_BRAZERO,        /* These two must remain together and in this */
203    OP_BRAMINZERO,     /* order. */    OP_BRAMINZERO,     /* order. */
# Line 231  just to accommodate the POSIX wrapper. * Line 237  just to accommodate the POSIX wrapper. *
237  #define ERR19 "too many sets of parentheses"  #define ERR19 "too many sets of parentheses"
238  #define ERR20 "regular expression too large"  #define ERR20 "regular expression too large"
239  #define ERR21 "failed to get memory"  #define ERR21 "failed to get memory"
240  #define ERR22 "unmatched brackets"  #define ERR22 "unmatched parentheses"
241  #define ERR23 "internal error: code overflow"  #define ERR23 "internal error: code overflow"
242    #define ERR24 "unrecognized character after (?<"
243    #define ERR25 "lookbehind assertion is not fixed length"
244    #define ERR26 "malformed number after (?("
245    #define ERR27 "conditional group contains more than two branches"
246    #define ERR28 "assertion expected after (?("
247    
248  /* All character handling must be done as unsigned characters. Otherwise there  /* All character handling must be done as unsigned characters. Otherwise there
249  are problems with top-bit-set characters and functions such as isspace().  are problems with top-bit-set characters and functions such as isspace().

Legend:
Removed from v.21  
changed lines
  Added in v.23

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12