00001 /* This is JavaScriptCore's variant of the PCRE library. While this library 00002 started out as a copy of PCRE, many of the features of PCRE have been 00003 removed. This library now supports only the regular expression features 00004 required by the JavaScript language specification, and has only the functions 00005 needed by JavaScriptCore and the rest of WebKit. 00006 00007 Originally written by Philip Hazel 00008 Copyright (c) 1997-2006 University of Cambridge 00009 Copyright (C) 2002, 2004, 2006, 2007 Apple Inc. All rights reserved. 00010 00011 ----------------------------------------------------------------------------- 00012 Redistribution and use in source and binary forms, with or without 00013 modification, are permitted provided that the following conditions are met: 00014 00015 * Redistributions of source code must retain the above copyright notice, 00016 this list of conditions and the following disclaimer. 00017 00018 * Redistributions in binary form must reproduce the above copyright 00019 notice, this list of conditions and the following disclaimer in the 00020 documentation and/or other materials provided with the distribution. 00021 00022 * Neither the name of the University of Cambridge nor the names of its 00023 contributors may be used to endorse or promote products derived from 00024 this software without specific prior written permission. 00025 00026 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 POSSIBILITY OF SUCH DAMAGE. 00037 ----------------------------------------------------------------------------- 00038 */ 00039 00040 /* This module contains some fixed tables that are used by more than one of the 00041 PCRE code modules. */ 00042 00043 #include "pcre_internal.h" 00044 00045 /************************************************* 00046 * Tables for UTF-8 support * 00047 *************************************************/ 00048 00049 /* These are the breakpoints for different numbers of bytes in a UTF-8 00050 character. */ 00051 00052 const int kjs_pcre_utf8_table1[6] = 00053 { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff}; 00054 00055 /* These are the indicator bits and the mask for the data bits to set in the 00056 first byte of a character, indexed by the number of additional bytes. */ 00057 00058 const int kjs_pcre_utf8_table2[6] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; 00059 const int kjs_pcre_utf8_table3[6] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01}; 00060 00061 /* Table of the number of extra characters, indexed by the first character 00062 masked with 0x3f. The highest number for a valid UTF-8 character is in fact 00063 0x3d. */ 00064 00065 const unsigned char kjs_pcre_utf8_table4[0x40] = { 00066 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 00067 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 00068 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 00069 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; 00070 00071 #include "pcre_chartables.c"