1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2000 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 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. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- This package contains the lexical analyzer routines. This is used both
28 -- for scanning Ada source files and also for scanning Ada project files.
30 with Casing
; use Casing
;
31 with Types
; use Types
;
35 procedure Initialize_Scanner
36 (Unit
: Unit_Number_Type
;
37 Index
: Source_File_Index
);
38 -- Initialize lexical scanner for scanning a new file. The caller has
39 -- completed the construction of the Units.Table entry for the specified
40 -- Unit and Index references the corresponding source file. A special
41 -- case is when Unit = No_Unit_Number, and Index corresponds to the
42 -- source index for reading the configuration pragma file.
45 -- Scan scans out the next token, and advances the scan state accordingly
46 -- (see package Scan_State for details). If the scan encounters an illegal
47 -- token, then an error message is issued pointing to the bad character,
48 -- and Scan returns a reasonable substitute token of some kind.
50 function Scan_First_Char
return Source_Ptr
;
51 -- This routine returns the position in Source of the first non-blank
52 -- character on the current line, used for certain error recovery actions.
54 procedure Scan_Reserved_Identifier
(Force_Msg
: Boolean);
55 -- This procedure is called to convert the current token, which the caller
56 -- has checked is for a reserved word, to an equivalent identifier. This is
57 -- of course only used in error situations where the parser can detect that
58 -- a reserved word is being used as an identifier. An appropriate error
59 -- message, pointing to the token, is also issued if either this is the
60 -- first occurrence of misuse of this identifier, or if Force_Msg is True.
62 function Determine_Token_Casing
return Casing_Type
;
63 pragma Inline
(Determine_Token_Casing
);
64 -- Determines the casing style of the current token, which is
65 -- either a keyword or an identifier. See also package Casing.