Daily bump.
[official-gcc.git] / gcc / ada / scng.ads
blobabcf3dad19376abae03c40ecba7ac8b26d106ce9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S C N G --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2007, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- This package contains a generic lexical analyzer. This is used
27 -- for scanning Ada source files or text files with an Ada-like syntax,
28 -- such as project files. It is instantiated in Scn and Prj.Err.
30 with Casing; use Casing;
31 with Styleg;
32 with Types; use Types;
34 generic
35 with procedure Post_Scan;
36 -- Procedure called by Scan for the following tokens:
37 -- Tok_Char_Literal, Tok_Identifier, Tok_Real_Literal, Tok_Real_Literal,
38 -- Tok_Integer_Literal, Tok_String_Literal, Tok_Operator_Symbol.
40 with procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
41 -- Output a message at specified location
43 with procedure Error_Msg_S (Msg : String);
44 -- Output a message at current scan pointer location
46 with procedure Error_Msg_SC (Msg : String);
47 -- Output a message at the start of the current token
49 with procedure Error_Msg_SP (Msg : String);
50 -- Output a message at the start of the previous token
52 with procedure Obsolescent_Check (S : Source_Ptr);
53 -- Called when one of the obsolescent character replacements is
54 -- used with S pointing to the character in question.
56 with package Style is new Styleg
57 (Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP);
58 -- Instantiation of Styleg with the same error reporting routines
60 package Scng is
62 procedure Initialize_Scanner (Index : Source_File_Index);
63 -- Initialize lexical scanner for scanning a new file referenced by Index.
64 -- Initialize_Scanner does not call Scan.
66 procedure Scan;
67 -- Scan scans out the next token, and advances the scan state accordingly
68 -- (see package Scan_State for details). If the scan encounters an illegal
69 -- token, then an error message is issued pointing to the bad character,
70 -- and Scan returns a reasonable substitute token of some kind.
71 -- For tokens Char_Literal, Identifier, Real_Literal, Integer_Literal,
72 -- String_Literal and Operator_Symbol, Post_Scan is called after scanning.
74 function Determine_Token_Casing return Casing_Type;
75 pragma Inline (Determine_Token_Casing);
76 -- Determines the casing style of the current token, which is
77 -- either a keyword or an identifier. See also package Casing.
79 procedure Set_Special_Character (C : Character);
80 -- Indicate that one of the following character '#', '$', '?', '@', '`',
81 -- '\', '^', '_' or '~', when found is a Special token.
83 procedure Reset_Special_Characters;
84 -- Indicate that there is no characters that are Special tokens., which
85 -- is the default.
87 procedure Set_End_Of_Line_As_Token (Value : Boolean);
88 -- Indicate if End_Of_Line is a token or not.
89 -- By default, End_Of_Line is not a token.
91 procedure Set_Comment_As_Token (Value : Boolean);
92 -- Indicate if a comment is a token or not.
93 -- By default, a comment is not a token.
95 function Set_Start_Column return Column_Number;
96 -- This routine is called with Scan_Ptr pointing to the first character
97 -- of a line. On exit, Scan_Ptr is advanced to the first non-blank
98 -- character of this line (or to the terminating format effector if the
99 -- line contains no non-blank characters), and the returned result is the
100 -- column number of this non-blank character (zero origin), which is the
101 -- value to be stored in the Start_Column scan variable.
103 end Scng;