]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/scn.ads
2003-10-21 Arnaud Charlet <charlet@act-europe.fr>
[thirdparty/gcc.git] / gcc / ada / scn.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S C N --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2002 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 ------------------------------------------------------------------------------
26
27 -- This package contains the lexical analyzer routines. This is used by the
28 -- compiler for scanning Ada source files.
29
30 with Casing; use Casing;
31 with Errout; use Errout;
32 with Scng;
33 with Style; use Style;
34 with Types; use Types;
35
36 package Scn is
37
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.
46
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.
50
51 procedure Post_Scan;
52 pragma Inline (Post_Scan);
53 -- Create nodes for tokens: Char_Literal, Identifier, Real_Literal,
54 -- Integer_Literal, String_Literal and Operator_Symbol.
55
56 procedure Scan_Reserved_Identifier (Force_Msg : Boolean);
57 -- This procedure is called to convert the current token, which the caller
58 -- has checked is for a reserved word, to an equivalent identifier. This is
59 -- of course only used in error situations where the parser can detect that
60 -- a reserved word is being used as an identifier. An appropriate error
61 -- message, pointing to the token, is also issued if either this is the
62 -- first occurrence of misuse of this identifier, or if Force_Msg is True.
63
64 -------------
65 -- Scanner --
66 -------------
67
68 -- The scanner used by the compiler is an instantiation of the
69 -- generic package Scng with routines appropriate to the compiler
70
71 package Scanner is new Scng
72 (Post_Scan => Post_Scan,
73 Error_Msg => Error_Msg,
74 Error_Msg_S => Error_Msg_S,
75 Error_Msg_SC => Error_Msg_SC,
76 Error_Msg_SP => Error_Msg_SP,
77 Style => Style.Style_Inst);
78
79 procedure Scan renames Scanner.Scan;
80 -- Scan scans out the next token, and advances the scan state accordingly
81 -- (see package Scans for details). If the scan encounters an illegal
82 -- token, then an error message is issued pointing to the bad character,
83 -- and Scan returns a reasonable substitute token of some kind.
84
85 end Scn;