annotate gcc/ada/csets.ads @ 158:494b0b89df80 default tip

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