PageRenderTime 28ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 1ms

/js/src/yarr/pcre/pcre_tables.cpp

http://github.com/zpao/v8monkey
C++ | 71 lines | 11 code | 10 blank | 50 comment | 0 complexity | bce8b328d9f62a125cf5de7af6972686 MD5 | raw file
 1/* This is JavaScriptCore's variant of the PCRE library. While this library
 2started out as a copy of PCRE, many of the features of PCRE have been
 3removed. This library now supports only the regular expression features
 4required by the JavaScript language specification, and has only the functions
 5needed by JavaScriptCore and the rest of WebKit.
 6
 7                 Originally written by Philip Hazel
 8           Copyright (c) 1997-2006 University of Cambridge
 9    Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
10
11-----------------------------------------------------------------------------
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14
15    * Redistributions of source code must retain the above copyright notice,
16      this list of conditions and the following disclaimer.
17
18    * Redistributions in binary form must reproduce the above copyright
19      notice, this list of conditions and the following disclaimer in the
20      documentation and/or other materials provided with the distribution.
21
22    * Neither the name of the University of Cambridge nor the names of its
23      contributors may be used to endorse or promote products derived from
24      this software without specific prior written permission.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36POSSIBILITY OF SUCH DAMAGE.
37-----------------------------------------------------------------------------
38*/
39
40/* This module contains some fixed tables that are used by more than one of the
41PCRE code modules. */
42
43#include "pcre_internal.h"
44
45/*************************************************
46*           Tables for UTF-8 support             *
47*************************************************/
48
49/* These are the breakpoints for different numbers of bytes in a UTF-8
50character. */
51
52const int jsc_pcre_utf8_table1[6] =
53  { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
54
55/* These are the indicator bits and the mask for the data bits to set in the
56first byte of a character, indexed by the number of additional bytes. */
57
58const int jsc_pcre_utf8_table2[6] = { 0,    0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
59const int jsc_pcre_utf8_table3[6] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
60
61/* Table of the number of extra characters, indexed by the first character
62masked with 0x3f. The highest number for a valid UTF-8 character is in fact
630x3d. */
64
65const unsigned char jsc_pcre_utf8_table4[0x40] = {
66  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
67  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
68  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
69  3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
70
71#include "chartables.c"