~ubuntu-branches/debian/squeeze/glib2.0/squeeze

« back to all changes in this revision

Viewing changes to glib/pcre/pcre_internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-02-15 13:00:43 UTC
  • mfrom: (1.3.1 upstream) (69.1.10 intrepid)
  • Revision ID: james.westby@ubuntu.com-20090215130043-q47fbt3owmt42m2f
Tags: 2.18.4-2
* Release to unstable
* debian/rules:
- bump SHVER, since we are already forcing a 2.18.0 dependecy on the
  symbols introduced in the development versions
* debian/control.in:
- added Homepage and Vcs-* control fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
514
514
  (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
515
515
   PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
516
516
   PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
517
 
   PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE)
 
517
   PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
 
518
   PCRE_JAVASCRIPT_COMPAT)
518
519
 
519
520
#define PUBLIC_EXEC_OPTIONS \
520
521
  (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
601
602
value such as \n. They must have non-zero values, as check_escape() returns
602
603
their negation. Also, they must appear in the same order as in the opcode
603
604
definitions below, up to ESC_z. There's a dummy for OP_ANY because it
604
 
corresponds to "." rather than an escape sequence. The final one must be
605
 
ESC_REF as subsequent values are used for backreferences (\1, \2, \3, etc).
606
 
There are two tests in the code for an escape greater than ESC_b and less than
607
 
ESC_Z to detect the types that may be repeated. These are the types that
608
 
consume characters. If any new escapes are put in between that don't consume a
609
 
character, that code will have to change. */
 
605
corresponds to "." rather than an escape sequence, and another for OP_ALLANY
 
606
(which is used for [^] in JavaScript compatibility mode).
 
607
 
 
608
The final escape must be ESC_REF as subsequent values are used for
 
609
backreferences (\1, \2, \3, etc). There are two tests in the code for an escape
 
610
greater than ESC_b and less than ESC_Z to detect the types that may be
 
611
repeated. These are the types that consume characters. If any new escapes are
 
612
put in between that don't consume a character, that code will have to change.
 
613
*/
610
614
 
611
615
enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
612
 
       ESC_W, ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H, ESC_h,
613
 
       ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_k, ESC_REF };
 
616
       ESC_W, ESC_w, ESC_dum1, ESC_dum2, ESC_C, ESC_P, ESC_p, ESC_R, ESC_H,
 
617
       ESC_h, ESC_V, ESC_v, ESC_X, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_g, ESC_k,
 
618
       ESC_REF };
614
619
 
615
620
 
616
621
/* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
636
641
  OP_WHITESPACE,         /*  9 \s */
637
642
  OP_NOT_WORDCHAR,       /* 10 \W */
638
643
  OP_WORDCHAR,           /* 11 \w */
639
 
  OP_ANY,            /* 12 Match any character */
640
 
  OP_ANYBYTE,        /* 13 Match any byte (\C); different to OP_ANY for UTF-8 */
641
 
  OP_NOTPROP,        /* 14 \P (not Unicode property) */
642
 
  OP_PROP,           /* 15 \p (Unicode property) */
643
 
  OP_ANYNL,          /* 16 \R (any newline sequence) */
644
 
  OP_NOT_HSPACE,     /* 17 \H (not horizontal whitespace) */
645
 
  OP_HSPACE,         /* 18 \h (horizontal whitespace) */
646
 
  OP_NOT_VSPACE,     /* 19 \V (not vertical whitespace) */
647
 
  OP_VSPACE,         /* 20 \v (vertical whitespace) */
648
 
  OP_EXTUNI,         /* 21 \X (extended Unicode sequence */
649
 
  OP_EODN,           /* 22 End of data or \n at end of data: \Z. */
650
 
  OP_EOD,            /* 23 End of data: \z */
651
 
 
652
 
  OP_OPT,            /* 24 Set runtime options */
653
 
  OP_CIRC,           /* 25 Start of line - varies with multiline switch */
654
 
  OP_DOLL,           /* 26 End of line - varies with multiline switch */
655
 
  OP_CHAR,           /* 27 Match one character, casefully */
656
 
  OP_CHARNC,         /* 28 Match one character, caselessly */
657
 
  OP_NOT,            /* 29 Match one character, not the following one */
658
 
 
659
 
  OP_STAR,           /* 30 The maximizing and minimizing versions of */
660
 
  OP_MINSTAR,        /* 31 these six opcodes must come in pairs, with */
661
 
  OP_PLUS,           /* 32 the minimizing one second. */
662
 
  OP_MINPLUS,        /* 33 This first set applies to single characters.*/
663
 
  OP_QUERY,          /* 34 */
664
 
  OP_MINQUERY,       /* 35 */
665
 
 
666
 
  OP_UPTO,           /* 36 From 0 to n matches */
667
 
  OP_MINUPTO,        /* 37 */
668
 
  OP_EXACT,          /* 38 Exactly n matches */
669
 
 
670
 
  OP_POSSTAR,        /* 39 Possessified star */
671
 
  OP_POSPLUS,        /* 40 Possessified plus */
672
 
  OP_POSQUERY,       /* 41 Posesssified query */
673
 
  OP_POSUPTO,        /* 42 Possessified upto */
674
 
 
675
 
  OP_NOTSTAR,        /* 43 The maximizing and minimizing versions of */
676
 
  OP_NOTMINSTAR,     /* 44 these six opcodes must come in pairs, with */
677
 
  OP_NOTPLUS,        /* 45 the minimizing one second. They must be in */
678
 
  OP_NOTMINPLUS,     /* 46 exactly the same order as those above. */
679
 
  OP_NOTQUERY,       /* 47 This set applies to "not" single characters. */
680
 
  OP_NOTMINQUERY,    /* 48 */
681
 
 
682
 
  OP_NOTUPTO,        /* 49 From 0 to n matches */
683
 
  OP_NOTMINUPTO,     /* 50 */
684
 
  OP_NOTEXACT,       /* 51 Exactly n matches */
685
 
 
686
 
  OP_NOTPOSSTAR,     /* 52 Possessified versions */
687
 
  OP_NOTPOSPLUS,     /* 53 */
688
 
  OP_NOTPOSQUERY,    /* 54 */
689
 
  OP_NOTPOSUPTO,     /* 55 */
690
 
 
691
 
  OP_TYPESTAR,       /* 56 The maximizing and minimizing versions of */
692
 
  OP_TYPEMINSTAR,    /* 57 these six opcodes must come in pairs, with */
693
 
  OP_TYPEPLUS,       /* 58 the minimizing one second. These codes must */
694
 
  OP_TYPEMINPLUS,    /* 59 be in exactly the same order as those above. */
695
 
  OP_TYPEQUERY,      /* 60 This set applies to character types such as \d */
696
 
  OP_TYPEMINQUERY,   /* 61 */
697
 
 
698
 
  OP_TYPEUPTO,       /* 62 From 0 to n matches */
699
 
  OP_TYPEMINUPTO,    /* 63 */
700
 
  OP_TYPEEXACT,      /* 64 Exactly n matches */
701
 
 
702
 
  OP_TYPEPOSSTAR,    /* 65 Possessified versions */
703
 
  OP_TYPEPOSPLUS,    /* 66 */
704
 
  OP_TYPEPOSQUERY,   /* 67 */
705
 
  OP_TYPEPOSUPTO,    /* 68 */
706
 
 
707
 
  OP_CRSTAR,         /* 69 The maximizing and minimizing versions of */
708
 
  OP_CRMINSTAR,      /* 70 all these opcodes must come in pairs, with */
709
 
  OP_CRPLUS,         /* 71 the minimizing one second. These codes must */
710
 
  OP_CRMINPLUS,      /* 72 be in exactly the same order as those above. */
711
 
  OP_CRQUERY,        /* 73 These are for character classes and back refs */
712
 
  OP_CRMINQUERY,     /* 74 */
713
 
  OP_CRRANGE,        /* 75 These are different to the three sets above. */
714
 
  OP_CRMINRANGE,     /* 76 */
715
 
 
716
 
  OP_CLASS,          /* 77 Match a character class, chars < 256 only */
717
 
  OP_NCLASS,         /* 78 Same, but the bitmap was created from a negative
 
644
  OP_ANY,            /* 12 Match any character (subject to DOTALL) */
 
645
  OP_ALLANY,         /* 13 Match any character (not subject to DOTALL) */
 
646
  OP_ANYBYTE,        /* 14 Match any byte (\C); different to OP_ANY for UTF-8 */
 
647
  OP_NOTPROP,        /* 15 \P (not Unicode property) */
 
648
  OP_PROP,           /* 16 \p (Unicode property) */
 
649
  OP_ANYNL,          /* 17 \R (any newline sequence) */
 
650
  OP_NOT_HSPACE,     /* 18 \H (not horizontal whitespace) */
 
651
  OP_HSPACE,         /* 19 \h (horizontal whitespace) */
 
652
  OP_NOT_VSPACE,     /* 20 \V (not vertical whitespace) */
 
653
  OP_VSPACE,         /* 21 \v (vertical whitespace) */
 
654
  OP_EXTUNI,         /* 22 \X (extended Unicode sequence */
 
655
  OP_EODN,           /* 23 End of data or \n at end of data: \Z. */
 
656
  OP_EOD,            /* 24 End of data: \z */
 
657
 
 
658
  OP_OPT,            /* 25 Set runtime options */
 
659
  OP_CIRC,           /* 26 Start of line - varies with multiline switch */
 
660
  OP_DOLL,           /* 27 End of line - varies with multiline switch */
 
661
  OP_CHAR,           /* 28 Match one character, casefully */
 
662
  OP_CHARNC,         /* 29 Match one character, caselessly */
 
663
  OP_NOT,            /* 30 Match one character, not the following one */
 
664
 
 
665
  OP_STAR,           /* 31 The maximizing and minimizing versions of */
 
666
  OP_MINSTAR,        /* 32 these six opcodes must come in pairs, with */
 
667
  OP_PLUS,           /* 33 the minimizing one second. */
 
668
  OP_MINPLUS,        /* 34 This first set applies to single characters.*/
 
669
  OP_QUERY,          /* 35 */
 
670
  OP_MINQUERY,       /* 36 */
 
671
 
 
672
  OP_UPTO,           /* 37 From 0 to n matches */
 
673
  OP_MINUPTO,        /* 38 */
 
674
  OP_EXACT,          /* 39 Exactly n matches */
 
675
 
 
676
  OP_POSSTAR,        /* 40 Possessified star */
 
677
  OP_POSPLUS,        /* 41 Possessified plus */
 
678
  OP_POSQUERY,       /* 42 Posesssified query */
 
679
  OP_POSUPTO,        /* 43 Possessified upto */
 
680
 
 
681
  OP_NOTSTAR,        /* 44 The maximizing and minimizing versions of */
 
682
  OP_NOTMINSTAR,     /* 45 these six opcodes must come in pairs, with */
 
683
  OP_NOTPLUS,        /* 46 the minimizing one second. They must be in */
 
684
  OP_NOTMINPLUS,     /* 47 exactly the same order as those above. */
 
685
  OP_NOTQUERY,       /* 48 This set applies to "not" single characters. */
 
686
  OP_NOTMINQUERY,    /* 49 */
 
687
 
 
688
  OP_NOTUPTO,        /* 50 From 0 to n matches */
 
689
  OP_NOTMINUPTO,     /* 51 */
 
690
  OP_NOTEXACT,       /* 52 Exactly n matches */
 
691
 
 
692
  OP_NOTPOSSTAR,     /* 53 Possessified versions */
 
693
  OP_NOTPOSPLUS,     /* 54 */
 
694
  OP_NOTPOSQUERY,    /* 55 */
 
695
  OP_NOTPOSUPTO,     /* 56 */
 
696
 
 
697
  OP_TYPESTAR,       /* 57 The maximizing and minimizing versions of */
 
698
  OP_TYPEMINSTAR,    /* 58 these six opcodes must come in pairs, with */
 
699
  OP_TYPEPLUS,       /* 59 the minimizing one second. These codes must */
 
700
  OP_TYPEMINPLUS,    /* 60 be in exactly the same order as those above. */
 
701
  OP_TYPEQUERY,      /* 61 This set applies to character types such as \d */
 
702
  OP_TYPEMINQUERY,   /* 62 */
 
703
 
 
704
  OP_TYPEUPTO,       /* 63 From 0 to n matches */
 
705
  OP_TYPEMINUPTO,    /* 64 */
 
706
  OP_TYPEEXACT,      /* 65 Exactly n matches */
 
707
 
 
708
  OP_TYPEPOSSTAR,    /* 66 Possessified versions */
 
709
  OP_TYPEPOSPLUS,    /* 67 */
 
710
  OP_TYPEPOSQUERY,   /* 68 */
 
711
  OP_TYPEPOSUPTO,    /* 69 */
 
712
 
 
713
  OP_CRSTAR,         /* 70 The maximizing and minimizing versions of */
 
714
  OP_CRMINSTAR,      /* 71 all these opcodes must come in pairs, with */
 
715
  OP_CRPLUS,         /* 72 the minimizing one second. These codes must */
 
716
  OP_CRMINPLUS,      /* 73 be in exactly the same order as those above. */
 
717
  OP_CRQUERY,        /* 74 These are for character classes and back refs */
 
718
  OP_CRMINQUERY,     /* 75 */
 
719
  OP_CRRANGE,        /* 76 These are different to the three sets above. */
 
720
  OP_CRMINRANGE,     /* 77 */
 
721
 
 
722
  OP_CLASS,          /* 78 Match a character class, chars < 256 only */
 
723
  OP_NCLASS,         /* 79 Same, but the bitmap was created from a negative
718
724
                           class - the difference is relevant only when a UTF-8
719
725
                           character > 255 is encountered. */
720
726
 
721
 
  OP_XCLASS,         /* 79 Extended class for handling UTF-8 chars within the
 
727
  OP_XCLASS,         /* 80 Extended class for handling UTF-8 chars within the
722
728
                           class. This does both positive and negative. */
723
729
 
724
 
  OP_REF,            /* 80 Match a back reference */
725
 
  OP_RECURSE,        /* 81 Match a numbered subpattern (possibly recursive) */
726
 
  OP_CALLOUT,        /* 82 Call out to external function if provided */
 
730
  OP_REF,            /* 81 Match a back reference */
 
731
  OP_RECURSE,        /* 82 Match a numbered subpattern (possibly recursive) */
 
732
  OP_CALLOUT,        /* 83 Call out to external function if provided */
727
733
 
728
 
  OP_ALT,            /* 83 Start of alternation */
729
 
  OP_KET,            /* 84 End of group that doesn't have an unbounded repeat */
730
 
  OP_KETRMAX,        /* 85 These two must remain together and in this */
731
 
  OP_KETRMIN,        /* 86 order. They are for groups the repeat for ever. */
 
734
  OP_ALT,            /* 84 Start of alternation */
 
735
  OP_KET,            /* 85 End of group that doesn't have an unbounded repeat */
 
736
  OP_KETRMAX,        /* 86 These two must remain together and in this */
 
737
  OP_KETRMIN,        /* 87 order. They are for groups the repeat for ever. */
732
738
 
733
739
  /* The assertions must come before BRA, CBRA, ONCE, and COND.*/
734
740
 
735
 
  OP_ASSERT,         /* 87 Positive lookahead */
736
 
  OP_ASSERT_NOT,     /* 88 Negative lookahead */
737
 
  OP_ASSERTBACK,     /* 89 Positive lookbehind */
738
 
  OP_ASSERTBACK_NOT, /* 90 Negative lookbehind */
739
 
  OP_REVERSE,        /* 91 Move pointer back - used in lookbehind assertions */
 
741
  OP_ASSERT,         /* 88 Positive lookahead */
 
742
  OP_ASSERT_NOT,     /* 89 Negative lookahead */
 
743
  OP_ASSERTBACK,     /* 90 Positive lookbehind */
 
744
  OP_ASSERTBACK_NOT, /* 91 Negative lookbehind */
 
745
  OP_REVERSE,        /* 92 Move pointer back - used in lookbehind assertions */
740
746
 
741
747
  /* ONCE, BRA, CBRA, and COND must come after the assertions, with ONCE first,
742
748
  as there's a test for >= ONCE for a subpattern that isn't an assertion. */
743
749
 
744
 
  OP_ONCE,           /* 92 Atomic group */
745
 
  OP_BRA,            /* 93 Start of non-capturing bracket */
746
 
  OP_CBRA,           /* 94 Start of capturing bracket */
747
 
  OP_COND,           /* 95 Conditional group */
 
750
  OP_ONCE,           /* 93 Atomic group */
 
751
  OP_BRA,            /* 94 Start of non-capturing bracket */
 
752
  OP_CBRA,           /* 95 Start of capturing bracket */
 
753
  OP_COND,           /* 96 Conditional group */
748
754
 
749
755
  /* These three must follow the previous three, in the same order. There's a
750
756
  check for >= SBRA to distinguish the two sets. */
751
757
 
752
 
  OP_SBRA,           /* 96 Start of non-capturing bracket, check empty  */
753
 
  OP_SCBRA,          /* 97 Start of capturing bracket, check empty */
754
 
  OP_SCOND,          /* 98 Conditional group, check empty */
755
 
 
756
 
  OP_CREF,           /* 99 Used to hold a capture number as condition */
757
 
  OP_RREF,           /* 100 Used to hold a recursion number as condition */
758
 
  OP_DEF,            /* 101 The DEFINE condition */
759
 
 
760
 
  OP_BRAZERO,        /* 102 These two must remain together and in this */
761
 
  OP_BRAMINZERO,     /* 103 order. */
 
758
  OP_SBRA,           /* 97 Start of non-capturing bracket, check empty  */
 
759
  OP_SCBRA,          /* 98 Start of capturing bracket, check empty */
 
760
  OP_SCOND,          /* 99 Conditional group, check empty */
 
761
 
 
762
  OP_CREF,           /* 100 Used to hold a capture number as condition */
 
763
  OP_RREF,           /* 101 Used to hold a recursion number as condition */
 
764
  OP_DEF,            /* 102 The DEFINE condition */
 
765
 
 
766
  OP_BRAZERO,        /* 103 These two must remain together and in this */
 
767
  OP_BRAMINZERO,     /* 104 order. */
762
768
 
763
769
  /* These are backtracking control verbs */
764
770
 
765
 
  OP_PRUNE,          /* 104 */
766
 
  OP_SKIP,           /* 105 */
767
 
  OP_THEN,           /* 106 */
768
 
  OP_COMMIT,         /* 107 */
 
771
  OP_PRUNE,          /* 105 */
 
772
  OP_SKIP,           /* 106 */
 
773
  OP_THEN,           /* 107 */
 
774
  OP_COMMIT,         /* 108 */
769
775
 
770
776
  /* These are forced failure and success verbs */
771
777
 
772
 
  OP_FAIL,           /* 108 */
773
 
  OP_ACCEPT          /* 109 */
 
778
  OP_FAIL,           /* 109 */
 
779
  OP_ACCEPT,         /* 110 */
 
780
 
 
781
  /* This is used to skip a subpattern with a {0} quantifier */
 
782
 
 
783
  OP_SKIPZERO        /* 111 */
774
784
};
775
785
 
776
786
 
779
789
 
780
790
#define OP_NAME_LIST \
781
791
  "End", "\\A", "\\G", "\\K", "\\B", "\\b", "\\D", "\\d",         \
782
 
  "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte",                   \
 
792
  "\\S", "\\s", "\\W", "\\w", "Any", "AllAny", "Anybyte",         \
783
793
  "notprop", "prop", "\\R", "\\H", "\\h", "\\V", "\\v",           \
784
794
  "extuni",  "\\Z", "\\z",                                        \
785
795
  "Opt", "^", "$", "char", "charnc", "not",                       \
795
805
  "AssertB", "AssertB not", "Reverse",                            \
796
806
  "Once", "Bra", "CBra", "Cond", "SBra", "SCBra", "SCond",        \
797
807
  "Cond ref", "Cond rec", "Cond def", "Brazero", "Braminzero",    \
798
 
  "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT"
 
808
  "*PRUNE", "*SKIP", "*THEN", "*COMMIT", "*FAIL", "*ACCEPT",      \
 
809
  "Skip zero"
799
810
 
800
811
 
801
812
/* This macro defines the length of fixed length operations in the compiled
811
822
  1,                             /* End                                    */ \
812
823
  1, 1, 1, 1, 1,                 /* \A, \G, \K, \B, \b                     */ \
813
824
  1, 1, 1, 1, 1, 1,              /* \D, \d, \S, \s, \W, \w                 */ \
814
 
  1, 1,                          /* Any, Anybyte                           */ \
 
825
  1, 1, 1,                       /* Any, AllAny, Anybyte                   */ \
815
826
  3, 3, 1,                       /* NOTPROP, PROP, EXTUNI                  */ \
816
827
  1, 1, 1, 1, 1,                 /* \R, \H, \h, \V, \v                     */ \
817
828
  1, 1, 2, 1, 1,                 /* \Z, \z, Opt, ^, $                      */ \
860
871
  1,                             /* DEF                                    */ \
861
872
  1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
862
873
  1, 1, 1, 1,                    /* PRUNE, SKIP, THEN, COMMIT,             */ \
863
 
  1, 1                           /* FAIL, ACCEPT                           */
 
874
  1, 1, 1                        /* FAIL, ACCEPT, SKIPZERO                 */
864
875
 
865
876
 
866
877
/* A magic value for OP_RREF to indicate the "any recursion" condition. */
876
887
       ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
877
888
       ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
878
889
       ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
879
 
       ERR60, ERR61, ERR62, ERR63 };
 
890
       ERR60, ERR61, ERR62, ERR63, ERR64 };
880
891
 
881
892
/* The real format of the start of the pcre block; the index of names and the
882
893
code vector run on as long as necessary after the end. We store an explicit
1001
1012
  BOOL   notbol;                /* NOTBOL flag */
1002
1013
  BOOL   noteol;                /* NOTEOL flag */
1003
1014
  BOOL   utf8;                  /* UTF8 flag */
 
1015
  BOOL   jscript_compat;        /* JAVASCRIPT_COMPAT flag */
1004
1016
  BOOL   endonly;               /* Dollar not before final \n */
1005
1017
  BOOL   notempty;              /* Empty string match not wanted */
1006
1018
  BOOL   partial;               /* PARTIAL flag */