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

Subversion Repositories openrisc

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

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 F N _ S C A N                              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 2000-2008, 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 provides a stand alone capability for scanning a gnat.adc
27
--  file for Source_File_Name pragmas. This is for use in tools other than
28
--  the compiler, which want to scan source file name pragmas without the
29
--  overhead of the full compiler scanner and parser.
30
 
31
--  Note that neither the package spec, nor the package body, of this
32
--  unit contains any with statements at all. This is a completely
33
--  independent package, suitable for incorporation into tools that do
34
--  not access any other units in the GNAT compiler or tools sources.
35
 
36
--  This package is NOT task safe, so multiple tasks that may call the
37
--  Scan_SFN_Pragmas procedure at the same time are responsible for
38
--  avoiding such multiple calls by appropriate synchronization.
39
 
40
package SFN_Scan is
41
 
42
   --  The call to SFN_Scan passes pointers to two procedures that are
43
   --  used to store the results of scanning any Source_File_Name pragmas
44
   --  that are encountered. The following access types define the form
45
   --  of these procedures:
46
 
47
   type Set_File_Name_Ptr is access
48
     procedure
49
       (Typ   : Character;
50
        U     : String;
51
        F     : String;
52
        Index : Natural);
53
   --  The procedure with this profile is called when a Source_File_Name
54
   --  pragma of the form having a unit name parameter. Typ is 'b' for
55
   --  a body file name, and 's' for a spec file name. U is a string that
56
   --  contains the unit name, exactly as it appeared in the source file,
57
   --  and F is the file taken from the second parameter. Index is taken
58
   --  from the third parameter, or is set to zero if no third parameter.
59
 
60
   type Set_File_Name_Pattern_Ptr is access
61
     procedure (Pat : String; Typ : Character; Dot : String; Cas : Character);
62
   --  This is called to process a Source_File_Name pragma whose first
63
   --  argument is a file pattern. Pat is this pattern string, which
64
   --  contains an asterisk to correspond to the unit. Typ is one of
65
   --  ('b'/'s'/'u') for body/spec/subunit, Dot is the separator string
66
   --  for child/subunit names (default is "."), and Cas is one of
67
   --  ('l'/'u'/'m') indicating the required case for the file name.
68
   --  The default setting for Cas is 'l' if no parameter is present.
69
 
70
   Cursor : Natural;
71
   --  Used to record the cursor value if a syntax error is found
72
 
73
   Syntax_Error_In_GNAT_ADC : exception;
74
   --  Exception raised if a syntax error is found
75
 
76
   procedure Scan_SFN_Pragmas
77
     (Source   : String;
78
      SFN_Ptr  : Set_File_Name_Ptr;
79
      SFNP_Ptr : Set_File_Name_Pattern_Ptr);
80
   --  This is the procedure called to scan a gnat.adc file. The Source
81
   --  parameter points to the full text of the file, with normal line end
82
   --  characters, in the format normally read by the compiler. The two
83
   --  parameters SFN_Ptr and SFNP_Ptr point to procedures that will be
84
   --  called to register Source_File_Name pragmas as they are found.
85
   --
86
   --  If a syntax error is found, then Syntax_Error_In_GNAT_ADC is raised,
87
   --  and the location SFN_Scan.Cursor contains the approximate index of
88
   --  the error in the source string.
89
   --
90
   --  The scan assumes that it is dealing with a valid gnat.adc file,
91
   --  that includes only pragmas and comments. It does not do a full
92
   --  syntax correctness scan by any means, but if it does find anything
93
   --  that it can tell is wrong it will immediately raise the exception
94
   --  to indicate the approximate location of the error
95
 
96
end SFN_Scan;

powered by: WebSVN 2.1.0

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