📄 pcre_internal.h
字号:
/* * =========================================================================== * PRODUCTION $Log: pcre_internal.h,v $ * PRODUCTION Revision 1000.0 2003/10/29 15:56:04 gouriano * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.2 * PRODUCTION * =========================================================================== *//************************************************** Perl-Compatible Regular Expressions **************************************************//* This is a library of functions to support regular expressions whose syntaxand semantics are as close as possible to those of the Perl 5 language. Seethe file Tech.Notes for some information on the internals.Written by: Philip Hazel <ph10@cam.ac.uk> Copyright (c) 1997-2001 University of Cambridge-----------------------------------------------------------------------------Permission is granted to anyone to use this software for any purpose on anycomputer system, and to redistribute it freely, subject to the followingrestrictions:1. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.2. The origin of this software must not be misrepresented, either by explicit claim or by omission.3. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.4. If PCRE is embedded in any software that is released under the GNU General Purpose Licence (GPL), then the terms of that licence shall supersede any condition above with which it is incompatible.-----------------------------------------------------------------------------*//* This header contains definitions that are shared between the differentmodules, but which are not relevant to the outside. */#include "pcre_config.h"/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPYis set. Otherwise, include an emulating function for those systems that haveneither (there some non-Unix environments where this is the case). This assumesthat all calls to memmove are moving strings upwards in store, which is thecase in PCRE. */#if ! HAVE_MEMMOVE# undef memmove /* some systems may have a macro */# if HAVE_BCOPY# define memmove(a, b, c) bcopy(b, a, c)# elsevoid *pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n){ int i; dest += n; src += n; for (i = 0; i < n; ++i) *(--dest) = *(--src);}# define memmove(a, b, c) pcre_memmove(a, b, c)# endif#endif/* Standard C headers plus the external interface definition */#include <ctype.h>#include <limits.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <util/regexp/pcre.h>/* 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, though now that we have expandedto four bytes there is plenty of space. */#define PCRE_FIRSTSET 0x40000000 /* first_char is set */#define PCRE_REQCHSET 0x20000000 /* req_char is set */#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */#define PCRE_INGROUP 0x08000000 /* compiling inside a group */#define PCRE_ICHANGED 0x04000000 /* i option changes within 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 which 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)#define PUBLIC_EXEC_OPTIONS \ (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY)#define PUBLIC_STUDY_OPTIONS 0 /* None defined *//* Magic number to provide a small check against being handed junk. */#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' *//* 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#ifndef ESC_T# define ESC_T '\t'#endif/* 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. The final one must be ESC_REF as subsequentvalues are used for \1, \2, \3, etc. There is a test in the code for an escapegreater than ESC_b and less than ESC_Z to detect the types that may berepeated. If any new escapes are put in-between that don't consume a character,that code will have to change. */enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w, ESC_Z, ESC_z, 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. */enum { OP_END, /* End of pattern */ /* Values corresponding to backslashed metacharacters */ OP_SOD, /* Start of data: \A */ OP_NOT_WORD_BOUNDARY, /* \B */ OP_WORD_BOUNDARY, /* \b */ OP_NOT_DIGIT, /* \D */ OP_DIGIT, /* \d */ OP_NOT_WHITESPACE, /* \S */ OP_WHITESPACE, /* \s */ OP_NOT_WORDCHAR, /* \W */ OP_WORDCHAR, /* \w */ OP_EODN, /* End of data or \n at end of data: \Z. */ OP_EOD, /* End of data: \z */ OP_OPT, /* Set runtime options */ OP_CIRC, /* Start of line - varies with multiline switch */ OP_DOLL, /* End of line - varies with multiline switch */ OP_ANY, /* Match any character */ OP_CHARS, /* Match string of characters */ OP_NOT, /* Match anything but the following char */ OP_STAR, /* The maximizing and minimizing versions of */ OP_MINSTAR, /* all these opcodes must come in pairs, with */ OP_PLUS, /* the minimizing one second. */ OP_MINPLUS, /* This first set applies to single characters */ OP_QUERY, OP_MINQUERY, OP_UPTO, /* From 0 to n matches */ OP_MINUPTO, OP_EXACT, /* Exactly n matches */ OP_NOTSTAR, /* The maximizing and minimizing versions of */ OP_NOTMINSTAR, /* all these opcodes must come in pairs, with */ OP_NOTPLUS, /* the minimizing one second. */ OP_NOTMINPLUS, /* This first set applies to "not" single characters */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -