2009-10-01 Tobias Burnus <burnus@net-b.de>
[official-gcc/alias-decl.git] / gcc / ada / casing.ads
blob6585a0299e9612bec6ec3ad8cb22c12f9fdc9bc8
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- C A S I N G --
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 ------------------------------------------------------------------------------
32 with Types; use Types;
34 package Casing is
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
47 type Casing_Type is (
49 All_Upper_Case,
50 -- All letters are upper case
52 All_Lower_Case,
53 -- All letters are lower case
55 Mixed_Case,
56 -- The initial letter, and any letters after underlines are upper case.
57 -- All other letters are lower case
59 Unknown
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 ------------------------------
65 -- Case Control Subprograms --
66 ------------------------------
68 procedure Set_Casing (C : Casing_Type; D : Casing_Type := Mixed_Case);
69 -- Takes the name stored in the first Name_Len positions of Name_Buffer
70 -- and modifies it to be consistent with the casing given by C, or if
71 -- C = Unknown, then with the casing given by D. The name is basically
72 -- treated as an identifier, except that special separator characters
73 -- other than underline are permitted and treated like underlines (this
74 -- handles cases like minus and period in unit names, apostrophes in error
75 -- messages, angle brackets in names like <any_type>, etc).
77 procedure Set_All_Upper_Case;
78 pragma Inline (Set_All_Upper_Case);
79 -- This procedure is called with an identifier name stored in Name_Buffer.
80 -- On return, the identifier is converted to all upper case. The call is
81 -- equivalent to Set_Casing (All_Upper_Case).
83 function Determine_Casing (Ident : Text_Buffer) return Casing_Type;
84 -- Determines the casing of the identifier/keyword string Ident
86 end Casing;