Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / ada / scn.ads
blobd2a80f1bfa0bc6462b2a25190542d0d327938c59
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S C N --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2004 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package contains the lexical analyzer routines. This is used by the
28 -- compiler for scanning Ada source files.
30 with Casing; use Casing;
31 with Errout; use Errout;
32 with Scng;
33 with Style; use Style;
34 with Types; use Types;
36 package Scn is
38 procedure Initialize_Scanner
39 (Unit : Unit_Number_Type;
40 Index : Source_File_Index);
41 -- Initialize lexical scanner for scanning a new file. The caller has
42 -- completed the construction of the Units.Table entry for the specified
43 -- Unit and Index references the corresponding source file. A special
44 -- case is when Unit = No_Unit_Number, and Index corresponds to the
45 -- source index for reading the configuration pragma file.
47 function Determine_Token_Casing return Casing_Type;
48 -- Determines the casing style of the current token, which is
49 -- either a keyword or an identifier. See also package Casing.
51 procedure Obsolescent_Check (S : Source_Ptr);
52 -- Called to handle pragma restrictions check for usage of obsolescent
53 -- character replacements during the scan.
55 procedure Post_Scan;
56 pragma Inline (Post_Scan);
57 -- Create nodes for tokens: Char_Literal, Identifier, Real_Literal,
58 -- Integer_Literal, String_Literal and Operator_Symbol.
60 procedure Scan_Reserved_Identifier (Force_Msg : Boolean);
61 -- This procedure is called to convert the current token, which the caller
62 -- has checked is for a reserved word, to an equivalent identifier. This is
63 -- of course only used in error situations where the parser can detect that
64 -- a reserved word is being used as an identifier. An appropriate error
65 -- message, pointing to the token, is also issued if either this is the
66 -- first occurrence of misuse of this identifier, or if Force_Msg is True.
68 -------------
69 -- Scanner --
70 -------------
72 -- The scanner used by the compiler is an instantiation of the
73 -- generic package Scng with routines appropriate to the compiler
75 package Scanner is new Scng
76 (Post_Scan => Post_Scan,
77 Error_Msg => Error_Msg,
78 Error_Msg_S => Error_Msg_S,
79 Error_Msg_SC => Error_Msg_SC,
80 Error_Msg_SP => Error_Msg_SP,
81 Obsolescent_Check => Obsolescent_Check,
82 Style => Style.Style_Inst);
84 procedure Scan renames Scanner.Scan;
85 -- Scan scans out the next token, and advances the scan state accordingly
86 -- (see package Scans for details). If the scan encounters an illegal
87 -- token, then an error message is issued pointing to the bad character,
88 -- and Scan returns a reasonable substitute token of some kind.
90 end Scn;