OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [scng.ads] - Blame information for rev 744

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                                 S C N G                                  --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2010, 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
------------------------------------------------------------------------------
25
 
26
--  This package contains a generic lexical analyzer. This is used for scanning
27
--  Ada source files or text files with an Ada-like syntax, such as project
28
--  files. It is instantiated in Scn and Prj.Err.
29
 
30
with Casing; use Casing;
31
with Styleg;
32
with Types;  use Types;
33
 
34
generic
35
   with procedure Post_Scan;
36
   --  Procedure called by Scan for the following tokens: Tok_Char_Literal,
37
   --  Tok_Identifier, Tok_Real_Literal, Tok_Real_Literal, Tok_Integer_Literal,
38
   --  Tok_String_Literal, Tok_Operator_Symbol, and Tok_Vertical_Bar. Used to
39
   --  build Token_Node and also check for obsolescent features.
40
 
41
   with procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
42
   --  Output a message at specified location
43
 
44
   with procedure Error_Msg_S (Msg : String);
45
   --  Output a message at current scan pointer location
46
 
47
   with procedure Error_Msg_SC (Msg : String);
48
   --  Output a message at the start of the current token
49
 
50
   with procedure Error_Msg_SP (Msg : String);
51
   --  Output a message at the start of the previous token
52
 
53
   with package Style is new Styleg
54
     (Error_Msg, Error_Msg_S, Error_Msg_SC, Error_Msg_SP);
55
   --  Instantiation of Styleg with the same error reporting routines
56
 
57
package Scng is
58
 
59
   procedure Initialize_Scanner (Index : Source_File_Index);
60
   --  Initialize lexical scanner for scanning a new file referenced by Index.
61
   --  Initialize_Scanner does not call Scan.
62
 
63
   procedure Scan;
64
   --  Scan scans out the next token, and advances the scan state accordingly
65
   --  (see package Scan_State for details). If the scan encounters an illegal
66
   --  token, then an error message is issued pointing to the bad character,
67
   --  and Scan returns a reasonable substitute token of some kind.
68
   --  For tokens Char_Literal, Identifier, Real_Literal, Integer_Literal,
69
   --  String_Literal and Operator_Symbol, Post_Scan is called after scanning.
70
 
71
   function Determine_Token_Casing return Casing_Type;
72
   pragma Inline (Determine_Token_Casing);
73
   --  Determines the casing style of the current token, which is
74
   --  either a keyword or an identifier. See also package Casing.
75
 
76
   procedure Set_Special_Character (C : Character);
77
   --  Indicate that one of the following character '#', '$', '?', '@', '`',
78
   --  '\', '^', '_' or '~', when found is a Special token.
79
 
80
   procedure Reset_Special_Characters;
81
   --  Indicate that there is no characters that are Special tokens., which
82
   --  is the default.
83
 
84
   procedure Set_End_Of_Line_As_Token (Value : Boolean);
85
   --  Indicate if End_Of_Line is a token or not.
86
   --  By default, End_Of_Line is not a token.
87
 
88
   procedure Set_Comment_As_Token (Value : Boolean);
89
   --  Indicate if a comment is a token or not.
90
   --  By default, a comment is not a token.
91
 
92
   function Set_Start_Column return Column_Number;
93
   --  This routine is called with Scan_Ptr pointing to the first character
94
   --  of a line. On exit, Scan_Ptr is advanced to the first non-blank
95
   --  character of this line (or to the terminating format effector if the
96
   --  line contains no non-blank characters), and the returned result is the
97
   --  column number of this non-blank character (zero origin), which is the
98
   --  value to be stored in the Start_Column scan variable.
99
 
100
end Scng;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.