Remove unused character flag ctype_meta, no longer used.

This commit is contained in:
Philip.Hazel 2018-08-19 15:44:06 +00:00
parent 6e6bb40a3d
commit 91715304cb
4 changed files with 24 additions and 22 deletions

View File

@ -165,6 +165,9 @@ negative class with no characters less than 0x100 followed by a positive class
with only characters less than 0x100, the first class was incorrectly being
auto-possessified, causing incorrect match failures.
36. Removed the character type bit ctype_meta, which dates from PCRE1 and is
not used in PCRE2.
Version 10.31 12-February-2018
------------------------------

View File

@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016 University of Cambridge
New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@ -104,6 +104,14 @@ fprintf(f,
"tables are passed to PCRE2 by the application that calls it. The tables\n"
"are used only for characters whose code values are less than 256. */\n\n");
fprintf(f,
"/*The dftables program (which is distributed with PCRE2) can be used to\n"
"build alternative versions of this file. This is necessary if you are\n"
"running in an EBCDIC environment, or if you want to default to a different\n"
"encoding, for example ISO-8859-1. When dftables is run, it creates these\n"
"tables in the current locale. This happens automatically if PCRE2 is\n"
"configured with --enable-rebuild-chartables. */\n\n");
/* Force config.h in z/OS */
#if defined NATIVE_ZOS
@ -115,7 +123,7 @@ fprintf(f,
#endif
fprintf(f,
"/* The following #includes are present because without them gcc 4.x may remove\n"
"/* The following #include is present because without it gcc 4.x may remove\n"
"the array definition from the final binary if PCRE2 is built into a static\n"
"library and dead code stripping is activated. This leads to link errors.\n"
"Pulling in the header ensures that the array gets flagged as \"someone\n"
@ -153,11 +161,10 @@ for (i = 0; i < 256; i++)
fprintf(f, ",\n\n");
fprintf(f,
"/* This table contains bit maps for various character classes.\n"
"Each map is 32 bytes long and the bits run from the least\n"
"significant end of each byte. The classes that have their own\n"
"maps are: space, xdigit, digit, upper, lower, word, graph\n"
"print, punct, and cntrl. Other classes are built from combinations. */\n\n");
"/* This table contains bit maps for various character classes. Each map is 32\n"
"bytes long and the bits run from the least significant end of each byte. The\n"
"classes that have their own maps are: space, xdigit, digit, upper, lower, word,\n"
"graph print, punct, and cntrl. Other classes are built from combinations. */\n\n");
fprintf(f, " ");
for (i = 0; i < cbit_length; i++)
@ -178,10 +185,8 @@ fprintf(f,
" 0x%02x letter\n"
" 0x%02x decimal digit\n"
" 0x%02x hexadecimal digit\n"
" 0x%02x alphanumeric or '_'\n"
" 0x%02x regular expression metacharacter or binary zero\n*/\n\n",
ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word,
ctype_meta);
" 0x%02x alphanumeric or '_'\n*/\n\n",
ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word);
fprintf(f, " ");
for (i = 0; i < 256; i++)

View File

@ -565,14 +565,15 @@ these tables. */
#define cbit_cntrl 288 /* [:cntrl:] */
#define cbit_length 320 /* Length of the cbits table */
/* Bit definitions for entries in the ctypes table. */
/* Bit definitions for entries in the ctypes table. Do not change these values
without checking pcre2_jit_compile.c, which has an assertion to ensure that
ctype_word has the value 16. */
#define ctype_space 0x01
#define ctype_letter 0x02
#define ctype_digit 0x04
#define ctype_xdigit 0x08
#define ctype_xdigit 0x08 /* not actually used any more */
#define ctype_word 0x10 /* alphanumeric or '_' */
#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
/* Offsets of the various tables from the base tables pointer, and
total length of the tables. */

View File

@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016 University of Cambridge
New API code Copyright (c) 2016-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@ -141,13 +141,6 @@ for (i = 0; i < 256; i++)
if (isdigit(i)) x += ctype_digit;
if (isxdigit(i)) x += ctype_xdigit;
if (isalnum(i) || i == '_') x += ctype_word;
/* Note: strchr includes the terminating zero in the characters it considers.
In this instance, that is ok because we want binary zero to be flagged as a
meta-character, which in this sense is any character that terminates a run
of data characters. */
if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta;
*p++ = x;
}