1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- C S E T S --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
12 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
13 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
15 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
16 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
17 |
|
|
-- --
|
18 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
21 |
|
|
-- --
|
22 |
|
|
-- You should have received a copy of the GNU General Public License and --
|
23 |
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
24 |
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
25 |
|
|
-- <http://www.gnu.org/licenses/>. --
|
26 |
|
|
-- --
|
27 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
package Csets is
|
33 |
|
|
pragma Elaborate_Body;
|
34 |
|
|
|
35 |
|
|
-- This package contains character tables for the various character
|
36 |
|
|
-- sets that are supported for source representation. Character and
|
37 |
|
|
-- string literals are not affected, only identifiers. For each set,
|
38 |
|
|
-- the table in this package gives the mapping of letters to their
|
39 |
|
|
-- upper case equivalent. Each table thus provides the information
|
40 |
|
|
-- for building the table used to fold lower case to upper case, and
|
41 |
|
|
-- also the table of flags showing which characters are allowed in
|
42 |
|
|
-- identifiers.
|
43 |
|
|
|
44 |
|
|
type Translate_Table is array (Character) of Character;
|
45 |
|
|
-- Type used to describe translate tables
|
46 |
|
|
|
47 |
|
|
type Char_Array_Flags is array (Character) of Boolean;
|
48 |
|
|
-- Type used for character attribute arrays. Note that we deliberately
|
49 |
|
|
-- do NOT pack this table, since we don't want the extra overhead of
|
50 |
|
|
-- accessing a packed bit string.
|
51 |
|
|
|
52 |
|
|
----------------------------------------------
|
53 |
|
|
-- Character Tables For Current Compilation --
|
54 |
|
|
----------------------------------------------
|
55 |
|
|
|
56 |
|
|
procedure Initialize;
|
57 |
|
|
-- Routine to initialize following character tables, whose content depends
|
58 |
|
|
-- on the character code being used to represent the source program. In
|
59 |
|
|
-- particular, the use of the upper half of the 8-bit code set varies.
|
60 |
|
|
-- The character set in use is specified by the value stored in
|
61 |
|
|
-- Opt.Identifier_Character_Set, which has the following settings:
|
62 |
|
|
|
63 |
|
|
-- '1' Latin-1 (ISO-8859-1)
|
64 |
|
|
-- '2' Latin-2 (ISO-8859-2)
|
65 |
|
|
-- '3' Latin-3 (ISO-8859-3)
|
66 |
|
|
-- '4' Latin-4 (ISO-8859-4)
|
67 |
|
|
-- '5' Latin-5 (ISO-8859-5, Cyrillic)
|
68 |
|
|
-- 'p' IBM PC (code page 437)
|
69 |
|
|
-- '8' IBM PC (code page 850)
|
70 |
|
|
-- '9' Latin-9 (ISO-9959-9)
|
71 |
|
|
-- 'f' Full upper set (all distinct)
|
72 |
|
|
-- 'n' No upper characters (Ada/83 rules)
|
73 |
|
|
-- 'w' Latin-1 plus wide characters also allowed
|
74 |
|
|
|
75 |
|
|
function Is_Upper_Case_Letter (C : Character) return Boolean;
|
76 |
|
|
pragma Inline (Is_Upper_Case_Letter);
|
77 |
|
|
-- Determine if character is upper case letter
|
78 |
|
|
|
79 |
|
|
function Is_Lower_Case_Letter (C : Character) return Boolean;
|
80 |
|
|
pragma Inline (Is_Lower_Case_Letter);
|
81 |
|
|
-- Determine if character is lower case letter
|
82 |
|
|
|
83 |
|
|
Fold_Upper : Translate_Table;
|
84 |
|
|
-- Table to fold lower case identifier letters to upper case
|
85 |
|
|
|
86 |
|
|
Fold_Lower : Translate_Table;
|
87 |
|
|
-- Table to fold upper case identifier letters to lower case
|
88 |
|
|
|
89 |
|
|
Identifier_Char : Char_Array_Flags;
|
90 |
|
|
-- This table has True entries for all characters that can legally appear
|
91 |
|
|
-- in identifiers, including digits, the underline character, all letters
|
92 |
|
|
-- including upper and lower case and extended letters (as controlled by
|
93 |
|
|
-- the setting of Opt.Identifier_Character_Set, left bracket for brackets
|
94 |
|
|
-- notation wide characters and also ESC if wide characters are permitted
|
95 |
|
|
-- in identifiers using escape sequences starting with ESC.
|
96 |
|
|
|
97 |
|
|
end Csets;
|