1------------------------------------------------------------------------------ 2-- -- 3-- GNAT COMPILER COMPONENTS -- 4-- -- 5-- P R J . S T R T -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2001-2003 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 2, 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 COPYING. If not, write -- 19-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- 20-- MA 02111-1307, USA. -- 21-- -- 22-- GNAT was originally developed by the GNAT team at New York University. -- 23-- Extensive contributions were provided by Ada Core Technologies Inc. -- 24-- -- 25------------------------------------------------------------------------------ 26 27-- This package implements parsing of string expressions in project files. 28 29with Prj.Tree; use Prj.Tree; 30 31private package Prj.Strt is 32 33 procedure Parse_String_Type_List (First_String : out Project_Node_Id); 34 -- Get the list of literal strings that are allowed for a typed string. 35 -- On entry, the current token is the first literal string following 36 -- a left parenthesis in a string type declaration such as: 37 -- type Toto is ("string_1", "string_2", "string_3"); 38 -- On exit, the current token is the right parenthesis. 39 -- The parameter First_String is a node that contained the first 40 -- literal string of the string type, linked with the following 41 -- literal strings. 42 -- 43 -- Report an error if 44 -- - a literal string is not found at the beginning of the list 45 -- or after a comma 46 -- - two literal strings in the list are equal 47 48 procedure Start_New_Case_Construction (String_Type : Project_Node_Id); 49 -- This procedure is called at the beginning of a case construction 50 -- The parameter String_Type is the node for the string type 51 -- of the case label variable. 52 -- The different literal strings of the string type are stored 53 -- into a table to be checked against the case labels of the 54 -- case construction. 55 56 procedure End_Case_Construction; 57 -- This procedure is called at the end of a case construction 58 -- to remove the case labels and to restore the previous state. 59 -- In particular, in the case of nested case constructions, 60 -- the case labels of the enclosing case construction are restored. 61 62 procedure Parse_Choice_List 63 (First_Choice : out Project_Node_Id); 64 -- Get the label for a choice list. 65 -- Report an error if 66 -- - a case label is not a literal string 67 -- - a case label is not in the typed string list 68 -- - the same case label is repeated in the same case construction 69 70 procedure Parse_Expression 71 (Expression : out Project_Node_Id; 72 Current_Project : Project_Node_Id; 73 Current_Package : Project_Node_Id); 74 -- Parse a simple string expression or a string list expression. 75 -- Current_Project is the node of the project file being parsed. 76 -- Current_Package is the node of the package being parsed, 77 -- or Empty_Node when we are at the project level (not in a package). 78 -- On exit, Expression is the node of the expression that has 79 -- been parsed. 80 81 procedure Parse_Variable_Reference 82 (Variable : out Project_Node_Id; 83 Current_Project : Project_Node_Id; 84 Current_Package : Project_Node_Id); 85 -- Parse a variable or attribute reference. 86 -- Used internally (in expressions) and for case variables (in Prj.Dect). 87 -- Current_Package is the node of the package being parsed, 88 -- or Empty_Node when we are at the project level (not in a package). 89 -- On exit, Variable is the node of the variable or attribute reference. 90 -- A variable reference is made of one to three simple names. 91 -- An attribute reference is made of one or two simple names, 92 -- followed by an apostroph, followed by the attribute simple name. 93 94end Prj.Strt; 95