1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
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. --
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. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Types
; use Types
;
36 -- This package contains data and subprograms to support the feature that
37 -- recognizes the letter case styles used in the source program being
38 -- compiled, and uses this information for error message formatting, and
39 -- for recognizing reserved words that are misused as identifiers.
41 -------------------------------
42 -- Case Control Declarations --
43 -------------------------------
45 -- Declaration of type for describing casing convention
50 -- All letters are upper case
53 -- All letters are lower case
56 -- The initial letter, and any letters after underlines are upper case.
57 -- All other letters are lower case
60 -- Used if an identifier does not distinguish between the above cases,
61 -- (e.g. X, Y_3, M4, A_B, or if it is inconsistent ABC_def).
64 subtype Known_Casing
is Casing_Type
range All_Upper_Case
.. Mixed_Case
;
65 -- Exclude Unknown casing
67 ------------------------------
68 -- Case Control Subprograms --
69 ------------------------------
71 procedure Set_Casing
(C
: Casing_Type
; D
: Casing_Type
:= Mixed_Case
);
72 -- Takes the name stored in the first Name_Len positions of Name_Buffer
73 -- and modifies it to be consistent with the casing given by C, or if
74 -- C = Unknown, then with the casing given by D. The name is basically
75 -- treated as an identifier, except that special separator characters
76 -- other than underline are permitted and treated like underlines (this
77 -- handles cases like minus and period in unit names, apostrophes in error
78 -- messages, angle brackets in names like <any_type>, etc).
80 procedure Set_All_Upper_Case
;
81 pragma Inline
(Set_All_Upper_Case
);
82 -- This procedure is called with an identifier name stored in Name_Buffer.
83 -- On return, the identifier is converted to all upper case. The call is
84 -- equivalent to Set_Casing (All_Upper_Case).
86 function Determine_Casing
(Ident
: Text_Buffer
) return Casing_Type
;
87 -- Determines the casing of the identifier/keyword string Ident