1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 2001 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This package implements parsing of string expressions in project files.
30 with Prj
.Tree
; use Prj
.Tree
;
32 private package Prj
.Strt
is
34 procedure Parse_String_Type_List
(First_String
: out Project_Node_Id
);
35 -- Get the list of literal strings that are allowed for a typed string.
36 -- On entry, the current token is the first literal string following
37 -- a left parenthesis in a string type declaration such as:
38 -- type Toto is ("string_1", "string_2", "string_3");
39 -- On exit, the current token is the right parenthesis.
40 -- The parameter First_String is a node that contained the first
41 -- literal string of the string type, linked with the following
45 -- - a literal string is not found at the beginning of the list
47 -- - two literal strings in the list are equal
49 procedure Start_New_Case_Construction
(String_Type
: Project_Node_Id
);
50 -- This procedure is called at the beginning of a case construction
51 -- The parameter String_Type is the node for the string type
52 -- of the case label variable.
53 -- The different literal strings of the string type are stored
54 -- into a table to be checked against the case labels of the
57 procedure End_Case_Construction
;
58 -- This procedure is called at the end of a case construction
59 -- to remove the case labels and to restore the previous state.
60 -- In particular, in the case of nested case constructions,
61 -- the case labels of the enclosing case construction are restored.
63 procedure Parse_Choice_List
64 (First_Choice
: out Project_Node_Id
);
65 -- Get the label for a choice list.
67 -- - a case label is not a literal string
68 -- - a case label is not in the typed string list
69 -- - the same case label is repeated in the same case construction
71 procedure Parse_Expression
72 (Expression
: out Project_Node_Id
;
73 Current_Project
: Project_Node_Id
;
74 Current_Package
: Project_Node_Id
);
75 -- Parse a simple string expression or a string list expression.
76 -- Current_Project is the node of the project file being parsed.
77 -- Current_Package is the node of the package being parsed,
78 -- or Empty_Node when we are at the project level (not in a package).
79 -- On exit, Expression is the node of the expression that has
82 procedure Parse_Variable_Reference
83 (Variable
: out Project_Node_Id
;
84 Current_Project
: Project_Node_Id
;
85 Current_Package
: Project_Node_Id
);
86 -- Parse a variable or attribute reference.
87 -- Used internally (in expressions) and for case variables (in Prj.Dect).
88 -- Current_Package is the node of the package being parsed,
89 -- or Empty_Node when we are at the project level (not in a package).
90 -- On exit, Variable is the node of the variable or attribute reference.
91 -- A variable reference is made of one to three simple names.
92 -- An attribute reference is made of one or two simple names,
93 -- followed by an apostroph, followed by the attribute simple name.