1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
37 pragma Elaborate_Body (Csets);
39 -- This package contains character tables for the various character
40 -- sets that are supported for source representation. Character and
41 -- string literals are not affected, only identifiers. For each set,
42 -- the table in this package gives the mapping of letters to their
43 -- upper case equivalent. Each table thus provides the information
44 -- for building the table used to fold lower case to upper case, and
45 -- also the table of flags showing which characters are allowed in
48 type Translate_Table is array (Character) of Character;
49 -- Type used to describe translate tables
51 type Char_Array_Flags is array (Character) of Boolean;
52 -- Type used for character attribute arrays. Note that we deliberately
53 -- do NOT pack this table, since we don't want the extra overhead of
54 -- accessing a packed bit string.
56 -----------------------------------------------
57 -- Character Tables For Current Compilation --
58 -----------------------------------------------
61 -- Routine to initialize following character tables, whose content depends
62 -- on the character code being used to represent the source program. In
63 -- particular, the use of the upper half of the 8-bit code set varies.
64 -- The character set in use is specified by the value stored in
65 -- Opt.Identifier_Character_Set, which has the following settings:
71 -- '5' Latin-5 (Cyrillic ISO-8859-5)
72 -- 'p' IBM PC (code page 437)
73 -- '8' IBM PC (code page 850)
74 -- 'f' Full upper set (all distinct)
75 -- 'n' No upper characters (Ada/83 rules)
76 -- 'w' Latin-1 plus wide characters also allowed
78 function Is_Upper_Case_Letter (C : Character) return Boolean;
79 pragma Inline (Is_Upper_Case_Letter);
80 -- Determine if character is upper case letter
82 function Is_Lower_Case_Letter (C : Character) return Boolean;
83 pragma Inline (Is_Lower_Case_Letter);
84 -- Determine if character is lower case letter
86 Fold_Upper : Translate_Table;
87 -- Table to fold lower case identifier letters to upper case
89 Fold_Lower : Translate_Table;
90 -- Table to fold upper case identifier letters to lower case
92 Identifier_Char : Char_Array_Flags;
93 -- This table has True entries for all characters that can legally appear
94 -- in identifiers, including digits, the underline character, all letters
95 -- including upper and lower case and extended letters (as controlled by
96 -- the setting of Opt.Identifier_Character_Set, left bracket for brackets
97 -- notation wide characters and also ESC if wide characters are permitted
98 -- in identifiers using escape sequences starting with ESC.