⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcre_internal.h

📁 技术管理量不要让站长把时间都花费在为您修正说明上。压缩包解压
💻 H
📖 第 1 页 / 共 3 页
字号:
    { \    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \    int gcss = 6*gcaa; \    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \    while (gcaa-- > 0) \      { \      gcss -= 6; \      c |= (*eptr++ & 0x3f) << gcss; \      } \    }/* Get the next character, testing for UTF-8 mode, and advancing the pointer */#define GETCHARINCTEST(c, eptr) \  c = *eptr++; \  if (utf8 && (c & 0xc0) == 0xc0) \    { \    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \    int gcss = 6*gcaa; \    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \    while (gcaa-- > 0) \      { \      gcss -= 6; \      c |= (*eptr++ & 0x3f) << gcss; \      } \    }/* Get the next UTF-8 character, not advancing the pointer, incrementing lengthif there are extra bytes. This is called when we know we are in UTF-8 mode. */#define GETCHARLEN(c, eptr, len) \  c = *eptr; \  if ((c & 0xc0) == 0xc0) \    { \    int gcii; \    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \    int gcss = 6*gcaa; \    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \    for (gcii = 1; gcii <= gcaa; gcii++) \      { \      gcss -= 6; \      c |= (eptr[gcii] & 0x3f) << gcss; \      } \    len += gcaa; \    }/* If the pointer is not at the start of a character, move it back untilit is. Called only in UTF-8 mode. */#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;#endif/* In case there is no definition of offsetof() provided - though any properStandard C system should have one. */#ifndef offsetof#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))#endif/* These are the public options that can change during matching. */#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)/* Private options flags start at the most significant end of the four bytes,but skip the top bit so we can use ints for convenience without getting tangledwith negative values. The public options defined in pcre.h start at the leastsignificant end. Make sure they don't overlap! */#define PCRE_FIRSTSET      0x40000000  /* first_byte is set */#define PCRE_REQCHSET      0x20000000  /* req_byte is set */#define PCRE_STARTLINE     0x10000000  /* start after \n for multiline */#define PCRE_ICHANGED      0x08000000  /* i option changes within regex */#define PCRE_NOPARTIAL     0x04000000  /* can't use partial with this regex *//* Options for the "extra" block produced by pcre_study(). */#define PCRE_STUDY_MAPPED   0x01     /* a map of starting chars exists *//* Masks for identifying the public options that are permitted at compiletime, run time, or study time, respectively. */#define PUBLIC_OPTIONS \  (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \   PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \   PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE)#define PUBLIC_EXEC_OPTIONS \  (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \   PCRE_PARTIAL)#define PUBLIC_DFA_EXEC_OPTIONS \  (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \   PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART)#define PUBLIC_STUDY_OPTIONS 0   /* None defined *//* Magic number to provide a small check against being handed junk. Also usedto detect whether a pattern was compiled on a host of different endianness. */#define MAGIC_NUMBER  0x50435245UL   /* 'PCRE' *//* Negative values for the firstchar and reqchar variables */#define REQ_UNSET (-2)#define REQ_NONE  (-1)/* The maximum remaining length of subject we are prepared to search for areq_byte match. */#define REQ_BYTE_MAX 1000/* Flags added to firstbyte or reqbyte; a "non-literal" item is either avariable-length repeat, or a anything other than literal characters. */#define REQ_CASELESS 0x0100    /* indicates caselessness */#define REQ_VARY     0x0200    /* reqbyte followed non-literal item *//* Miscellaneous definitions */typedef int BOOL;#define FALSE   0#define TRUE    1/* Escape items that are just an encoding of a particular data value. Note thatESC_n is defined as yet another macro, which is set in config.h to either \n(the default) or \r (which some people want). */#ifndef ESC_e#define ESC_e 27#endif#ifndef ESC_f#define ESC_f '\f'#endif#ifndef ESC_n#define ESC_n NEWLINE#endif#ifndef ESC_r#define ESC_r '\r'#endif/* We can't officially use ESC_t because it is a POSIX reserved identifier(presumably because of all the others like size_t). */#ifndef ESC_tee#define ESC_tee '\t'#endif/* Codes for different types of Unicode property */#define PT_ANY        0    /* Any property - matches all chars */#define PT_LAMP       1    /* L& - the union of Lu, Ll, Lt */#define PT_GC         2    /* General characteristic (e.g. L) */#define PT_PC         3    /* Particular characteristic (e.g. Lu) */#define PT_SC         4    /* Script (e.g. Han) *//* Flag bits and data types for the extended class (OP_XCLASS) for classes thatcontain UTF-8 characters with values greater than 255. */#define XCL_NOT    0x01    /* Flag: this is a negative class */#define XCL_MAP    0x02    /* Flag: a 32-byte map is present */#define XCL_END       0    /* Marks end of individual items */#define XCL_SINGLE    1    /* Single item (one multibyte char) follows */#define XCL_RANGE     2    /* A range (two multibyte chars) follows */#define XCL_PROP      3    /* Unicode property (2-byte property code follows) */#define XCL_NOTPROP   4    /* Unicode inverted property (ditto) *//* These are escaped items that aren't just an encoding of a particular datavalue such as \n. They must have non-zero values, as check_escape() returnstheir negation. Also, they must appear in the same order as in the opcodedefinitions below, up to ESC_z. There's a dummy for OP_ANY because itcorresponds to "." rather than an escape sequence. The final one must beESC_REF as subsequent values are used for \1, \2, \3, etc. There is are twotests in the code for an escape greater than ESC_b and less than ESC_Z todetect the types that may be repeated. These are the types that consumecharacters. If any new escapes are put in between that don't consume acharacter, that code will have to change. */enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,       ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E,       ESC_Q, ESC_REF };/* Opcode table: OP_BRA must be last, as all values >= it are used for bracketsthat extract substrings. Starting from 1 (i.e. after OP_END), the values up toOP_EOD must correspond in order to the list of escapes immediately above.Note that whenever this list is updated, the two macro definitions that followmust also be updated to match. */enum {  OP_END,            /* 0 End of pattern */  /* Values corresponding to backslashed metacharacters */  OP_SOD,            /* 1 Start of data: \A */  OP_SOM,            /* 2 Start of match (subject + offset): \G */  OP_NOT_WORD_BOUNDARY,  /*  3 \B */  OP_WORD_BOUNDARY,      /*  4 \b */  OP_NOT_DIGIT,          /*  5 \D */  OP_DIGIT,              /*  6 \d */  OP_NOT_WHITESPACE,     /*  7 \S */  OP_WHITESPACE,         /*  8 \s */  OP_NOT_WORDCHAR,       /*  9 \W */  OP_WORDCHAR,           /* 10 \w */  OP_ANY,            /* 11 Match any character */  OP_ANYBYTE,        /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */  OP_NOTPROP,        /* 13 \P (not Unicode property) */  OP_PROP,           /* 14 \p (Unicode property) */  OP_EXTUNI,         /* 15 \X (extended Unicode sequence */  OP_EODN,           /* 16 End of data or \n at end of data: \Z. */  OP_EOD,            /* 17 End of data: \z */  OP_OPT,            /* 18 Set runtime options */  OP_CIRC,           /* 19 Start of line - varies with multiline switch */  OP_DOLL,           /* 20 End of line - varies with multiline switch */  OP_CHAR,           /* 21 Match one character, casefully */  OP_CHARNC,         /* 22 Match one character, caselessly */  OP_NOT,            /* 23 Match anything but the following char */  OP_STAR,           /* 24 The maximizing and minimizing versions of */  OP_MINSTAR,        /* 25 all these opcodes must come in pairs, with */  OP_PLUS,           /* 26 the minimizing one second. */  OP_MINPLUS,        /* 27 This first set applies to single characters */  OP_QUERY,          /* 28 */  OP_MINQUERY,       /* 29 */  OP_UPTO,           /* 30 From 0 to n matches */  OP_MINUPTO,        /* 31 */  OP_EXACT,          /* 32 Exactly n matches */  OP_NOTSTAR,        /* 33 The maximizing and minimizing versions of */  OP_NOTMINSTAR,     /* 34 all these opcodes must come in pairs, with */  OP_NOTPLUS,        /* 35 the minimizing one second. */  OP_NOTMINPLUS,     /* 36 This set applies to "not" single characters */  OP_NOTQUERY,       /* 37 */  OP_NOTMINQUERY,    /* 38 */  OP_NOTUPTO,        /* 39 From 0 to n matches */  OP_NOTMINUPTO,     /* 40 */  OP_NOTEXACT,       /* 41 Exactly n matches */  OP_TYPESTAR,       /* 42 The maximizing and minimizing versions of */  OP_TYPEMINSTAR,    /* 43 all these opcodes must come in pairs, with */  OP_TYPEPLUS,       /* 44 the minimizing one second. These codes must */  OP_TYPEMINPLUS,    /* 45 be in exactly the same order as those above. */  OP_TYPEQUERY,      /* 46 This set applies to character types such as \d */  OP_TYPEMINQUERY,   /* 47 */  OP_TYPEUPTO,       /* 48 From 0 to n matches */  OP_TYPEMINUPTO,    /* 49 */  OP_TYPEEXACT,      /* 50 Exactly n matches */  OP_CRSTAR,         /* 51 The maximizing and minimizing versions of */  OP_CRMINSTAR,      /* 52 all these opcodes must come in pairs, with */  OP_CRPLUS,         /* 53 the minimizing one second. These codes must */  OP_CRMINPLUS,      /* 54 be in exactly the same order as those above. */  OP_CRQUERY,        /* 55 These are for character classes and back refs */  OP_CRMINQUERY,     /* 56 */  OP_CRRANGE,        /* 57 These are different to the three sets above. */  OP_CRMINRANGE,     /* 58 */  OP_CLASS,          /* 59 Match a character class, chars < 256 only */  OP_NCLASS,         /* 60 Same, but the bitmap was created from a negative                           class - the difference is relevant only when a UTF-8                           character > 255 is encountered. */  OP_XCLASS,         /* 61 Extended class for handling UTF-8 chars within the                           class. This does both positive and negative. */  OP_REF,            /* 62 Match a back reference */  OP_RECURSE,        /* 63 Match a numbered subpattern (possibly recursive) */  OP_CALLOUT,        /* 64 Call out to external function if provided */  OP_ALT,            /* 65 Start of alternation */  OP_KET,            /* 66 End of group that doesn't have an unbounded repeat */  OP_KETRMAX,        /* 67 These two must remain together and in this */  OP_KETRMIN,        /* 68 order. They are for groups the repeat for ever. */  /* The assertions must come before ONCE and COND */  OP_ASSERT,         /* 69 Positive lookahead */  OP_ASSERT_NOT,     /* 70 Negative lookahead */  OP_ASSERTBACK,     /* 71 Positive lookbehind */  OP_ASSERTBACK_NOT, /* 72 Negative lookbehind */  OP_REVERSE,        /* 73 Move pointer back - used in lookbehind assertions */  /* ONCE and COND must come after the assertions, with ONCE first, as there's  a test for >= ONCE for a subpattern that isn't an assertion. */  OP_ONCE,           /* 74 Once matched, don't back up into the subpattern */  OP_COND,           /* 75 Conditional group */  OP_CREF,           /* 76 Used to hold an extraction string number (cond ref) */  OP_BRAZERO,        /* 77 These two must remain together and in this */  OP_BRAMINZERO,     /* 78 order. */  OP_BRANUMBER,      /* 79 Used for extracting brackets whose number is greater                           than can fit into an opcode. */  OP_BRA             /* 80 This and greater values are used for brackets that                           extract substrings up to EXTRACT_BASIC_MAX. After                           that, use is made of OP_BRANUMBER. */};/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c andstudy.c that all opcodes are less than 128 in value. This makes handling UTF-8character sequences easier. *//* The highest extraction number before we have to start using additionalbytes. (Originally PCRE didn't have support for extraction counts highter than

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -