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

Diff of /code/trunk/pcre_internal.h

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

revision 213 by ph10, Wed Aug 15 11:34:14 2007 UTC revision 336 by ph10, Sat Apr 12 15:59:03 2008 UTC
# Line 7  Line 7 
7  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
8    
9                         Written by Philip Hazel                         Written by Philip Hazel
10             Copyright (c) 1997-2007 University of Cambridge             Copyright (c) 1997-2008 University of Cambridge
11    
12  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
13  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 363  never be called in byte mode. To make su Line 363  never be called in byte mode. To make su
363  support is omitted, we don't even define it. */  support is omitted, we don't even define it. */
364    
365  #ifndef SUPPORT_UTF8  #ifndef SUPPORT_UTF8
366    #define NEXTCHAR(p) p++;
367  #define GETCHAR(c, eptr) c = *eptr;  #define GETCHAR(c, eptr) c = *eptr;
368  #define GETCHARTEST(c, eptr) c = *eptr;  #define GETCHARTEST(c, eptr) c = *eptr;
369  #define GETCHARINC(c, eptr) c = *eptr++;  #define GETCHARINC(c, eptr) c = *eptr++;
# Line 372  support is omitted, we don't even define Line 373  support is omitted, we don't even define
373    
374  #else   /* SUPPORT_UTF8 */  #else   /* SUPPORT_UTF8 */
375    
376    /* Advance a character pointer one byte in non-UTF-8 mode and by one character
377    in UTF-8 mode. */
378    
379    #define NEXTCHAR(p) \
380      p++; \
381      if (utf8) { while((*p & 0xc0) == 0x80) p++; }
382    
383  /* Get the next UTF-8 character, not advancing the pointer. This is called when  /* Get the next UTF-8 character, not advancing the pointer. This is called when
384  we know we are in UTF-8 mode. */  we know we are in UTF-8 mode. */
385    
# Line 481  Standard C system should have one. */ Line 489  Standard C system should have one. */
489    
490  #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)  #define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
491    
492  /* Private options flags start at the most significant end of the four bytes.  /* Private flags containing information about the compiled regex. They used to
493  The public options defined in pcre.h start at the least significant end. Make  live at the top end of the options word, but that got almost full, so now they
494  sure they don't overlap! The bits are getting a bit scarce now -- when we run  are in a 16-bit flags word. */
495  out, there is a dummy word in the structure that could be used for the private  
496  bits. */  #define PCRE_NOPARTIAL     0x0001  /* can't use partial with this regex */
497    #define PCRE_FIRSTSET      0x0002  /* first_byte is set */
498  #define PCRE_NOPARTIAL     0x80000000  /* can't use partial with this regex */  #define PCRE_REQCHSET      0x0004  /* req_byte is set */
499  #define PCRE_FIRSTSET      0x40000000  /* first_byte is set */  #define PCRE_STARTLINE     0x0008  /* start after \n for multiline */
500  #define PCRE_REQCHSET      0x20000000  /* req_byte is set */  #define PCRE_JCHANGED      0x0010  /* j option used in regex */
501  #define PCRE_STARTLINE     0x10000000  /* start after \n for multiline */  #define PCRE_HASCRORLF     0x0020  /* explicit \r or \n in pattern */
 #define PCRE_JCHANGED      0x08000000  /* j option changes within regex */  
502    
503  /* Options for the "extra" block produced by pcre_study(). */  /* Options for the "extra" block produced by pcre_study(). */
504    
# Line 507  time, run time, or study time, respectiv Line 514  time, run time, or study time, respectiv
514    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \    (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
515     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \     PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
516     PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \     PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
517     PCRE_DUPNAMES|PCRE_NEWLINE_BITS)     PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
518       PCRE_JAVASCRIPT_COMPAT)
519    
520  #define PUBLIC_EXEC_OPTIONS \  #define PUBLIC_EXEC_OPTIONS \
521    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
522     PCRE_PARTIAL|PCRE_NEWLINE_BITS)     PCRE_PARTIAL|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
523    
524  #define PUBLIC_DFA_EXEC_OPTIONS \  #define PUBLIC_DFA_EXEC_OPTIONS \
525    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \    (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
526     PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS)     PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_BITS| \
527       PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
528    
529  #define PUBLIC_STUDY_OPTIONS 0   /* None defined */  #define PUBLIC_STUDY_OPTIONS 0   /* None defined */
530    
# Line 605  character, that code will have to change Line 614  character, that code will have to change
614    
615  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,  enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
616         ESC_W, ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H, ESC_h,         ESC_W, ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H, ESC_h,
617         ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };         ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k, ESC_REF };
618    
619    
620  /* Opcode table: Starting from 1 (i.e. after OP_END), the values up to  /* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
# Line 765  enum { Line 774  enum {
774    /* These are forced failure and success verbs */    /* These are forced failure and success verbs */
775    
776    OP_FAIL,           /* 108 */    OP_FAIL,           /* 108 */
777    OP_ACCEPT          /* 109 */    OP_ACCEPT,         /* 109 */
778    
779      /* This is used to skip a subpattern with a {0} quantifier */
780    
781      OP_SKIPZERO        /* 110 */
782  };  };
783    
784    
# Line 790  for debugging. The macro is referenced o Line 803  for debugging. The macro is referenced o
803    "AssertB", "AssertB not", "Reverse",                            \    "AssertB", "AssertB not", "Reverse",                            \
804    "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \    "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
805    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \    "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
806    "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT"    "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \
807      "Skip zero"
808    
809    
810  /* This macro defines the length of fixed length operations in the compiled  /* This macro defines the length of fixed length operations in the compiled
# Line 855  in UTF-8 mode. The code that uses this t Line 869  in UTF-8 mode. The code that uses this t
869    1,                             /* DEF                                    */ \    1,                             /* DEF                                    */ \
870    1, 1,                          /* BRAZERO, BRAMINZERO                    */ \    1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
871    1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \    1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \
872    1, 1                           /* FAIL, ACCEPT                           */    1, 1, 1                        /* FAIL, ACCEPT, SKIPZERO                 */
873    
874    
875  /* A magic value for OP_RREF to indicate the "any recursion" condition. */  /* A magic value for OP_RREF to indicate the "any recursion" condition. */
# Line 871  enum { ERR0,  ERR1,  ERR2,  ERR3,  ERR4, Line 885  enum { ERR0,  ERR1,  ERR2,  ERR3,  ERR4,
885         ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,         ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
886         ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,         ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
887         ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,         ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
888         ERR60, ERR61 };         ERR60, ERR61, ERR62, ERR63, ERR64 };
889    
890  /* The real format of the start of the pcre block; the index of names and the  /* The real format of the start of the pcre block; the index of names and the
891  code vector run on as long as necessary after the end. We store an explicit  code vector run on as long as necessary after the end. We store an explicit
# Line 893  NOTE NOTE NOTE: Line 907  NOTE NOTE NOTE:
907  typedef struct real_pcre {  typedef struct real_pcre {
908    pcre_uint32 magic_number;    pcre_uint32 magic_number;
909    pcre_uint32 size;               /* Total that was malloced */    pcre_uint32 size;               /* Total that was malloced */
910    pcre_uint32 options;    pcre_uint32 options;            /* Public options */
911    pcre_uint32 dummy1;             /* For future use, maybe */    pcre_uint16 flags;              /* Private flags */
912      pcre_uint16 dummy1;             /* For future use */
913    pcre_uint16 top_bracket;    pcre_uint16 top_bracket;
914    pcre_uint16 top_backref;    pcre_uint16 top_backref;
915    pcre_uint16 first_byte;    pcre_uint16 first_byte;
# Line 934  typedef struct compile_data { Line 948  typedef struct compile_data {
948    uschar *name_table;           /* The name/number table */    uschar *name_table;           /* The name/number table */
949    int  names_found;             /* Number of entries so far */    int  names_found;             /* Number of entries so far */
950    int  name_entry_size;         /* Size of each entry */    int  name_entry_size;         /* Size of each entry */
951    int  bracount;                /* Count of capturing parens */    int  bracount;                /* Count of capturing parens as we compile */
952      int  final_bracount;          /* Saved value after first pass */
953    int  top_backref;             /* Maximum back reference */    int  top_backref;             /* Maximum back reference */
954    unsigned int backref_map;     /* Bitmap of low back refs */    unsigned int backref_map;     /* Bitmap of low back refs */
955    int  external_options;        /* External (initial) options */    int  external_options;        /* External (initial) options */
956      int  external_flags;          /* External flag bits to be set */
957    int  req_varyopt;             /* "After variable item" flag for reqbyte */    int  req_varyopt;             /* "After variable item" flag for reqbyte */
   BOOL nopartial;               /* Set TRUE if partial won't work */  
958    BOOL had_accept;              /* (*ACCEPT) encountered */    BOOL had_accept;              /* (*ACCEPT) encountered */
959    int  nltype;                  /* Newline type */    int  nltype;                  /* Newline type */
960    int  nllen;                   /* Newline string length */    int  nllen;                   /* Newline string length */
# Line 995  typedef struct match_data { Line 1010  typedef struct match_data {
1010    BOOL   notbol;                /* NOTBOL flag */    BOOL   notbol;                /* NOTBOL flag */
1011    BOOL   noteol;                /* NOTEOL flag */    BOOL   noteol;                /* NOTEOL flag */
1012    BOOL   utf8;                  /* UTF8 flag */    BOOL   utf8;                  /* UTF8 flag */
1013      BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */
1014    BOOL   endonly;               /* Dollar not before final \n */    BOOL   endonly;               /* Dollar not before final \n */
1015    BOOL   notempty;              /* Empty string match not wanted */    BOOL   notempty;              /* Empty string match not wanted */
1016    BOOL   partial;               /* PARTIAL flag */    BOOL   partial;               /* PARTIAL flag */
1017    BOOL   hitend;                /* Hit the end of the subject at some point */    BOOL   hitend;                /* Hit the end of the subject at some point */
1018      BOOL   bsr_anycrlf;           /* \R is just any CRLF, not full Unicode */
1019    const uschar *start_code;     /* For use when recursing */    const uschar *start_code;     /* For use when recursing */
1020    USPTR  start_subject;         /* Start of the subject string */    USPTR  start_subject;         /* Start of the subject string */
1021    USPTR  end_subject;           /* End of the subject string */    USPTR  end_subject;           /* End of the subject string */
# Line 1035  typedef struct dfa_match_data { Line 1052  typedef struct dfa_match_data {
1052  #define ctype_letter  0x02  #define ctype_letter  0x02
1053  #define ctype_digit   0x04  #define ctype_digit   0x04
1054  #define ctype_xdigit  0x08  #define ctype_xdigit  0x08
1055  #define ctype_word    0x10   /* alphameric or '_' */  #define ctype_word    0x10   /* alphanumeric or '_' */
1056  #define ctype_meta    0x80   /* regexp meta char or zero (end pattern) */  #define ctype_meta    0x80   /* regexp meta char or zero (end pattern) */
1057    
1058  /* Offsets for the bitmap tables in pcre_cbits. Each table contains a set  /* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
# Line 1063  total length. */ Line 1080  total length. */
1080  #define tables_length (ctypes_offset + 256)  #define tables_length (ctypes_offset + 256)
1081    
1082  /* Layout of the UCP type table that translates property names into types and  /* Layout of the UCP type table that translates property names into types and
1083  codes. */  codes. Each entry used to point directly to a name, but to reduce the number of
1084    relocations in shared libraries, it now has an offset into a single string
1085    instead. */
1086    
1087  typedef struct {  typedef struct {
1088    const char *name;    pcre_uint16 name_offset;
1089    pcre_uint16 type;    pcre_uint16 type;
1090    pcre_uint16 value;    pcre_uint16 value;
1091  } ucp_type_table;  } ucp_type_table;
# Line 1084  extern const uschar _pcre_utf8_table4[]; Line 1103  extern const uschar _pcre_utf8_table4[];
1103    
1104  extern const int    _pcre_utf8_table1_size;  extern const int    _pcre_utf8_table1_size;
1105    
1106    extern const char   _pcre_utt_names[];
1107  extern const ucp_type_table _pcre_utt[];  extern const ucp_type_table _pcre_utt[];
1108  extern const int _pcre_utt_size;  extern const int _pcre_utt_size;
1109    

Legend:
Removed from v.213  
changed lines
  Added in v.336

  ViewVC Help
Powered by ViewVC 1.1.5