]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/scn.ads
[Ada] Bump copyright year
[thirdparty/gcc.git] / gcc / ada / scn.ads
CommitLineData
996ae0b0
RK
1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- S C N --
6-- --
7-- S p e c --
8-- --
4b490c1e 9-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
996ae0b0
RK
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- --
b5c84c3c 13-- ware Foundation; either version 3, or (at your option) any later ver- --
996ae0b0
RK
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 --
b5c84c3c
RD
18-- Public License distributed with GNAT; see file COPYING3. If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license. --
996ae0b0
RK
20-- --
21-- GNAT was originally developed by the GNAT team at New York University. --
71ff80dc 22-- Extensive contributions were provided by Ada Core Technologies Inc. --
996ae0b0
RK
23-- --
24------------------------------------------------------------------------------
25
fbf5a39b
AC
26-- This package contains the lexical analyzer routines. This is used by the
27-- compiler for scanning Ada source files.
996ae0b0
RK
28
29with Casing; use Casing;
fbf5a39b
AC
30with Errout; use Errout;
31with Scng;
851e9f19 32with Style; -- use Style;
996ae0b0
RK
33with Types; use Types;
34
35package Scn is
36
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
0f96fd14
BD
42 -- Unit and Index references the corresponding source file. A special case
43 -- is when Unit = No_Unit, and Index corresponds to the source index for
44 -- reading the configuration pragma file.
996ae0b0 45
fbf5a39b 46 function Determine_Token_Casing return Casing_Type;
8f1fe1f8
AC
47 -- Determines the casing style of the current token, which is either a
48 -- keyword or an identifier. See also package Casing.
996ae0b0 49
fbf5a39b 50 procedure Post_Scan;
fbf5a39b
AC
51 -- Create nodes for tokens: Char_Literal, Identifier, Real_Literal,
52 -- Integer_Literal, String_Literal and Operator_Symbol.
996ae0b0
RK
53
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.
61
fbf5a39b
AC
62 -------------
63 -- Scanner --
64 -------------
65
66 -- The scanner used by the compiler is an instantiation of the
67 -- generic package Scng with routines appropriate to the compiler
68
69 package Scanner is new Scng
c90b2058
AC
70 (Post_Scan => Post_Scan,
71 Error_Msg => Error_Msg,
72 Error_Msg_S => Error_Msg_S,
73 Error_Msg_SC => Error_Msg_SC,
74 Error_Msg_SP => Error_Msg_SP,
75 Style => Style.Style_Inst);
fbf5a39b
AC
76
77 procedure Scan renames Scanner.Scan;
78 -- Scan scans out the next token, and advances the scan state accordingly
79 -- (see package Scans for details). If the scan encounters an illegal
80 -- token, then an error message is issued pointing to the bad character,
81 -- and Scan returns a reasonable substitute token of some kind.
996ae0b0
RK
82
83end Scn;