1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 -- This package contains the lexical analyzer routines. This is used both
30 -- for scanning Ada source files and also for scanning Ada project files.
32 with Casing
; use Casing
;
33 with Types
; use Types
;
37 procedure Initialize_Scanner
38 (Unit
: Unit_Number_Type
;
39 Index
: Source_File_Index
);
40 -- Initialize lexical scanner for scanning a new file. The caller has
41 -- completed the construction of the Units.Table entry for the specified
42 -- Unit and Index references the corresponding source file. A special
43 -- case is when Unit = No_Unit_Number, and Index corresponds to the
44 -- source index for reading the configuration pragma file.
47 -- Scan scans out the next token, and advances the scan state accordingly
48 -- (see package Scan_State for details). If the scan encounters an illegal
49 -- token, then an error message is issued pointing to the bad character,
50 -- and Scan returns a reasonable substitute token of some kind.
52 function Scan_First_Char
return Source_Ptr
;
53 -- This routine returns the position in Source of the first non-blank
54 -- character on the current line, used for certain error recovery actions.
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.
64 function Determine_Token_Casing
return Casing_Type
;
65 pragma Inline
(Determine_Token_Casing
);
66 -- Determines the casing style of the current token, which is
67 -- either a keyword or an identifier. See also package Casing.