111
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT COMPILER COMPONENTS --
|
|
4 -- --
|
|
5 -- P P R I N T --
|
|
6 -- --
|
|
7 -- S p e c --
|
|
8 -- --
|
131
|
9 -- Copyright (C) 2008-2018, Free Software Foundation, Inc. --
|
111
|
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 (pretty print) contains a routine for printing an expression
|
|
27 -- given its node in the syntax tree. Contrarily to the Sprint package, this
|
|
28 -- routine tries to obtain "pretty" output that can be used for e.g. error
|
|
29 -- messages.
|
|
30
|
|
31 with Types; use Types;
|
|
32 with Urealp; use Urealp;
|
|
33
|
|
34 package Pprint is
|
|
35
|
|
36 generic
|
|
37
|
|
38 -- ??? The generic parameters should be removed.
|
|
39
|
|
40 with function Real_Image (U : Ureal) return String;
|
|
41 with function String_Image (S : String_Id) return String;
|
|
42 with function Ident_Image (Expr : Node_Id;
|
|
43 Orig_Expr : Node_Id;
|
|
44 Expand_Type : Boolean) return String;
|
|
45 -- Will be called for printing N_Identifier and N_Defining_Identifier
|
|
46 -- nodes
|
|
47 -- ??? Expand_Type argument should be removed
|
|
48
|
|
49 Hide_Parameter_Blocks : Boolean := False;
|
|
50 -- If true, then "Parameter_Block.Field_Name.all" is
|
|
51 -- instead displayed as "Field_Name".
|
|
52
|
|
53 Hide_Temp_Derefs : Boolean := False;
|
|
54 -- If true, then "Foo.all" is instead displayed as "Foo"
|
|
55 -- in the case where Foo is a compiler-generated constant
|
|
56 -- initialized to Some_Captured_Value'Reference.
|
|
57
|
|
58 function Expression_Image
|
|
59 (Expr : Node_Id;
|
|
60 Default : String) return String;
|
|
61 -- Given a Node for an expression, return a String that is meaningful for
|
|
62 -- the programmer. If the expression comes from source, it is copied from
|
|
63 -- there.
|
|
64 -- Subexpressions outside of the maximum depth (3), the maximal number of
|
|
65 -- accepted nodes (24), and the maximal number of list elements (3), are
|
|
66 -- replaced by the default string.
|
|
67
|
|
68 end Pprint;
|