xref: /netbsd/external/bsd/nvi/dist/regex/cclass.h (revision 08d478e3)
1*08d478e3Schristos /*	$NetBSD: cclass.h,v 1.2 2013/11/22 15:52:06 christos Exp $ */
23a571abcSchristos /*-
33a571abcSchristos  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
43a571abcSchristos  * Copyright (c) 1992, 1993, 1994
53a571abcSchristos  *	The Regents of the University of California.  All rights reserved.
63a571abcSchristos  *
73a571abcSchristos  * This code is derived from software contributed to Berkeley by
83a571abcSchristos  * Henry Spencer of the University of Toronto.
93a571abcSchristos  *
103a571abcSchristos  * Redistribution and use in source and binary forms, with or without
113a571abcSchristos  * modification, are permitted provided that the following conditions
123a571abcSchristos  * are met:
133a571abcSchristos  * 1. Redistributions of source code must retain the above copyright
143a571abcSchristos  *    notice, this list of conditions and the following disclaimer.
153a571abcSchristos  * 2. Redistributions in binary form must reproduce the above copyright
163a571abcSchristos  *    notice, this list of conditions and the following disclaimer in the
173a571abcSchristos  *    documentation and/or other materials provided with the distribution.
183a571abcSchristos  * 3. All advertising materials mentioning features or use of this software
193a571abcSchristos  *    must display the following acknowledgement:
203a571abcSchristos  *	This product includes software developed by the University of
213a571abcSchristos  *	California, Berkeley and its contributors.
223a571abcSchristos  * 4. Neither the name of the University nor the names of its contributors
233a571abcSchristos  *    may be used to endorse or promote products derived from this software
243a571abcSchristos  *    without specific prior written permission.
253a571abcSchristos  *
263a571abcSchristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
273a571abcSchristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
283a571abcSchristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
293a571abcSchristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
303a571abcSchristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
313a571abcSchristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
323a571abcSchristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
333a571abcSchristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
343a571abcSchristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
353a571abcSchristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
363a571abcSchristos  * SUCH DAMAGE.
373a571abcSchristos  *
383a571abcSchristos  *	@(#)cclass.h	8.2 (Berkeley) 3/16/94
393a571abcSchristos  */
403a571abcSchristos 
413a571abcSchristos RCHAR_T ALNUM[] = {'a','l','n','u','m',0};
423a571abcSchristos RCHAR_T ALPHA[] = {'a','l','p','h','a',0};
433a571abcSchristos RCHAR_T BLANK[] = {'b','l','a','n','k',0};
443a571abcSchristos RCHAR_T CNTRL[] = {'c','n','t','r','l',0};
453a571abcSchristos RCHAR_T DIGIT[] = {'d','i','g','i','t',0};
463a571abcSchristos RCHAR_T GRAPH[] = {'g','r','a','p','h',0};
473a571abcSchristos RCHAR_T LOWER[] = {'l','o','w','e','r',0};
483a571abcSchristos RCHAR_T PRINT[] = {'p','r','i','n','t',0};
493a571abcSchristos RCHAR_T PUNCT[] = {'p','u','n','c','t',0};
503a571abcSchristos RCHAR_T SPACE[] = {'s','p','a','c','e',0};
513a571abcSchristos RCHAR_T UPPER[] = {'u','p','p','e','r',0};
523a571abcSchristos RCHAR_T XDIGIT[] = {'x','d','i','g','i','t',0};
533a571abcSchristos 
543a571abcSchristos /* character-class table */
553a571abcSchristos static struct cclass {
563a571abcSchristos 	RCHAR_T *name;
57*08d478e3Schristos 	const char *chars;
58*08d478e3Schristos 	const char *multis;
593a571abcSchristos } cclasses[] = {
60*08d478e3Schristos 	{ ALNUM,	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
61*08d478e3Schristos 0123456789",				"" },
62*08d478e3Schristos 	{ ALPHA,	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
63*08d478e3Schristos 					"" },
64*08d478e3Schristos 	{ BLANK,	" \t",		"" },
65*08d478e3Schristos 	{ CNTRL,	"\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
66*08d478e3Schristos \25\26\27\30\31\32\33\34\35\36\37\177",	"" },
67*08d478e3Schristos 	{ DIGIT,	"0123456789",	"" },
68*08d478e3Schristos 	{ GRAPH,	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
693a571abcSchristos 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
70*08d478e3Schristos 					"" },
71*08d478e3Schristos 	{ LOWER,	"abcdefghijklmnopqrstuvwxyz",
72*08d478e3Schristos 					"" },
73*08d478e3Schristos 	{ PRINT,	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
743a571abcSchristos 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
75*08d478e3Schristos 					"" },
76*08d478e3Schristos 	{ PUNCT,	"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
77*08d478e3Schristos 					"" },
78*08d478e3Schristos 	{ SPACE,	"\t\n\v\f\r ",	"" },
79*08d478e3Schristos 	{ UPPER,	"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
80*08d478e3Schristos 					"" },
81*08d478e3Schristos 	{ XDIGIT,	"0123456789ABCDEFabcdef",
82*08d478e3Schristos 					"" },
83*08d478e3Schristos 	{ NULL,		0,		"" },
843a571abcSchristos };
85