Next: , Previous: Packages, Up: Project File Reference


11.7.5 Expressions

An expression is any value that can be assigned to an attribute or a variable. It is either a literal value, or a construct requiring runtime computation by the project manager. In a project file, the computed value of an expression is either a string or a list of strings.

A string value is one of:

A list of strings is one of the following:

The following is the grammar for expressions

     string_literal ::= "{string_element}"  --  Same as Ada
     string_expression ::= string_literal
         | variable_name
         | external_value
         | attribute_reference
         | ( string_expression { & string_expression } )
     string_list  ::= ( string_expression { , string_expression } )
        | string_variable_name
        | string_attribute_reference
     term ::= string_expression | string_list
     expression ::= term { & term }     --  Concatenation

Concatenation involves strings and list of strings. As soon as a list of strings is involved, the result of the concatenation is a list of strings. The following Ada declarations show the existing operators:

       function "&" (X : String;      Y : String)      return String;
       function "&" (X : String_List; Y : String)      return String_List;
       function "&" (X : String_List; Y : String_List) return String_List;

Here are some specific examples:

        List := () & File_Name; --  One string in this list
        List2 := List & (File_Name & ".orig"); -- Two strings
        Big_List := List & Lists2;  --  Three strings
        Illegal := "gnat.adc" & List2;  --  Illegal, must start with list