![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Ada LRM to ASIS Mapping This appendix describes Ada syntax rules in terms of:
- The ASIS subprograms required to analyze a particular rule
- The kinds of ASIS elements and other types that appear during the analysis
The LRM uses a simple variant of Backus-Naur Form (BNF) to describe the Ada language. Each construct in the language is defined in terms of a BNF syntax rule. Each rule, is in turn, composed of syntactic categories, reserved words, and so on.
This appendix presents a mapping between the Ada syntax rules and ASIS. The mapping is accomplished by taking an Ada syntax rule and replacing the syntactic categories with ASIS function names. Each function name is then described, showing the data types (typically elements) returned.
The descriptions are presented in another BNF variant, referred to as "ASIS Syntax Notation." The notation is described below.
The following topics are covered in this chapter:
- Key Concepts
- 2. Lexical Elements
- 3. Declarations and Types
- 4. Names and Expressions
- 5. Statements
- 6. Subprograms
- 7. Packages
- 8. Visibility Rules
- 9. Tasks
- 10. Program Structure and Compilation Issues
- 11. Exceptions
- 12. Generic Units
- 13. Representation Clauses and Implementation-Dependent Features
Key ConceptsASIS Syntax Notation
The concepts behind the ASIS syntax notation are similar to those used by Ada, as described in Ada83 LRM 1.5, Ada95 LRM 1.1.4. You should be generally familiar with that notation before proceeding.
Syntax Rules
The rules used by the ASIS syntax notation are:
Special Syntax Rules
- Square brackets
If a syntactic category is optional in the Ada syntax, it is typically shown as optional in the ASIS syntax. If it is not shown as optional, the syntax rule has been changed. See "ASIS Syntax Category Changes" for more information.
In many cases, ASIS provides a function returning a Boolean value indicating whether the syntactic category appeared in the source code. If this is not the case, a Nil_Element (or Nil_Element_List) is returned.
- Braces
If Ada describes a repeating syntactic category, the function name replaces all instances and will similarly be enclosed in braces.
- Vertical bar
If a vertical bar appears in the Ada syntax, it also appears in the ASIS syntax unless the Ada syntax was divided into multiple ASIS syntax entries. See "ASIS Syntax Category Changes" for more information.
Statement Forms
ASIS syntax notation contains two statement forms:
(element_kind [{, element_sub-kind}]) ::= substituted_ada_bnf function_name [(list_range)] ::= (element_kind [{, element_sub-kind}]) | type
The syntactic categories are described as follows:
- element_kind
Indicates an element with the specified Element_Kind. Element kinds are enclosed in parentheses to distinguish them from function names.
In some cases an appropriate element kind is not available because ASIS decomposes the category differently than the LRM. If this is the case, the syntactic category name remains and the decomposition strategy is described in another rule or in text.
- element_sub-kind
Indicates the sub-kind, and possibly sub-sub-kind, of an element.
- substituted_ada_bnf
An Ada syntax rule where the syntactic categories have been replaced with ASIS function names.
In some cases, ASIS decomposes the syntax rule in such a way that an appropriate function does not exist. In this case, the syntactic category is not replaced, and the appropriate decomposition strategy is described in another rule or in text.
- function_name
- list_range
This syntactic category only appears if the function_name returns a list. If a list is returned, this represents the range of subscript values. This range can be:
- 0..N: Indicating the list might be nil
- 1..N: Indicating the list always includes at least one value
- 1..1: Indicating that a list is returned, but it always contains a single value
- type
The type of data returned. For example, string, boolean or an ASIS kinds (Element_Kinds, Declaration_Kinds, and so on).
Ada Syntax to ASIS Syntax Correlation
Often there is not a one-for-one correlation between an Ada syntax rule and an ASIS syntax rule. Two kinds of differences exist:
- The ASIS syntax describes syntactic categories slightly differently than Ada
- The ASIS syntax contains additional entries that provide returned data type information
ASIS Syntax Category Changes
ASIS sometimes identifies syntactic categories differently than Ada. This has been done to simplify or clarify the interfaces. No information is lost by these transformations; ASIS provides sufficient interfaces such that you can always obtain the information required to uniquely identify a syntactic category in terms of the Ada syntax.
For example, pragma argument-associations are defined by the following Ada syntax:
ASIS uses the following syntax:
(An_Argument_Association) ::= [Formal_Parameter =>] Actual_Parameter
ASIS does not distinguish between an argument association that contains a name and one that contains an expression. You can make this determination however, by examining the kind of the element described by the actual parameter.
In this instance the ASIS syntax rule simplified the Ada syntax rule. In other cases, multiple ASIS syntax rules appear to describe a single Ada syntax rule.
Returned Data Type Definitions
Additional ASIS syntax rules often exist. These rules describe the kinds of data returned by the functions that have been substituted into the Ada syntax rule.
For examples, the LRM describes pragmas as follows:
ASIS describes pragmas as follows:
(A_Pragma) ::= pragma Name [({Argument_Associations})];The component functions are described as follows:
Name ::= string Argument_Associations (0..N) ::= (An_Argument_Association)The descriptions of the component functions indicate the kinds of data returned by the functions substituted into the pragma definition line.
ASIS Syntax Example
To illustrate the ASIS syntax notation, we show how pragmas and their argument associations are described. The LRM syntax rules are presented first, followed by the ASIS syntax rules intermixed with descriptions of their meaning. In the mapping portion of this appendix the rules are not described.
Pragmas
The LRM describes Pragmas as follows:
(Ada83 LRM 2.8, Ada95 LRM 2.8) pragma ::= pragma identifier [(argument_association {, argument_association})];
ASIS describes pragmas as follows:
(A_Pragma) ::= pragma Name [({Argument_Associations})];This statement corresponds to the first form for the language. The text following the "::=" symbol is the Ada syntax rule with the syntactic categories replaced with ASIS function names.
The syntactic categories are described as follows:
- (A_Pragma): The enclosing parenthesis tell you that an element is being described; a pragma is described by an element with an element kinds of A_Pragma
- pragma: A reserved word, as in the Ada syntax rule
- Name: Returns a value that represents the identifier
- Argument_Associations: Returns a value that represents all argument_associations; the braces indicate that a list is returned and the brackets that the category is optional
The ASIS syntax rule for a pragma references the Name and Argument_Associations functions. The following two ASIS syntax rules illustrate what these functions return:
Name ::= string
Argument_Associations (0..N) ::= (An_Argument_Association)These statements corresponds to the second form for the language. The syntactic categories are described as follows:
- Name: Identifies a function used in the ASIS syntax rule
- string: Identifies the Standard.String type
- Argument_Associations: Identifies a function used in the ASIS syntax rule
- (0..N): Indicates that a list containing 0 or more entries can be returned
- (An_Argument_Association): Indicates the element kind returned by the Argument_Associations function
Argument Associations
The LRM describes argument associations as follows:
ASIS describes argument associations as follows:
(An_Argument_Association) ::= [Formal_Parameter =>] Actual_ParameterThe component functions are described as follows:
Formal_Parameter ::= (An_Expression, A_Simple_Name) | (An_Entity_Name_Definition, A_Simple_Name)
Actual_Parameter ::= (An_Expression)
- (An_Argument_Association): An argument association is described by an element with an element kinds of An_Argument_Association
- Formal_Parameter: Identifies a function used in the ASIS syntax rule
- Actual_Parameter: Identifies a function used in the ASIS syntax rule
Ada Syntax to ASIS Mapping
The mapping of the syntax rules is presented in LRM order. Section 1. of the LRM contains no rules and is not described. All other sections that have rules with related ASIS subprograms are described.
Certain syntax rules —— for example, those presented in section 2.1 —— describe syntactic categories below the level of semantic significance to ASIS. Unless other information pertinent to ASIS exists in such a section, the section is omitted.
In each included section that contains a syntax rule, the Ada syntax is presented first, followed by the ASIS syntax. Other useful information is often presented in or after the ASIS syntax. This can include:
- The correlation between Ada syntactic category names and ASIS enumeration values
- Related useful subprograms
2. Lexical ElementsThe following sections from LRM chapter 2, have related functions or concepts in ASIS:
- 2.1 Character Set
- 2.2 Lexical Elements, Separators, and Delimiters
- 2.3 Identifiers
- 2.4 Numeric Literals
- 2.4.1 Decimal Literals
- 2.4.2 Based Literals
- 2.5 Character Literals
- 2.6 String Literals
- 2.7 Comments
- 2.8 Pragmas
- 2.9 Reserved Words
- 2.10 Allowable Replacements of Characters
2.1 Character Set
(Ada83 LRM 2.1, Ada95 LRM 2.1)
This LRM section describes the character set and basic character categories used by Ada. These categories are used to define the lexical elements that comprise the language.
ASIS is not defined in terms of the character set, but rather in terms of lexical elements. Should analysis be required to the level of the character set, ASIS contains functions that return the text image for all explicitly described lexical elements (such as numeric literals), and you can easily construct the text image for implicitly described lexical elements (such as reserved words).
2.2 Lexical Elements, Separators, and Delimiters
(Ada83 LRM 2.2, Ada95 LRM 2.2)
This LRM section describes the text of a program in terms of its lexical elements, separators, and delimiters. Each lexical element is either a delimiter, an identifier (which might be a reserved word), a numeric literal, a character literal, a string literal, or a comment. ASIS describes these lexical elements as follows:
2.3 Identifiers
(Ada83 LRM 2.3, Ada95 LRM 2.3)
In Ada, identifiers are used as names and also as reserved words. The LRM describes identifiers as follows:
(Ada83 LRM 2.3, Ada95 LRM 2.3) identifier ::= letter {[underline] letter_or_digit} letter_or_digit ::= letter | digit letter ::= upper_case_letter | lower_case_letter
ASIS does not explicitly represent reserved words, and thus identifiers represent names only.
ASIS distinguishes between identifiers appearing in two contexts:
- Instances that declare entities
- Instances that refer to previously-declared entities
ASIS describes identifiers in entity definitions as follows:
(An_Entity_Name_Definition, | A_Simple_Name | An_Enumeration_Literal) ::= Name Name ::= stringCharacter literals and operator symbols also have defining instances. These are represented by An_Entity_Name_Definition elements with an expression kinds of A_Character_Literal or An_Operator_Symbol.
ASIS describes references to previously-declared entities as follows:
(An_Expression, | A_Simple_Name | An_Enumeration_Literal) ::= Name
Name ::= string
Character literals and operator symbols can also be referenced. These are represented by An_Expression elements with an expression kinds of A_Character_Literal or An_Operator_Symbol.
To obtain the letter or digit components of an identifier, you must analyze the returned string. ASIS encourages, but does not specify, the case of the returned identifier. An ASIS implementation is free to upshift characters, downshift characters, or return the identifier in the case specified in the source code.
Entity Definitions and References
Identifier names are declared by an A_Declaration element. For example, the following package renames declaration:
package Exp renames Asis.Expressions;
Is represented by an (A_Declaration, A_Package_Rename_Declaration) element.
For each identifier that is declared, an entity name definition is also declared. The entity name definition for package Exp is represented by a (An_Entity_Name_Definition, A_Simple_Name) element.
The An_Entity_Name_Definition element(s) defined by an A_Declaration element can be obtained by passing the A_Declaration element to the Names function.
References to entities, for example to the package name ASIS.Expressions, are represented as An_Expression elements. In this case, the package name has an Expression_Kinds of A_Selected_Component. The prefix and selector of the selected component both have an Expression_Kinds of A_Simple_Name.
References can also take the form of character literals, enumeration literals, and operator symbols.
2.4 Numeric Literals
(Ada83 LRM 2.4, Ada95 LRM 2.4)
The LRM describes numeric literals as follows:
(Ada83 LRM 2.4, Ada95 LRM 2.4) numeric_literal ::= decimal_literal | based_literal
ASIS is not concerned with whether a literal is a decimal or based literal as this distinction is not significant from a semantic perspective. Instead, ASIS describes literals in terms of real literals and integer literals as follows:
(An_Expression, An_Integer_Literal) ::= integer_literal
(An_Expression, A_Real_Literal) ::= real_literal
You can determine whether a numeric literal represents a decimal or based literal by analyzing the text image of the string.
2.4.1 Decimal Literals
(Ada83 LRM 2.4.1, Ada95 LRM 2.4.1)
The LRM describes decimal literals as follows:
(Ada83 LRM 2.4.1, Ada95 LRM 2.4.1) decimal_literal ::= integer [.integer] [exponent]
integer ::= digit {[underline] digit}
exponent ::= E [+] integer | E - integer
ASIS describes decimal literals as follows:
Static_Value ::= string
ASIS returns the entire decimal literal as a string. The representation returned is the same as that used by the programmer and includes all sharps, underlines, dots, exponents, and so on, as entered by the programmer. To obtain the integer or exponent components, you must analyze the returned string.
See "2.4 Numeric Literals" for the element kinds that represent numeric literals.
2.4.2 Based Literals
(Ada83 LRM 2.4.2, Ada95 LRM 2.4.2)
The LRM describes decimal literals as follows:
(Ada83 LRM 2.4.2, Ada95 LRM 2.4.2) based_literal ::= base # based_integer [.based_integer] # [exponent] base ::= integer based_integer ::= extended_digit {[underline] extended_digit} extended_digit ::= digit | letter
ASIS describes based literals as follows:
Static_Value ::= stringASIS returns the entire based literal as a string. The representation returned is the same as that used by the programmer and includes all sharps, underlines, dots, exponents, and so on, as entered by the programmer. To obtain the base, based integer, or exponent components, you must analyze the returned string.
See "2.4 Numeric Literals" for the element kinds that represent numeric literals.
2.5 Character Literals
(Ada83 LRM 2.5, Ada95 LRM 2.5)
The LRM describes characters literals as follows:
(Ada83 LRM 2.5, Ada95 LRM 2.5) character_literal ::= 'graphic_character'
ASIS describes character literals as follows:
(An_Expression, A_Character_Literal) ::= Static_Value
The component function is described as follows:
Static_Value ::= string
The returned literal includes the apostrophes.
2.6 String Literals
(Ada83 LRM 2.6, Ada95 LRM 2.6)
The LRM describes string literals as follows:
(Ada83 LRM 2.6, Ada95 LRM 2.6) string_literal ::= "{graphic_character}"
ASIS describes string literals as follows:
(An_Expression, A_String_Literal) ::= Static_Value
The component function is described as follows:
Static_Value ::= string
The representation returned is the same as that used by the programmer and includes the quotation marks.
2.7 Comments
(Ada83 LRM 2.7, Ada95 LRM 2.7)
Comments from compilation units are available when Is_Commentary_Supported returns True.
Comments can be obtained by calling:
- Lines to obtain a text image of one or more lines of a compilation. The image can be scanned to determine whether the lines contain comments.
- Comment_Image to obtain the text image of any comment appearing on a particular line of a compilation. If an image is returned, it includes the double hyphens (--) that begin the comment.
2.8 Pragmas
(Ada83 LRM 2.8, Ada95 LRM 2.8)
The LRM describes pragmas as follows:
(Ada83 LRM 2.8, Ada95 LRM 2.8) pragma ::= pragma identifier [(argument_association {, argument_association})];
ASIS describes pragmas as follows:
(A_Pragma) ::= pragma Name [({Argument_Associations})];
The component functions are describes as follows:
Name ::= string Argument_Associations (0..N) ::= (An_Argument_Association)
ASIS describes argument associations as follows:
(An_Argument_Association) ::= [Formal_Parameter =>] Actual_Parameter
The component functions are described as follows:
Formal_Parameter ::= (An_Expression, A_Simple_Name) | (An_Entity_Name_Definition, A_Simple_Name) Actual_Parameter ::= (An_Expression)
Pragmas are available from the following functions:
2.9 Reserved Words
(Ada83 LRM 2.9, Ada95 LRM 2.9)
ASIS does not directly represent Ada's reserved words. The Image function should, however, return whatever characters appeared in the source code including:
- All keywords that form part of the element
- All compound delimiters that form part of the element
- Any terminating semicolon
- Any white space and comments that are within the span of the element
The case and spacing of characters in the returned text image should be identical to how they appeared in the source code.
See package Text for more information on obtaining the text images of an element.
Note: Whether the actual source code definition is returned in implementation-dependent. Rational Apex returns the values as they appeared in the source code.
2.10 Allowable Replacements of Characters
ASIS does not directly represent replacement characters. The Image and Static_Value functions should, however, return whatever characters appeared in the source code.
Note: Whether the actual source code definition is returned in implementation-dependent. Rational Apex returns the values as they appeared in the source code.
3. Declarations and TypesThe following sections from LRM chapter 3 have related functions or concepts in ASIS:
- 3.1 Declarations
- 3.2 Objects and Named Numbers
- 3.3 Types and Subtypes
- 3.4 Derived Types
- 3.5 Scalar Types
- 3.6 Array Types
- 3.7 Record Types
- 3.8 Access Types
- 3.9 Declarative Parts
3.1 Declarations
There are several forms of declaration. A basic declaration is described as follows:
(Ada83 LRM 3.1, Ada95 LRM 3.1) basic_declaration ::= object_declaration | number_declaration | type_declaration | subtype_declaration | subprogram_declaration | package_declaration | task_declaration | generic_declaration | exception_declaration | generic_instantiation | renaming_declaration | deferred_constant_declaration
ASIS describes declarations in terms of elements with an element kind of A_Declaration and a sub-kind of Declarations_Kind.
ASIS often provides more detail on a declaration than indicated by the above syntax rule. The relationships between the Ada basic declarations and the ASIS declaration kinds are shown in the following table:
The Declaration_Kinds enumeration contains additional values for items that represent implicit declarations (such as discriminant specification) or declarations that are a part of the above definitions (such as entry declarations and generic formal objects).
3.2 Objects and Named Numbers
(Ada83 LRM 3.2, Ada95 LRM 3.3)
The LRM describes objects and named numbers as follows:
(Ada83 LRM 3.2, Ada95 LRM 3.3) object_declaration ::= identifier_list : [constant] subtype_indication [:= expression];ASIS describes variable object-declarations, including the identifier list, as follows:
(A_Declaration, A_Variable_Declaration) ::= {Names} : Object_Declaration_Definition [:= Initial_Value];
ASIS describes constant object-declarations, including the identifier list, as follows:
(A_Declaration, A_Constant_Declaration) ::= {Names} : constant Object_Declaration_Definition := Initial_Value;
Deferred constants are discussed in "7.4 Private Types and Deferred Constant Declarations."
ASIS describes number declarations as follows:
(A_Declaration, An_Integer_Number_Declaration) ::= {Names} : constant := Initial_Value;
(A_Declaration, A_Real_Number_Declaration) ::= {Names} : constant := Initial_Value
The component functions of object and named-number declarations are described as follows:
Names (1..N) ::= (An_Entity_Name_Definition)
Object_Declaration_Definition ::= (A_Type_Definition)
Initial_Value ::= (An_Expression)
3.3 Types and Subtypes
The following LRM sections have related functions or concepts in ASIS:
- "3.3.1 Type Declarations"
- "3.3.2 Subtype Declarations"
- "3.3.3 Classification of Operations"
3.3.1 Type Declarations
(Ada83 LRM 3.3.1, Ada95 LRM 3.2.1)
The LRM describes type declarations as follows:
(Ada83 LRM 3.3.1, Ada95 LRM 3.2.1) type_declaration ::= full_type_declaration | incomplete_type_declaration | private_type_declaration
ASIS describes type declarations as follows:
type_declaration ::= (A_Declaration, A_Full_Type_Declaration) | (A_Declaration, An_Incomplete_Type_Declaration) | (A_Declaration, A_Private_Type_Declaration)
ASIS describes full type declarations as follows:
(A_Declaration, A_Full_Type_Declaration) ::= type Names [Discriminants] is Type_Declaration_Definition;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Type_Declaration_Definition ::= (A_Type_Definition) Discriminants ::= (A_Declaration, A_Discriminant_Specification)
ASIS describes type definitions in terms of elements with an element kind of A_Type_Definition and a sub-kind of Type_Definition_Kinds.
ASIS often provides more detail on a type definition than indicated by the above Ada syntax rule. The relationships between the Ada type definitions and the ASIS type definition kinds are shown in the following table:
The Type_Definition_Kinds enumeration contains additional values for items that represent task types, private and limited private type, generic formal types, and universal types.
3.3.2 Subtype Declarations
(Ada83 LRM 3.3.2, Ada95 LRM 3.2.2)
The LRM describes subtype declarations as follows:
(Ada83 LRM 3.3.2, Ada95 LRM 3.2.2) subtype_declaration ::= subtype identifier is subtype_indication;
ASIS describes subtype declarations as follows:
(A_Declaration, A_Subtype_Declaration) ::= subtype Names is Type_Declaration_Definition;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Type_Declaration_Definition ::= (A_Type_Definition, A_Subtype_Definition)
Subtype definition is not an LRM term; it is used by ASIS to differentiate between subtype declarations and subtype indications. Subtype declarations declare subtypes and ASIS creates an associated subtype definition for these declarations. Subtype indications appear as components of several other type definition kinds and have no associated subtype definitions.
In the context of a subtype definition, subtype declarations can also be described as follows:
(A_Declaration, A_Subtype_Declaration) ::= subtype Names is Subtype_Definition_Subtype_- Indication;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Subtype_Definition_Subtype_Indication ::= (A_Subtype_Indication)ASIS describes subtype indications, including the type mark and constraint as follows:
(A_Subtype_Indication) ::= Type_Mark [Subtype_Constraint]
The component functions are described as follows:
Type_Mark ::= (An_Expression)
Subtype_Constraint ::= (A_Constraint)
ASIS describes constraints in terms of elements with an element kind of A_Constraint and a sub-kind of Constraint_Kinds.
ASIS provides more detail on a range constraint than indicated by the above Ada syntax rule.The relationships between the constraints and the ASIS constraint kinds are shown in the following table:
3.3.3 Classification of Operations
(Ada83 LRM 3.3.3, Ada95 LRM 3.2.3)
ASIS provides functions that return the operations (operators and attribute functions) related to a type definition:
3.4 Derived Types
(Ada83 LRM 3.4, Ada95 LRM 3.4)
The LRM describes derived type definitions as follows:
(Ada83 LRM 3.4, Ada95 LRM 3.4) derived_type_definition ::= new subtype_indication
ASIS describes derived type definitions as follows:
(A_Type_Definition, A_Derived_Type_Definition) ::= new Parent_Subtype
The component function is described as follows:
Parent_Subtype ::= (A_Subtype_Indication)
Function Returns
Parent_Type Returns the parent type of the specified derived type definition
3.5 Scalar Types
(Ada83 LRM 3.5, Ada95 LRM 3.5)
The LRM describes range constraints as follows:
(Ada83 LRM 3.5, Ada95 LRM 3.5) range_constraint ::= range range range ::= range_attribute | simple_expression .. simple_expression
ASIS describes range constraints as follows:
(A_Constraint) ::= range range;
The element kinds for ranges are defined as follows:
range ::= (A_Constraint, A_Range_Attribute) | range (A_Constraint, A_Simple_Range)
ASIS describes ranges as follows:
range ::= Range_Attribute | range Lower_Bound..Upper_Bound
The component functions are described as follows:
Range_Attribute ::= (An_Expression, An_Attribute)
Lower_Bound ::= (An_Expression)
Upper_Bound ::= (An_Expression)
ASIS describes range constraints in terms of elements with an element kind of A_Constraint and a sub-kind of Discrete_Range_Kinds.
The following LRM sections have related functions or concepts in ASIS:
- "3.5.1 Enumeration Types"
- "3.5.2 Character Types"
- "3.5.3 Boolean Types"
- "3.5.4 Integer Types"
- "3.5.5 Operations of Discrete Types"
- "3.5.6 Real Types"
- "3.5.7 Floating Point Types"
- "3.5.8 Operations of Floating Point Types"
- "3.5.9 Fixed Point Types"
- "3.5.10 Operations of Fixed Point Types"
3.5.1 Enumeration Types
(Ada83 LRM 3.5.1, Ada95 LRM 3.5.1)
The LRM describes enumeration type definitions as follows:
(Ada83 LRM 3.5.1, Ada95 LRM 3.5.1) enumeration_type_definition ::= (enumeration_literal_specification {, enumeration_literal_specification})
ASIS describes enumeration type definitions as follows:
(A_Type_Definition, An_Enumeration_Type_Definition) ::= ({Enumeration_Literal_Declarations})
The component function is described as follows:
Enumeration_Literal_Declarations (1..N) ::= (A_Declaration, An_Enumeration_Literal_Specification)
Ada represents enumeration literal specifications with a function declaration, described as follows:
enumeration_literal_specification ::= function enumeration_literal return enumeration_type_definition
ASIS describes this as follows:
(A_Declaration, An_Enumeration_Literal_Specification) ::= function Names return Return_Type;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition, An_Enumeration_Literal | A_Character_Literal)
Return_Type ::= (An_Expression, A_Simple_Name)
3.5.2 Character Types
(Ada83 LRM 3.5.2, Ada95 LRM 3.5.2)
The predefined Character type can be found by searching the package Standard.
3.5.3 Boolean Types
(Ada83 LRM 3.5.3, Ada95 LRM 3.5.3)
The predefined Boolean type can be found by searching the package Standard.
3.5.4 Integer Types
(Ada83 LRM 3.5.4, Ada95 LRM 3.5.4)
The LRM describes integer type definitions as follows:
(Aad83 LRM 3.5.4, Ada95 LRM 3.5.4) integer_type_definition ::= range_constraint
ASIS describes integer type definitions as follows:
(A_Type_Definition, An_Integer_Type_Definition) ::= Integer_Constraint
The component function is described as follows:
Integer_Constraint ::= (A_Constraint, A_Range_Attribute | A_Simple_Range)
3.5.5 Operations of Discrete Types
(Ada83 LRM 3.5.5, Ada95 LRM 3.5.5)
The operations listed in LRM 3.5.5 are described by ASIS as follows:
The basic operations also include the attribute 'Width and the attribute functions:
- 'Image
- 'Pos
- 'Pred
- 'Succ
- 'Val
- 'Value
There is no implicit declaration of the attribute 'Width; there are implicit declarations for the attribute functions. Attribute function information is returned from:
- Implicit_Attribute_Functions: Returns a list of the a predefined attribute functions that have been implicitly declared for the specified type definition
- Name_Definition: Returns the first definition of the name indicated by the specified reference
- Name_Declaration: Returns the declaration that declared the specified entity reference
- Attribute_Designator_Kind: Returns the kind of attribute indicated by the specified name
3.5.6 Real Types
(Ada83 LRM 3.5.6, Ada95 LRM 3.5.6)
The LRM describes real type definitions as follows:
(Ada83 LRM 3.5.6 , Ada95 LRM 3.5.6 ) real_type_definition ::= floating_point_constraint | fixed_point_constraint
ASIS describes real type definitions as follows:
(A_Type_Definition, A_Real_Type_Definition) ::= Real_Type_Constraint
(A_Type_Definition, A_Fixed_Type_Definition) ::= Real_Type_Constraint
The component function is described as follows:
Real_Type_Constraint ::= (A_Constraint, A_Fixed_Point_Constraint | A_Floating_Point_Constraint)
3.5.7 Floating Point Types
(Ada83 LRM 3.5.7, Ada95 LRM 3.5.7)
The LRM describes floating point constraints as follows:
(Ada83 LRM 3.5.7, Ada95 LRM 3.5.7) floating_point_constraint ::= floating_accuracy_definition [range_constraint]
ASIS describes floating point, including the accuracy definition, constraints as follows:
(A_Constraint, A_Floating_Point_Constraint) ::= digits Floating_Accuracy_Definition [Floating_Point_Range_Constraint]
The component functions are described as follows:
Floating_Accuracy_Definition ::= (An_Expression) Floating_Point_Range_Constraint ::= (A_Constraint, A_Simple_Range)
3.5.8 Operations of Floating Point Types
(Ada83 LRM 3.5.8, Ada95 LRM 3.5.8)
The operations list in LRM 3.5.8 are described by ASIS as follows:
3.5.9 Fixed Point Types
(Ada83 LRM 3.5.9, Ada95 LRM 3.5.9)
The LRM describes fixed point constraints as follows:
(Ada83 LRM 3.5.9, Ada95 LRM 3.5.9) fixed_point_constraint ::= fixed_accuracy_definition [range_constraint]
ASIS describes fixed point constraints, including the accuracy definition, as follows:
(A_Constraint, A_Fixed_Point_Constraint) ::= delta Fixed_Accuracy_Definition [Fixed_Point_Range_Constraint]
The component functions are described as follows:
Fixed_Accuracy_Definition ::= (An_Expression)
Fixed_Point_Range_Constraint ::= (A_Constraint, A_Simple_Range)
3.5.10 Operations of Fixed Point Types
(Ada83 LRM 3.5.10, Ada95 LRM 3.5.10)
The operations listed in LRM 3.5.10 are described by ASIS as follows:
3.6 Array Types
(Ada83 LRM 3.6, Ada95 LRM 3.6)
The LRM describes array type definitions as follows:
(Ada83 LRM 3.6, Ada95 LRM 3.6) array_type_definition ::= unconstrained_array_definition | constrained_array_definition
ASIS describes constrained array-type definitions as follows:
(A_Type_Definition, An_Array_Type_Definition) ::= array Index_Constraint of Component_Subtype_Indication
The component functions are described as follows:
Index_Constraint ::= (A_Constraint, An_Index_Constraint) Component_Subtype_Indication ::= (A_Subtype_Indication)
ASIS describes unconstrained array-type definitions as follows:
(A_Type_Definition, An_Array_Type_Definition) ::= array ({Index_Subtype_Definitions}) of Component_Subtype_Indication
The component functions are described as follows:
Index_Subtype_Definitions (1..N) ::= (An_Expression) Component_Subtype_Indication ::= (A_Subtype_Indication)
ASIS defines index-subtype definitions as follows:
(An_Expression) ::= Type_Mark range <>
The component function is described as follows:
Type_Mark ::= (An_Expression)
ASIS defines index constraints as follows:
(A_Constraint, An_Index_Constraint) ::= {Discrete_Ranges}
The component function is described as follows:
Discrete_Ranges (1..N) ::= (A_Discrete_Range)
ASIS defines discrete ranges as follows:
(A_Discrete_Range) ::= | (A_Discrete_Range, A_Discrete_Subtype_Indication) | range
To determine what Discrete_Range_Kinds is represented, call the Discrete_Range_Kind function.
Function Returns
Is_Constrained_Array Whether an array type definition represents a constrained array
3.6.2 Operations of Array Types
(Ada83 LRM 3.6.2, Ada95 LRM 3.6.2)
The operations listed in LRM 3.6.2 are described by ASIS as follows:
3.6.3 The Type String
(Ada83 LRM 3.6.3, Ada95 LRM 3.6.3)
The predefined String type can be found by searching package Standard.
3.7 Record Types
(Ada83 LRM 3.7, Ada95 LRM 3.8)
The LRM describes record type definitions as follows:
(Ada83 LRM 3.7, Ada95 LRM 3.8) record_type_definition ::= record component_list end record
ASIS describes record type definitions as follows:
(A_Type_Definition, A_Record_Type_Definition) ::= record {Record_Components} end record
ASIS describes component lists as follows:
Record_Components (1..N) ::= (A_Declaration, A_Component_Declaration) | (A_Variant_Part) | (A_Null_Component)
ASIS describes component declarations, including the component subtype-definition, as follows:
(A_Declaration, A_Component_Declaration) ::= {Names} : Object_Declaration_Definition [:= Initial_Value];
The component functions are described as follows:
Names (1..N) ::= (An_Entity_Name_Definition)
Object_Declaration_Definition ::= (A_Type_Definition)
Initial_Value ::= (An_Expression)
Ada record components are described by the Component_Kinds type. The relationship between the components and ASIS component kinds is shown in the following table:
Ada Record Component ASIS Component_Kinds
component_declaration A_Component_Declaration
null; A_Null_Component
variant_part A_Variant_Part
Function Returns
Is_Discriminated Whether the record type definition contains discriminants
Implicit_Components A list of all implementation-defined components in the type definition
3.7.1 Discriminants
(Ada83 LRM 3.7.1, Ada95 LRM 3.7)
The LRM describes discriminants as follows:
(Ada83 LRM 3.7.1, Ada95 LRM 3.7) discriminant_part ::= (discriminant_specification {; discriminant_specification})
ASIS describes discriminants as follows:
discriminant_part ::= ({Discriminants})
The component function is described as follows:
Discriminants (0..N) ::= (A_Declaration, A_Discriminant_Specification)
ASIS describes discriminant specifications as follows:
(A_Declaration, A_Discriminant_Specification) ::= {Names} : Type_Mark [:= Initial_Value]
The component functions are described as follows:
Names (1..N) ::= (An_Entity_Name_Definition)
Object_Declaration_Definition ::= (A_Type_Definition)
Initial_Value ::= (An_Expression)
3.7.2 Discriminant Constraints
(Ada83 LRM 3.7.2, Ada95 LRM 3.7.1)
The LRM describes discriminant constraints as follows:
(Ada83 LRM 3.7.2, Ada95 LRM 3.7.1) discriminant_constraint ::= (discriminant_association {, discriminant_association})
ASIS describes discriminant constraints as follows:
(A_Constraint, A_Discriminant_Constraint) ::= ({Discriminant_Associations})
The component function is described as follows:
Discriminant_Associations (1..N) ::= (A_Discriminant_Association)
ASIS describes discriminant associations as follows:
(A_Discriminant_Association) ::= [{Discriminant_Simple_Names}] => Discriminant_Expression
The component functions are described as follows:
Discriminant_Simple_Names (0..N) ::= (An_Expression, A_Simple_Name)
Discriminant_Expression ::= (An_Expression)
Function Returns
Is_Normalized Whether the discriminant association was obtained from a normalized list
3.7.3 Variant Parts
(Ada83 LRM 3.7.3, Ada95 LRM 3.8.1)
The LRM describes variant parts as follows:
(Ada83 LRM 3.7.3, Ada95 LRM 3.8.1) variant_part ::= case discriminant_simple_name is variant {variant} end case;
ASIS describes variant parts as follows:
(A_Variant_Part) ::= case Corresponding_Discriminant_Simple_Name is {Variants} end case;
The component functions are described as follows:
Corresponding_Discriminant_Simple_Name ::= (An_Expression, A_Simple_Name)
Variants (1..N) ::= (A_Variant)
ASIS describes variants as follows:
(A_Variant) ::= when {Variant_Choices} => Variant_Components
The component functions are described as follows:
Variant_Choices (1..N) ::= (A_Choice) Variant_Components (1..N) ::= (A_Declaration, A_Component_Declaration) | (A_Variant_Part) | (A_Null_Component)
ASIS categorizes variant choices by Choice_Kinds as follows:
(A_Choice, An_Expression) ::= Choice_Simple_Expression (A_Choice, A_Discrete_Range) ::= Choice_Discrete_Range (A_Choice, An_Others_Choice) ::= others (A_Choice, A_Simple_Name) ::= Choice_Name
To determine what Choice_Kinds is represented, call the Choice_Kind function.
The component functions of variant choices are described as follows:
Choice_Discrete_Range ::= (A_Discrete_Range) Choice_Name ::= (An_Expression) Choice_Simple_Expression ::= (An_Expression)
3.7.4 Operations of Record Types
(Ada83 LRM 3.7.4)
The operations listed in LRM 3.7.4 are described by ASIS as follows:
3.8 Access Types
(Ada83 LRM 3.8, Ada95 LRM 3.10)
The LRM describes access type definition as follows:
(Ada83 LRM 3.8, Ada95 LRM 3.10) access_type_definition ::= access subtype_indication
ASIS describes access type definitions as follows:
(A_Type_Definition, An_Access_Type_Definition) ::= access Access_To
The component function is described as follows:
Access_To ::= (A_Subtype_Indication)
3.8.1 Incomplete Type Declarations
(Ada83 LRM 3.8.1, Ada95 LRM 3.10.1)
The LRM describes incomplete type declarations as follows:
(Ada83 LRM 3.8.1, Ada95 LRM 3.10.1) incomplete_type_declaration ::= type identifier [discriminant_part];
ASIS describes incomplete type declarations as follows:
(A_Declaration, An_Incomplete_Type_Declaration) ::= type Names [({Discriminants})];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Discriminants (0..N) ::= (A_Declaration, A_Discriminant_Specification)
3.8.2 Operations of Access Types
(Ada83 LRM 3.8.2, Ada95 LRM 3.10.2)
The operations listed in LRM 3.8.2 are described by ASIS as follows:
3.9 Declarative Parts
(Ada83 LRM 3.9, Ada95 LRM 3.11)
The LRM describes declarative parts as follows:
(Ada83 LRM 3.9, Ada95 LRM 3.11) declarative_part ::= {basic_declarative_item} {later_declarative_item} basic_declarative_item ::= basic_declaration | representation_clause | use_clause later_declarative_item ::= body | subprogram_declaration | package_declaration | task_declaration | generic_declaration | use_clause | generic_instantiation body ::= proper_body | body_stub
proper_body ::= subprogram_body | package_body | task_body
ASIS does not directly represent the concepts of basic and later declarative items. All declarations made in a particular context are returned, in their order of appearance, when a context is analyzed.
4. Names and ExpressionsThe following LRM sections have related functions or concepts in ASIS:
- 4.1 Names
- 4.2 Literals
- 4.3 Aggregates
- 4.4 Expressions
- 4.6 Type Conversions
- 4.7 Qualified Expressions
- 4.8 Allocators
- 4.9 Static Expressions and Static Subtypes
- 4.10 Universal Expressions
4.1 Names
(Ada83 LRM 4.1, Ada95 LRM 4.1)
The LRM describes names as follows:
(Ada83 LRm 4.1, Ada95 LRM 4.1) name ::= simple_name | character_literal | operator_symbol
ASIS describes names, including simple names, as components of expressions. These components are defined in terms of Expression_Kinds as follows:
name ::= (An_Expression, A_Simple_Name) | (An_Expression, A_Character_Literal | An_Enumeration_Literal) | (An_Expression, An_Operator_Symbol) | (An_Expression, An_Indexed_Component) | (An_Expression, A_Slice) | (An_Expression, A_Selected_Component) | (An_Expression, An_Attribute)
See "4.4 Expressions," for more information on expression kinds.
ASIS describes prefixes as follows:
prefix ::= name | (An_Expression, A_Function_Call)
See "4.4 Expressions," for more information on function calls as a primary.
4.1.1 Indexed Components
(Ada83 LRM 4.1.1, Ada95 LRM 4.1.1)
The LRM describes indexed components as follows:
(Ada83 LRM 4.1.1, Ada95 LRM 4.1.1) indexed_component ::= prefix(expression {, expression})
ASIS describes indexed components as follows:
(An_Expression, An_Indexed_Component) ::= Prefix ({Index_Expressions})
The component functions are described as follows:
Prefix ::= (An_Expression) Index_Expressions (1..N) ::= (An_Expression)
4.1.2 Slices
(Ada83 LRM 4.1.2, Ada95 LRM 4.1.2)
The LRM describes slices as follows:
(Ada83 LRM 4.1.2, Ada95 LRM 4.1.2) slice ::= prefix(discrete_range)
ASIS describes slices as follows:
(An_Expression, A_Slice) ::= Prefix (Slice_Range)
The component functions are described as follows:
Prefix ::= (An_Expression) Slice_Range ::= (A_Discrete_Range)
4.1.3 Selected Components
(Ada83 LRM 4.1.3, Ada95 LRM 4.1.3)
The LRM describes selected components as follows:
(Ada83 LRM 4.1.3, Ada95 LRM 4.1.3) selected_component ::= prefix.selector
ASIS describes selected components, including selectors, as follows:
(An_Expression, A_Selected_Component) ::= Prefix.Selector
The component functions are described as follows:
Prefix ::= (An_Expression) Selector ::= (An_Expression, A_Character_Literal | A_Simple_Name | An_Enumeration_Literal | An_Operator_Symbol)
Ada selectors are described by the Selection_Kinds type. The relationship between ASIS selection kinds and selectors is based on the form of selected component described in LRM section 4.1.3 as follows:
Selection_Kinds Corresponding LRM Section
A_Discriminant a
A_Record_Component b
A_Task_Entry c
An_Access_Object (.all) d
An_Expanded_Name e and f
To determine what kind of selection is represented, call the Selection_Kind function.
4.1.4 Attributes
(Ada83 LRM 4.1.4, Ada95 LRM 4.1.4)
The LRM describes attributes as follows:
(Ada83 LRM 4.1.4, Ada95 LRM 4.1.4) attribute ::= prefix'attribute_designator
ASIS describes attributes, other than attribute functions, including the attribute designator, as follows:
(An_Expression, An_Attribute) :: Prefix'Attribute_Designator_Name [(Attribute_Designator_Argument)]
ASIS describes attribute functions, including the attribute designator, as follows:
(An_Expression, An_Attribute) :: Prefix'Attribute_Designator_Name [(Function_Call_Parameters)]
The component functions of attributes and attribute functions are described as follows:
Prefix ::= (An_Expression) Attribute_Designator_Name ::= (An_Expression, A_Simple_Name) Attribute_Designator_Argument ::= (An_Expression) Function_Call_Parameters (1..1) ::= (A_Parameter_Association)
ASIS describes the predefined attributes in terms of the Attribute_Designator_Kinds type. To determine what attribute is represented by the element returned from the Attribute_Designator _Name function, call the Attribute_Designator_Kind function.
Function Returns
Is_Normalized Whether the parameter association was obtained from a normalized list
Is_Parameter_Association Whether the specified element represents a parameter association
4.2 Literals
(Ada83 LRM 4.2, Ada95 LRM 4.2)
Function Returns
Is_Literal Whether the specified expression is a literal
4.3 Aggregates
(Ada83 LRM 4.3, Ada95 LRM 4.3)
The LRM describes aggregates as follows:
(Ada83 LRM 4.3, Ada95 LRM 4.3) aggregate ::= (component_association {, component_association})
ASIS describes aggregates as follows:
(An_Expression, An_Aggregate ::= ({Components})
The component function is described as follows:
Components (1..N) ::= (A_Component_Association)
ASIS describes component associations as follows:
(A_Component_Association) ::= {Component_Choices} => Component_Expression
The components functions are described as follows:
Component_Choices (0..N) ::= (A_Choice)
Component_Expression ::= (An_Expression)
Function Returns
Is_Normalized Whether the component association was obtained from a normalized list
4.4 Expressions
(Ada83 LRM 4.4, Ada95 LRM 4.4)
The LRM describes expressions as follows:
(Ada83 LRM 4.4, Ada95 LRM 4.4) expression ::= relation {and relation} | relation {and then relation} | relation <CR>
ASIS categorizes the short-circuit control forms and membership tests in terms of elements with an Expression_Kinds of A_Special_Operation and a sub-sub-kind of Special_Operation_Kinds. The relationship between the Ada syntactic categories and the special operation kinds are shown in the following table:
Ada Syntactic Category ASIS Special_Operation_Kinds
and then An_And_Then
or else An_Or_Else
in range An_In_Range
not in range A_Not_In_Range
in type_mark An_In_Type
not in type_mark A_Not_In_Type
To determine what Special_Operation_Kinds is represented, call the Special_Operation_Kind function.
There are no explicit ASIS functions that analyze the logical operators (and, or, and xor) in the syntactic category expression. The logical operators are represented as An_Expression elements with an Expression_Kinds of A_Function_Call; the function contains two parameter associations. The name of the function is An_Expression element with an Expression_Kinds of An_Operator_Symbol.
ASIS represents the short-circuit control forms as follows:
(An_Expression, A_Special_Operation, An_And_Then) ::= Special_Operation_Left_Hand_Side and then Short_Circuit_Operation_Right_Hand_Side (An_Expression, A_Special_Operation, An_Or_Else) ::= Special_Operation_Left_Hand_Side or else Short_Circuit_Operation_Right_Hand_Side
The component functions are described as follows:
Special_Operation_Left_Hand_Side ::= (An_Expression) Short_Circuit_Operation_Right_Hand_Side ::= (An_Expression)
There are no explicit ASIS functions that analyze the relational operators in the syntactic category relation. The relational operators are represented as An_Expression elements with an Expression_Kinds of A_Function_Call; the function contains two parameter associations. The name of the function is An_Expression element with an Expression_Kinds of An_Operator_Symbol.
ASIS represents membership tests as follows:
(An_Expression, A_Special_Operation, An_In_Range) ::= Special_Operation_Left_Hand_Side in In_Range_Operation_Right_Hand_Side (An_Expression, A_Special_Operation, A_Not_In_Range) ::= Special_Operation_Left_Hand_Side not in In_Range_Operation_Right_Hand_Side (An_Expression, A_Special_Operation, An_In_Type) ::= Special_Operation_Left_Hand_Side in In_Type_Operation_Right_Hand_Side (An_Expression, A_Special_Operation, A_Not_In_Type) ::= Special_Operation_Left_Hand_Side not in In_Type_Operation_Right_Hand_Side
The component functions are described as follows:
Special_Operation_Left_Hand_Side ::= (An_Expression) In_Range_Operation_Right_Hand_Side ::= (A_Constraint) In_Type_Operation_Right_Hand_Side ::= (An_Expression)
There are no explicit ASIS functions that analyze the syntactic categories simple expression, term, or factor. The unary adding operators, binary adding operators, multiplying operators, and highest precedence operators contained in these syntactic categories are represented as An_Expression elements with an Expression_Kinds of A_Function_Call; the function contains one parameter association for unary operators and two parameter associations for all other operators. The name of the function is An_Expression element with an Expression_Kinds of An_Operator_Symbol.
ASIS describes primaries as follows:
primary ::= (An_Expression, An_Integer_Literal | A_Real_Literal) | (An_Expression, A_Null_Literal) | (An_Expression, An_Aggregate) | (An_Expression, A_String_Literal) | name | (An_Expression, An_Allocation_From_Subtype | An_Allocation_From_Qualified_- Expression) | (An_Expression, A_Function_Call) | (An_Expression, A_Type_Conversion) | (An_Expression, A_Qualified_EXpression) | (An_Expression, A_Parenthesized_Expression)
4.6 Type Conversions
(Ada83 LRM 4.6, Ada95 LRM 4.6)
The LRM describes type conversions as follows:
(Ada83 LRM 4.6, Ada95 LRM 4.6) type_conversion ::= type_mark(expression)
ASIS describes type conversions as follows:
(An_Expression, A_Type_Conversion) ::= Type_Mark (Converted_Or_Qualified_Expression)
The component functions are described as follows:
Type_Mark ::= (An_Expression) Converted_Or_Qualified_Expression ::= (An_Expression)
4.7 Qualified Expressions
(Ada83 LRM 4.7, Ada95 LRM 4.7)
The LRM describes qualified expressions as follows:
(Ada83 LRM 4.7, Ada95 LRM 4.7) qualified_expression ::= type_mark'(expression) | type_mark'aggregate
ASIS describes qualified expressions as follows:
(An_Expression, A_Qualified_Expression) ::= Type_Mark '(Converted_Or_Qualified_Expression) | Type_Mark 'Converted_Or_Qualified_Expression
The component functions are described as follows:
Type_Mark ::= (An_Expression) Converted_Or_Qualified_Expression ::= (An_Expression)
4.8 Allocators
(Ada83 LRM 4.8, Ada95 LRM 4.8)
The LRM describes allocators as follows:
(Ada83 LRM 4.8, Ada95 LRM 4.8) allocator ::= new subtype_indication | new qualified_expression
ASIS describes allocators as follows:
(An_Expression, An_Allocation_From_Subtype) ::= new Allocation_Type (An_Expression, An_Allocation_From_Qualified_Expression) ::= new Qualified_Object_Expression
The component functions are described as follows:
Allocation_Type ::= (A_Subtype_Indication)
Qualified_Object_Expression ::= (An_Expression)
4.9 Static Expressions and Static Subtypes
(Ada83 LRM 4.9, Ada95 LRM 4.9)
Function Returns
Is_Static Whether an expression is a static value
Static_Value The static value of the specified expression
4.10 Universal Expressions
(Ada83 LRM 4.10)
Function Returns
Is_Universal Whether an expression return a universal integer or universal real value
5. StatementsThe following LRM sections have related functions or concepts in ASIS:
- 5.1 Simple and Compound Statements - Sequences of Statements
- 5.2 Assignment Statement
- 5.3 If Statements
- 5.4 Case Statements
- 5.5 Loop Statements
- 5.6 Block Statements
- 5.7 Exit Statements
- 5.8 Return Statements
- 5.9 Goto Statements
5.1 Simple and Compound Statements - Sequences of Statements
(Ada83 LRM 5.1, Ada95 LRM 5.1)
The LRM describes statements as follows:
(Ada83 LRM 5.1, Ada95 LRM 5.1) sequence_of_statements ::= statement {statement}
Sequences of statements are available from the following functions in package Statements:
1 A Nil_Element_List is always returned.
ASIS describes statements as follows:
(A_Statement) ::= {Label_Names} simple_statement | {Label_Names} compound_statement
The component function is described as follows:
Label_Names (0..N) ::= (An_Entity_Name_Definition)
Function Returns
Is_Labeled Whether a statement contains one or more preceding labels
ASIS does not distinguish between simple statements and compound statements. For conformity of representation however, we show the ASIS definitions in terms of these syntactic categories.
ASIS would describe simple statements as follows:
simple_statement ::= (A_Statement, A_Null_Statement) | (A_Statement, An_Assignment_Statement) | (A_Statement, A_Procedure_Call_Statement) | (A_Statement, An_Exit_Statement) | (A_Statement, A_Return_Statement) | (A_Statement, A_Goto_Statement) | (A_Statement, An_Entry_Call_Statement) | (A_Statement, A_Raise_Statement) | (A_Statement, A_Code_Statement)
ASIS would describe compound statements as follows:
compound_statment ::= (A_Statement, An_If_Statement) | (A_Statement, A_Case_Statement) | (A_Statement, A_Loop_Statement) | (A_Statement, A_Block_Statement) | (A_Statement, An_Accept_Statement) | select_statement
Because of the select statement's complexity, it is defined in terms of its components. The LRM describes select statements as follows:
(LRM 9.7) select_statement ::= selective_wait | conditional_entry_call | timed_entry_call
ASIS describes select statements as follows:
select_statement ::= (A_Statement, A_Selective_Wait_Statement) | (A_Statement, A_Conditional_Entry_Call_Statement) | (A_Statement, A_Timed_Entry_Call_Statement)
To determine what Statement_Kinds is represented, call the Kind function.
ASIS describes null statements as follows:
(A_Statement, A_Null_Statement) ::= null;
5.2 Assignment Statement
(Ada83 LRM 5.2, Ada95 LRM 5.2)
The LRM describes assignment statements as follows:
(Ada83 LRM 5.2, Ada95 LRM 5.2) assignment_statement ::= variable_name := expression;
ASIS describes assignment statements as follows:
(A_Statement, An_Assignment_Statement) ::= Object_Assigned_To := Assignment_Expression;
The component functions are described as follows:
Object_Assigned_To ::= (An_Expression) Assignmnet_Expression ::= (An_Expression)
5.3 If Statements
(Ada83 LRM 5.3, Ada95 LRM 5.3)
The LRM describes if statements as follows:
(Ada83 LRM 5.3, Ada95 LRM 5.3)
if_statement ::= if condition then sequence_of_statements {elsif condition then condition ::= boolean_expression
ASIS describes if statements as follows:
(A_Statement, An_If_Statement) ::= if {If_Statement_Arms} then If_Statement_Arms (1..N) ::= (An_If_Statement_Arm)
ASIS categorizes if-statement arms by If_Statement_Arm_Kinds as follows:
(An_If_Statement_Arm, An_If_Arm) ::= if Condition_Expression then {Arm_Statements} (An_If_Statement_Arm, An_Elsif_Arm) ::= elseif Condition_Expression then {Arm_Statements} (An_If_Statement_Arm, An_Else_Arm) ::= else {Arm_Statements}
To determine what If_Statement_Arm_Kinds is represented, call the If_Statement_Arm_Kind function.
The component functions are described as follows:
Arm_Statements (1..N) ::= (A_Pragma) | (A_Statement) Condition_Expression ::= (An_Expression)
5.4 Case Statements
(Ada83 LRM 5.4, Ada95 LRM 5.4)
The LRM describes case statements as follows:
(Ada83 LRM 5.4, Ada95 LRM 5.4) case_statement ::= case expression is case_statement_alternative {case_statement_alternative} end case;
ASIS describes case statements as follows:
(A_Statement, A_Case_Statement) ::= case Case_Expression is {Case_Statement_Alternatives} end case;
The component functions are described as follows:
Case_Expression ::= (An_Expression)
Case_Statement_Alternatives (1..N) ::= (A_Case_Statement_Alternative)
ASIS describes case-statement alternatives as follows:
(A_Case_Statement_Alternative) ::= when {Case_Statement_Alternative_Choices} => Case_Statement_Alternative_Statements
The component functions are described as follows:
Case_Statement_Alternative_Choices (1..N) ::= (A_Choice) Case_Statement_Alternative_Statements (1..N) ::= (A_Pragma) | (A_Statement)
ASIS categorizes case-statement alternative choices by Choice_Kinds as follows:
(A_Choice, A_Discrete_Range) ::= Choice_Discrete_Range (A_Choice, A_Simple_Name) ::= Choice_Name (A_Choice, An_Expression) ::= Choice_Simple_Expression (A_Choice, An_Others_Choice) ::= others
Function Returns
Is_When_Others Whether a case statement alternative represents the reserved word others
The component functions of case-statement alternative choices are described as follows:
Choice_Discrete_Range ::= (A_Discrete_Range) Choice_Name ::= (An_Expression) Choice_Simple_Expression ::= (An_Expression)
5.5 Loop Statements
(Ada83 LRM 5.5, Ada95 LRM 5.5)
The LRM describes loop statements as follows:
(Ada83 LRM 5.5, Ada95 LRM 5.5) loop_statement ::= [loop_simple_name:] [iteration_scheme] loop sequence_of_statements end loop [loop_simpl
ASIS categorizes loop statements, including the iteration scheme, by Loop_Kinds as follows:
(A_Statement, A_Loop_Statement, A_For_Loop) ::= [Loop_Simple_Name:] for For_Loop_Parameter_Specification loop {Loop_Statements} end loop [Loop_Simple_Name]; (A_statement, A_Loop_Statement, A_While_Loop) ::= [Loop_Simple_Name:] while While_Condition loop {Loop_Statements} end loop [Loop_Simple_Name]; (A_Statement, A_Loop_Statement, A_Simple_Loop) ::= [Loop_Simple_Name:] loop {Loop_Statements} end loop [Loop_Simple_Name];
To determine what Loop_Kinds is represented, call the Loop_Kind function.
The component functions are described as follows:
For_Loop_Parameter_Specification ::= (A_Declaration, A_Loop_Parameter_Specification) Loop_Simple_Name ::= (An_Entity_Name_Definition, A_Simple_Name)
While_Condition ::= (An_Expression) Loop_Statements (1..N) ::= (A_Pragma) | (A_Statement)
The loop parameter specification is described as follows:
(A_Declaration, A_Loop_Parameter_Specification) ::= Names in [reverse] Loop_Parameter_Range
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Loop_Parameter_Range ::= (A_Discrete_Range)
Function Returns
Is_Reverse_Loop_Parameter Whether the reserved word reverse appears in the loop parameter specification
5.6 Block Statements
(Ada83 LRM 5.6, Ada95 LRM 5.6)
The LRM describes block statements as follows:
(Ada83 LRM 5.6, Ada95 LRM 5.6) block_statement ::= [block_simple_name:] [declare declarative_part] begin sequence_of_statements ASIS describes block statements as follows:
(A_Statement, A_Block_Statement) ::= [Block_Simple_Name:] [declare Declarative_Items] begin Block_Body_Statements [exception {Block_Exception_Handlers}] end [Block_Simple_Name];
The component functions are described as follows:
Block_Simple_Name ::= (An_Entity_Name_Definition, A_Simple_Name) Declarative_Items (0..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause) | (A_Use_Clause)
Block_Body_Statements (1..N) ::= (A_Pragma) | (A_Statement)
Block_Exception_Handlers (0..N) ::= (An_Exception_Handler)
5.7 Exit Statements
(Ada83 LRM 5.7, Ada95 LRM 5.7)
The LRM describes exit statements as follows:
(Ada83 LRM 5.7, Ada95 LRM 5.7)
exit_statement ::= exit [loop_name] [when condition];
ASIS describes exit statements as follows:
(A_Statement, An_Exit_Statement) ::= exit [Exit_Loop_Name] [when Exit_Condition];
The component functions are described as follows:
Exit_Loop_Name ::= (An_Expression, A_Selected_Component | A_Simple_Name) Exit_Condition ::= (An_Expression)
Function Returns
Loop_Exited The loop statement the exit applies to
5.8 Return Statements
(Ada83 LRM 5.8, Ada95 LRM 6.5)
The LRM describes return statements as follows:
(Ada83 LRM 5.8, Ada95 LRM 6.5) return_statement ::= return [expression];
ASIS describes return statements as follows:
(A_Statement, A_Return_Statement) ::= return [Return_Expression];
The component function is described as follows:
Return_Expression ::= (An_Expression)
5.9 Goto Statements
(Ada83 LRM 5.9, Ada95 LRM 5.8)
The LRM describes goto statements as follows:
(Ada83 LRM 5.9, Ada95 LRM 5.8) goto_statement ::= goto label_name;
ASIS describes returns statements as follows:
(A_Statement, A_Goto_Statement) ::= goto Goto_Label;
The component function is described as follows:
Goto_Label ::= (An_Expression, A_Simple_Name)
Function Returns
Destination_Statement The target statement of the goto statement
6. SubprogramsThe following LRM sections have related functions or concepts in ASIS:
6.1 Subprogram Declarations
(Ada83 LRM 6.1, Ada95 LRM 6.1)
The LRM describes subprogram declarations as follows:
(Ada83 LRM 6.1, Ada95 LRM 6.1 subprogram_specification ::= procedure identifier [formal_part]
ASIS describes subprogram specifications including the formal part as follows:
(A_Declaration, A_Procedure_Declaration) ::= procedure Names [({Parameters})] (A_Declaration, A_Function_Declaration) ::= funntion Names [({Parameters}]) return Return_Type
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Return_Type ::= (An_Expression, A_Selected_Component | A_Simple_Name)
The An_Entity_Name_Definition element returned by the Names function can represent an identifier or an operator symbol.
Function Returns
Corresponding_Body The element representing the declaration of the subprogram body
ASIS describes parameter specifications as follows:
(A_Declaration, A_Parameter_Specification) ::= {Names} : Parameter_Mode_Kind Type_Mark [:= Initial_Value]
The component functions are described as follows:
Names (1..N) ::= (An_Entity_Name_Definition) Parameter_Mode_Kind ::= Parameter_Mode_Kinds Type_Mark ::= (An_Expression, A_Selected_Component | A_Simple_Name | An_Attribute) Initial_Value ::= (An_Expression)
Ada parameter modes are describe the Parameter_Mode_Kinds type. The relationship between parameter modes and ASIS parameter mode kinds is shown in the following table:
Ada Mode ASIS Parameter_Mode_Kinds
none A_Default_In_Mode1
in An_In_Mode
in out An_In_Out_Mode
out An_Out_Mode
1 If Default_In_Mode_Support returns False, this value is never returned. If a default in mode was specified in the source code, An_In_Mode is returned instead.
6.3 Subprogram Bodies
(Ada83 LRM 6.3, Ada95 LRM 6.3)
The LRM describes subprogram bodies as follows:
(Ada83 LRM 6.3, Ada95 LRM 6.3 subprogram_body ::= subprogram_specification is [declarative_part] begin
ASIS describes subprogram bodies as follows:
(A_Declaration, A_Procedure_Body_Declararation) ::= procedure Names [({Parameters})] is Subprogram_Body_Block end [Names]; (A_Declaration, A_Function_Body_Declaration) ::= function Names [({Parameters})] return Return_Type is Subprogram_Body_Block end [Names];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Subprogram_Body_Block ::= (A_Statement, A_Block_Statement) Return_Type ::= (An_Expression, A_Selected_Component | A_Simple_Name)
See "5.6 Block Statements" for how to obtain the declarative part, sequence of statements, and exception handlers from the element representing the subprogram body block.
Function Returns
Corresponding_Specification The element representing the declaration of the subprogram specification
6.4 Subprogram Calls
(Ada83 LRM 6.4, Ada95 LRM 6.4)
The LRM describes subprogram calls as follows:
(Ada83 LRM 6.4, Ada95 LRM 6.4 procedure_call_statement ::= procedure_name [actual_parameter_part];
ASIS describes procedure call statements including the actual parameter part as follows:
(A_Statement, A_Procedure_Call_Statement) ::= Called_Name [({Call_Parameters})]
The component functions are described as follows:
Called_Name ::= (An_Expression) Call_Parameters (0..N) ::= (A_Parameter_Association)
Function Returns
Called_Procedure The declaration of the called procedure or entry
ASIS describes function calls including the actual parameter part as follows:
(An_Expression, A_Function_Call) ::= Prefix [({Function_Call_Parameters})]
The component functions are described as follows:
Prefix ::= (An_Expression) Function_Call_Parameters ::= (A_Parameter_Association)
ASIS describes parameter associations as follows:
(A_Parameter_Association) ::= [Formal_Parameter =>] Actual_Parameter
The component functions are described as follows:
Formal_Parameter ::= (An_Expression, A_Simple_Name) | (An_Entity_Name_Definition, A_Simple_Name) Actual_Parameter ::= (An_Expression)
The Formal_Parameters function returns An_Expression if the A_Parameter_Association is from a normalized list; An_Entity_Name_Definition is returned from an unnormalized list.
7. PackagesThe following LRM sections have related functions or concepts in ASIS:
7.1 Package Structure
(Ada83 LRM 7.1, Ada95 LRM 7.1)
The LRM describes package specifications as follows:
(Ada83 LRM 7.1, Ada95 LRM 7.1) package_specification ::= package identifier is {basic_declarative_item}
ASIS describes package specifications as follows:
(A_Declaration, A_Package_Declaration) ::= package Names is {Visible_Part_Declarative_Items} [private {Private_Part_Declarative_Items)] end [Names]
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition)
Visible_Part_Declarative_Items (1..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause) | (A_Use_Clause)
Private_Part_Declarative_Items (1..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause) | (A_Use_Clause)
Function Returns
Corresponding_Body The element representing the declaration of the package body
ASIS describes package bodies as follows:
(A_Declaration, A_Package_Body_Declartion) ::= package body Names is Package_Body_Block;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Package_Body_Block ::= (A_Statement, A_Block_Statement)
See "5.6 Block Statements" for how to obtain the declarative part, sequence of statements, and exception handlers from the element representing the package body block.
Function Returns
Corresponding_Specification The element representing the declaration of the package
7.4 Private Types and Deferred Constant Declarations
(Ada83 LRM 7.4, Ada95 LRM 7.3, 7.4)
The LRM describes private-type and deferred-constant declarations as follows:
(Ada83 LRM 7.4, Ada95 LRM 7.3, 7.4) private_type_declaration ::= type identifier [discriminant_part] is [limited] private; (LRM 7.4 ) deferred_constant_declaration ::= identifier_list : constant type_mark;
ASIS describes private-type declarations as follows:
(A_Declaration, A_Private_Type_Declaration) ::= type Names [({Discriminants})] is Type_Declaration_Definition;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Discriminants (0..N) ::= (A_Declaration, A_Discriminant_Specification) Type_Declaration_Definition ::= (A_Type_Definition, A_Private_Type_Definition | A_Limited_Private_Type_Definition)
ASIS describes deferred-constant declarations as follows:
(A_Declaration, A_Deferred_Constant_Declaration) ::= {Names} : constant Type_Mark;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Type_Mark ::= (An_Expression, A_Selected_Component | A_Simple_Name | An_Attribute)
You can obtain the corresponding full type declaration by calling the Corresponding_Constant_Declaration function.
8. Visibility RulesThe following LRM sections have related functions or concepts in ASIS:
8.4 Use Clauses
(Ada83 LRM 8.4, Ada95 LRM 8.4)
The LRM describes use clauses as follows:
(Ada83 LRM 8.4, Ada95 LRM 8.4) use_clause ::= use package_name {, package_name};
ASIS describes use clauses as follows:
(A_Use_Clause) ::= use Named_Packages | use Context_Clause_Elements
The component functions are described as follows:
Named_Packages (1..N) ::= (An_Expression, A_Simple_Name | A_Selected_Name) Context_Clause_Elements (0..N) ::= (A_Pragma) | (A_Use_Clause) | (A_With_Clause)
Use Compilation_Clause_Elements to obtain the use clauses that appear in a unit's context clause. Use Named_Packages for all other use clauses.
The use clauses returned by the Context_Clause_Elements function can be further analyzed with the Referenced_Units function.
8.5 Renaming Declarations
(Ada83 LRM 8.5 , Ada95 LRM 8.5)
The LRM describes renaming declarations as follows:
(Ada83 LRM 8.5 , Ada95 LRM 8.5 ) renaming_declaration ::= identifier : type_mark renames object_name; | identifier : exception
ASIS describes renaming declarations as follows:
(A_Declaration, An_Object_Rename_Declartion) ::= Names : Type_Mark renames Renamed_Entity; (A_Declaration, An_Exception_Rename_Declaration) ::= Names : exception renames Renamed_Entity; (A_Declaration, A_Package_Rename_Declaration) ::= package Names renames Renamed_Entity; (A_Declaration, A_Procedure_Rename_Declaration) ::= procedure Names [({Parameters})] renames Renamed_Entity; (A_Declaration, A_Function_Rename_Declaration) ::= function Names [({Parameters})] return Return_Type renames Renamed_Entity;
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Type_Mark ::= (An_Expression, A_Selected_Component | A_Simple_Name | An_Attribute) Renamed_Entity ::= (An_Expression) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Return_Type ::= (An_Expression, A_Selected_Component | A_Simple_Name)
9. TasksThe following LRM sections have related functions or concepts in ASIS:
- 9.1 Task Specifications and Task Bodies
- 9.5 Entries, Entry Calls, and Accept Statements
- 9.6 Delay Statements, Duration, and Time
- 9.7 Select Statements
- 9.10 Abort Statements
9.1 Task Specifications and Task Bodies
(Ada83 LRM 9.1, Ada95 LRM 9.1)
The LRM describes task specifications and task bodies as follows:
(Ada83 LRM 9.1, Ada95 LRM 9.1) task_specification ::= task [type] identifier [is {entry_declaration}
ASIS describes task specifications as follows:
(A_Declaration, A_Task_Declaration) ::= task Names is {Entry_Declarations} {Task_Declaration_Declarative_Items} end [Names]; (A_Declaration, A_Task_Type_Declaration) ::= task type Names is {Entry_Declarations} {Task_Declaration_Declarative_Items} end [Names];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Entry_Declarations (0..N) ::= (A_Declaration, An_Entry_Declaration) Task_Declaration_Declarative_Items (0..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause)
Function Returns
Corresponding_Body The element representing the declaration of the task body
ASIS describes task bodies as follows:
(A_Declaration, A_Task_Body_Declaration) ::= task body Names is Task_Body_Block end [Names];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Task_Body_Block (1..N) := (A_Statement, A_Block_Statement)
See "5.6 Block Statements" for how to obtain the declarative part, sequence of statements, and exception handlers from the element representing the task body block.
Function Returns
Corresponding_Specification The element representing the declaration of the task specification
9.5 Entries, Entry Calls, and Accept Statements
(Ada83 LRM 9.5, Ada95 LRM 9.5.2)
The LRM describes entries, entry calls, and accept statements as follows:
(Ada83 LRM 9.5, Ada95 LRM 9.5.2) entry_declaration ::= entry identifier [(discrete_range)] [formal_part];
ASIS describes entry declarations as follows:
(A_Declaration, An_Entry_Declaration) ::= entry Names [(Family_Index)] [{Parameters}];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Family_Index ::= (A_Discrete_Range) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification)
Note: Family_Index is in package Declarations.
ASIS describes an entry call statement as follows:
(A_Statement, An_Entry_Call_Statement) ::= Called_Name [Family_Index {Call_Parameters}];
The component functions are described as follows:
Called_Name ::= (An_Expression) Family_Index ::= (An_Expression) Call_Parameters (0..N) ::= (A_Parameter_Association)
Note: Family_Index is in package Declarations.
ASIS describes accept statements, including the entry index, as follows:
(A_Statement, An_Accept_Statement) ::= accept Accept_Entry_Simple_Name [(Family_Index)] [{Accept_Parameters}] [do Accept_Body_Statements end [Accept_Entry_Simple_Name]];
The component functions are described as follows:
Accept_Entry_Simple_Name ::= (An_Expression, A_Simple_Name) Family_Index ::= (An_Expression) Accept_Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Accept_Body_Statements (1..N) ::= (A_Pragma) | (A_Statement)
Note: Family_Index is in package Statements.
9.6 Delay Statements, Duration, and Time
(Ada83 LRM 9.6, Ada95 LRM 9.6)
The LRM describes delay statements as follows:
(Ada83 LRM 9.6, Ada95 LRM 9.6) delay_statement ::= delay simple_expression;
ASIS describes delay statements as follows:
(A_Statement, A_Delay_Statement) ::= Delay_Expression
The component function is described as follows:
Delay_Expression ::= (An_Expression)
9.7 Select Statements
(Ada83 LRM 9.7, Ada95 LRM 9.7)
The following LRM sections have related functions or concepts in ASIS:
- "9.7.1 Selective Waits"
- "9.7.2 Conditional Entry Calls"
- "9.7.3 Timed Entry Calls"
The LRM describes select statements as follows:
(Ada83 LRM 9.7, Ada95 LRM 9.7) select_statement ::= selective_wait | conditional_entry_call | timed_entry_call
ASIS describes select statements as follows:
select_statement ::= (A_Statement, A_Selective_Wait_Statement) | (A_Statement, A_Conditional_Entry_Call_Statement) | (A_Statement, A_Timed_Entry_Call_Statement)
9.7.1 Selective Waits
(Ada83 LRM 9.7.1, Ada95 LRM 9.7.1)
The LRM describes selective wait statements as follows:
(Ada83 LRM 9.7.1, Ada95 LRM 9.7.1) selective_wait ::= select select_alternative {or select_alternative}
ASIS describes selective-wait statements as follows:
(A_Statement, A_Selective_Wait_Statement) ::= select Select_Statement_Arms end select;
The component function is described as follows:
Select_Statement_Arms (1..N) ::= (A_Select_Statement_Arm)
The A_Select_Statement_Arm elements returned can be categorized by the Select_Statement_Arm_Kind function into elements of a particular Select_Statement_Arm_Kinds. Taking the select statement arm kinds into consideration, selective-wait call statements can be described as follows:
(A_Statement, A_Selective_Wait_Statement) ::= select Arm_Select_Alternative {or Arm_Select_Alternative} [else Else_Statements] end select;
The correlation between the ASIS functions and the appropriate select statement arm kinds are:
ASIS Function Select_Statement_Arm_Kinds
Arm_Select_Alternative A_Selective_Wait_Select_Arm
A_Selective_Wait_or_Arm
Else_Statements A_Selective_Wait_Else_Arm
The component functions are described as follows:
Arm_Select_Alternative ::= (A_Select_Alternative) Else_Statements (1..N) ::= (A_Pragma) | (A_Statement)
ASIS describes select alternatives as follows:
(A_Select_Alternative) ::= [when Guard =>] Select_Alternative_Kind
The component functions are described as follows:
Guard ::= (An_Expression) Select_Alternative_Kind ::= Select_Alternative_Kinds
Function Returns
Is_Guarded Whether a guard exists on the select alternative
ASIS describes selective wait alternatives and the component syntactic categories in terms of Select_Alternative_Kinds as follows:
(A_Select_Alternative, An_Accept_Alternative) ::= {Select_Alternative_Statements} (A_Select_Alternative, A_Delay_Alternative) ::= {Select_Alternative_Statements} (A_Select_Alternative, A_Terminate_Alternative) ::= terminate;
The component function is described as follows:
Select_Alternative_Statements (0..N) ::= (A_Pragma) | (A_Statement)
The element list returned by Select_Alternative_Statements function for the accept alternative includes the accept statement. Similarly, the list returned for the delay alternative includes the delay statement. The function can be called for the terminate alternative but an Asis.Nil_Element_List is always returned; the reserved word terminate is implicit.
9.7.2 Conditional Entry Calls
(Ada83 LRM 9.7.2, Ada95 LRM 9.7.3)
The LRM describes conditional-entry call statements as follows:
(Ada83 LRM 9.7.2, Ada95 LRM 9.7.3) conditional_entry_call := select entry_call_statement [sequence_of_statements]
ASIS describes conditional-entry call statements as follows:
(A_Statement, A_Conditional_Entry_Call_Statement) ::= select Select_Statement_Arms end select;
The component function is described as follows:
Select_Statement_Arms (1..N) ::= (A_Select_Statement_Arm)
The A_Select_Statement_Arm elements returned can be categorized by the Select_Statement_Arm_Kind function into elements of a particular Select_Statement_Arm_Kinds. Taking the select statement arm kinds into consideration, conditional-entry call statements can be described as follows:
(A_Statement, A_Conditional_Entry_Call_Statment) ::= select Entry_Call_Statements else Else_Statements end select;
The correlation between the ASIS functions and the appropriate select statement arm kinds are:
ASIS Function Select_Statement_Arm_Kinds
Entry_Call_Statements A_Conditional_Entry_Call_Select_Arm
Else_Statements A_Conditional_Entry_Call_Or_Arm
The component functions are described as follows:
Entry_Call_Statements (1..N) ::= (A_Pragma) | (A_Statement) Else_Statements (1..N) ::= (A_Pragma) | (A_Statement)
9.7.3 Timed Entry Calls
(Ada83 LRM 9.7.3, Ada95 LRM 9.7.2)
The LRM describes timed-entry call statements as follows:
(Ada83 LRM 9.7.3, Ada95 9.7.2) timed_entry_call ::= select entry_call_statement [sequence_of_statements] or delay_alternative end s
ASIS describes timed-entry call statements as follows:
(A_Statement, A_Timed_Entry_Call_Statement) ::= select Select_Statement_Arms end select;
The component function is described as follows:
Select_Statement_Arms (1..N) ::= (A_Select_Statement_Arm)
The A_Select_Statement_Arm elements returned can be categorized by the Select_Statement_Arm_Kind function into elements of a particular Select_Statement_Arm_Kinds. Taking the select statement arm kinds into consideration, timed-entry call statements can be described as follows:
(A_Statement, A_Timed_Entry_Call_Statement) ::= select Entry_Call_Statements or Timed_Entry_Call_Or_Statements end select;
The correlation between the ASIS functions and the appropriate select statement arm kinds are:
ASIS Function Select_Statement_Arm_Kinds
Entry_Call_Statements A_Timed_Entry_Call_Select_Arm
Timed_Entry_Call_Or_Statements A_Timed_Entry_Call_Or_Arm
The component functions are described as follows:
Entry_Call_Statements (1..N) ::= (A_Pragma) | (A_Statement) Timed_Entry_Call_Or_Statements (1..N) ::= (A_Pragma) | (A_Statement)
9.10 Abort Statements
(Ada83 LRM 9.10, Ada95 LRM 9.8)
The LRM describes abort statements as follows:
(Ada83 LRM 9.10, Ada95 LRM 9.8) abort_statement ::= abort task_name {, task_name};
ASIS describes abort statements as follows:
abort {Aborted_Tasks};
The component function is describes as follows:
Aborted_Tasks (1..N) ::= (An_Expression)
10. Program Structure and Compilation IssuesThe following LRM sections have related functions or concepts in ASIS:
10.1 Compilation Units - Library Units
(Ada83 LRM 10.1, Ada95 LRM 10.1.1)
The LRM describes compilation units as follows:
(Ada83 LRM 10.1, Ada95 LRM 10.1.1) compilation ::= {compilation_unit}
ASIS provides support for the LRM definition allowing multiple compilation units per compilation. The Rational Environment however, does not allow multiple compilation units per compilation. Apex however, does not allow multiple compilation units per compilation. Whether multiple compilation units appear in a compilation can only be determined by:
- Comparison of the Text_File_Name of each unit
- Retrieval and analysis of the text images with subprograms in package Text
ASIS describes compilation units as follows:
compilation_unit ::= Context_Clause_Elements Library_Unit | Context_Clause Elements Secondary_Unit
The component functions are described as follows:
Context_Clause_Elements ::= (A_Pragma) | (A_Use_Clause) | (A_With_Clause) Library_Unit ::= (Compilation_Unit_Kinds) Secondary_Unit ::= (Compilation_Unit_Kinds)
ASIS describes library units and secondary units in terms of Compilation_Unit_Kinds. The relationships between Ada compilation units and ASIS compilation unit kinds are shown in the following table:
The Compilation_Unit_Kinds enumeration contains additional values for units that must exist but are currently missing and for implementation-defined units.
Before a compilation unit can be analyzed, an element representing the declaration of the unit must be obtained with the Unit_Declaration function. This element has a kinds of A_Declaration and a sub-kinds based on the compilation unit. The relationship between the compilation unit kinds and the declaration kinds is shown in the following table:
Subprograms that return properties, pragmas, and related compilation units are described in package Compilation_Units.
10.1.1 Context Clauses - With Clauses
(Ada83 LRM 10.1.1, Ada95 LRM 10.1.2)
The LRM describes context clauses as follows:
(Ada83 LRM 10.1.1, Ada95 LRM 10.1.2) context_clause ::= {with_clause {use_clause}}
ASIS describes context clauses as follows:
context_clause ::= {Context_Clause_Elements}
The component function is described as follows:
Context_Clause_Elements (0..N) ::= (A_Pragma) | (A_Use_Clause) | (A_With_Clause)
ASIS describes with clauses as follows:
(A_With_Clause) ::= with {Referenced_Units}
The component function is described as follows:
Referenced_Units (1..N) ::= (An_Expression, A_Simple_Name)
10.2 Subunits of Compilation Units
(Ada83 LRM 10.2, Ada95 LRM 10.1.3)
The LRM describes subunits of compilation units as follows:
(Ada83 LRM 10.2, Ada95 LRM 10.1.3) body_stub ::= subprogram_specification is separate;
ASIS categorizes body stubs by Declaration_Kinds as follows:
(A_Declaration, A_Function_Body_Stub) ::= function Names [({Parameters})] return Return_Type is separate; (A_Declaration, A_Procedure_Body_Stub) ::= procedure Names [({Parameters})] is separate; (A_Declaration, A_Package_Body_Stub) ::= package body Names is separate; (A_Declaration, A_Task_Body_Stub) ::= task body Names is separate;
The component functions are defined as follows:
Names (1..1) ::= (An_Entity_Name_Definition) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification)
To convert a body stub declaration to a declaration that represents the subunit, use the Subunit function.
ASIS categorizes subunits by Declaration_Kinds as follows:
(A_Declaration, A_Function_Body) ::= separate (parent_unit_name) Subprogram_Body_Block (A_Declaration, A_Procedure_Body) ::= separate (parent_unit_name) Subprogram_Body_Block (A_Declaration, A_Package_Body) ::= separate (parent_unit_name) Package_Body_Block (A_Declaration, A_Task_Body) ::= separate (parent_unit_name) Task_Body_Block
The component functions are described as follows:
Subprogram_Body_Block ::= (A_Declaration, A_Block_Statement) Package_Body_Block ::= (A_Declaration, A_Block_Statement) Task_Body_Block ::= (A_Declaration, A_Block_Statement)
ASIS does not provide an explicit function to obtain the parent unit name. One possible method is to:
- 1 . Call Enclosing_Compilation_Unit to obtain the compilation unit of the separate.
- 2 . Call Subunit_Parent to obtain the compilation unit of the parent unit.
- 3 . Call Name to obtain the name of the parent unit.
11. ExceptionsThe following LRM sections have related functions or concepts in ASIS:
11.1 Exception Declarations
(Ada83 LRM 11.1, Ada95 LRM 11.1)
The LRM describes exception declarations as follows:
(Ada83 LRM 11.1, Ada95 LRM 11.1) exception_declaration ::= identifier_list : exception;
ASIS describes exception declarations as follows:
(A_Declaration, An_Exception_Declaration) ::= {Names} : exception;
The component function is described as follows:
Names (1..N) := (An_Entity_Name_Definition)
11.2 Exception Handlers
(Ada83 LRM 11.2, Ada95 LRM 11.2)
The LRM describes exception handlers as follows:
(Ada83 LRM 11.2, Ada95 LRM 11.2) exception_handler ::= when exception_choice {| exception_choice} => sequence_of_statements
ASIS describes exception handlers as follows:
(An_Exception_Handler) ::= when {Exception_Choices} => Handler_Statements
The component functions are described as follows:
Exception_Choices ::= (A_Choice) Handler_Statements (1..N) ::= (A_Statement)
ASIS categorizes exception choices by Choice_Kinds as follows:
(A_Choice, An_Exception_Name) ::= Choice_Name (A_Choice, An_Expression) ::= Choice_Simple_Expression (A_Choice, An_Others_Choice) ::= others
Function Returns
Is_Others_Handler Whether the specified exception choice represents the others reserved word
The component functions of exception choices are described as follows:
Choice_Name ::= (An_Expression) Choice_Simple_Expression ::= (An_Expression)
11.3 Raise Statements
(Ada83 LRM 11.3, Ada95 LRM 11.3)
The LRM describes raise statements as follows:
(Ada83 LRM 11.3, Ada95 LRM 11.3) raise_statement ::= raise [exception_name];
ASIS describes raise statements as follows:
(A_Statement, A_Raise_Statement) ::= raise [Raised_Exception];
The component function is described as follows:
Raised_Exception ::= (An_Expression, A_Selected_Component | A_Simple_Name)
12. Generic UnitsThe following LRM sections have related functions or concepts in ASIS:
12.1 Generic Declarations
(Ada83 LRM 12.1, Ada95 LRM 12.1)
The LRM described generic declarations as follows:
(Ada83 LRM 12.1, Ada95 LRM 12.1) generic_specification ::= generic_formal_part subprogram_specification | generic_formal_part package_specification
ASIS describes generic specifications including the generic formal part as follows:
(A_Declaration, A_Generic_Procedure_Declaration) ::= generic {Generic_Formal_Parameters} procedure Names [({Parameters})]; (A_Declaration, A_Generic_Function_Declaration) ::= generic {Generic_Formal_Parameters} function Names [({Parameters})] return Return_Type; (A_Declaration, A_Generic_Procedure_Declaration) ::= generic {Generic_Formal_Parameters} package Names is {Visible_Part_Declarative_Items} [private {Private_Part_Declarative_Items}] end [Names];
The component functions are described as follows:
Generic_Formal_Parameters (0..N) ::= (A_Declaration, A_Generic_Formal_Function_Declaration | A_Generic_Formal_Object_Declaration | A_Generic_Formal_Private_Type_Declaration | A_Generic_Formal_Procedure_Declaration | A_Generic_Formal_Type_Declaration | A_Pragma) Names (1..1) ::= (An_Entity_Name_Definition) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Return_Type ::= (An_Expression, A_Selected_Component | A_Simple_Name) Visible_Part_Declarative_Items (1..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause) | (A_Use_Clause) Private_Part_Declarative_Items (1..N) ::= (A_Declaration) | (A_Pragma) | (A_Representation_Clause) | (A_Use_Clause)
Function Returns
Corresponding_Body The element representing the declaration of the generic body
ASIS describes generic-parameter declarations as follows:
(A_Declaration, A_Generic_Formal_Object_Declaration) ::= {Names} : Parameter_Mode_Kind Type_Mark [:= Initial_Value]; (A_Declaration, A_Generic_Formal_Type_Declaration) ::= type Names is Type_Declaration_Definition (A_Declaration, A_Generic_Formal_Private_Type_Declaration) ::= type Names [({Discriminants})] is Type_Declaration_Definition; (A_Declaration, A_Generic_Formal_Procedure_Declaration) ::= with procedure Names [({Parameters})] [is <>] | with procedure Names [({Parameters})] [is Generic_Formal_Subprogram_Default]} (A_Declaration, A_Generic_Formal_Function_Declaration) ::= with function Names [({Parameters})] return Return_Type [is <>] | with function Names [({Parameters})] return Return_Type [is Generic_Formal_Subprogram_Default]
The component functions are described as follows:
Names (1..N) ::= (An_Entity_Name_Definition) Parameter_Mode_Kind ::= Parameter_Mode_Kinds Type_Mark ::= (An_Expression) Initial_Value ::= (An_Expression) Type_Declaration_Definition ::= (A_Type_Definition) Discriminants ::= (A_Declaration, A_Discriminant_Specification) Parameters (0..N) ::= (A_Declaration, A_Parameter_Specification) Generic_Formal_Subprogram_Default ::= (An_Expression, | A_Character_Literal | A_Simple_Name | An_Enumeration_Literal | An_Operator_Symbol) Return_Type ::= (An_Expression, A_Selected_Component | A_Simple_Name)
ASIS describes generic-type definitions as follows:
generic_type_definitions ::= (A_Type_Definition, A_Generic_Discrete_Subtype_Definition) | (A_Type_Definition, A_Generic_Integer_Subtype_Definition) | (A_Type_Definition, A_Generic_Float_Subtype_Definition) | (A_Type_Definition, A_Generic_Fixed_Subtype_Definition) | (A_Type_Definition, A_Generic_Array_Type_Definition) | (A_Type_Definition, A_Generic_Access_Type_Definition)
12.2 Generic Bodies
(Ada83 LRM 12.2, Ada95 LRM 12.2)
See "5.6 Block Statements" for how to obtain the declarative part, sequence of statements, and exception handlers from the element representing the generic body block.
Function Returns
Corresponding_Specification The element representing the generic specification
12.3 Generic Instantiation
(Ada83 LRM 12.3, Ada95 LRM 12.3)
The LRM describes generic instantiations as follows:
(Ada83 LRM 12.3, Ada95 LRM 12.3) generic_instantiation ::= package identifier is new generic_package_name [generic_actual_part];
ASIS describes generic instantiations including the generic actual part as follows:
(A_Declaration, A_Package_Instantiation) ::= package Names is new Generic_Unit_Name [({Generic_Parameters})]; (A_Declaration, A_Procedure_Instantiation) ::= procedure Names is new Generic_Unit_Name [({Generic_Parameters})]; (A_Declaration, A_Function_Instantiation) ::= function Names is new Generic_Unit_Name [({Generic_Parameters})];
The component functions are described as follows:
Names (1..1) ::= (An_Entity_Name_Definition)
Generic_Unit_Name ::= (An_Expression, A_Selected_Component | A_Simple_Name | An_Operator_Symbol) Generic_Parameters (0..N) ::= (A_Parameter_Association)
ASIS describes generic associations including the generic formal and actual parameter components as follows:
(A_Parameter_Association) ::= [Formal_Parameter =>] Actual_Parameter
The component functions are described as follows:
Formal_Parameter ::= (An_Expression, A_Simple_Name) | (An_Entity_Name_Definition, A_Simple_Name)
Actual_Parameter ::= (An_Expression)
The Formal_Parameter function returns An_Expression if the A_Parameter_Association is from a normalized list; An_Entity_Name_Definition is returned from an unnormalized list.
Function Returns
Is_Normalized Whether the parameter association was obtained from a normalized list
Is_Parameter_Association Whether the specified element represents a parameter association
13. Representation Clauses and Implementation-Dependent FeaturesThe following LRM sections have related functions or concepts in ASIS:
- 13.1 Representation Clauses
- 13.2 Length Clauses
- 13.3 Enumeration-Representation Clauses
- 13.4 Record Representation Clauses
- 13.5 Address Clauses
- 13.8 Machine Code Insertions
13.1 Representation Clauses
(Ada83 LRM 13.1, Ada95 LRM 13.1)
The LRM describes representation clauses as follows:
(Ada83 LRM 13.1, Ada95 LRM 13.1) representation_clause ::= type_representation_clause | address_clause
ASIS categorizes representation clauses by Representation_Clause_Kinds as follows:
representation_clause ::= type_representation_clause | (A_Representation_Clause, An_Address_Clause) type_representation_clause ::= (A_Representation_Clause, A_Length_Clause) | (A_representation_Clause, A_Record_Representation_Clause) | (A_Representation_Clause, An_Enumeration_Representation_Clause)
To determine what Representation_Clause_Kinds is represented, call the Kind function.
Function Returns
Associated_Type The type definition of the type named in the specified representation clause
13.2 Length Clauses
(Ada83 LRM 13.2, Ada95 LRM 13.3(7))
The LRM describes length clauses as follows:
(Ada83 LRM 13.2, Ada95 LRM 13.3(7)) length_clause ::= for attribute use simple_expression;
ASIS describes length clauses as follows:
(A_Representation_Clause, A_Length_Clause) ::= for Length_Clause_Attribute use Length_Clause_Simple_Expression;The component functions are described as follows:
Length_Clause_Attribute ::= (An_Expression, An_Attribute) Length_Clause_Simple_Expression ::= (An_Expression)
To determine what Length_Clause_Attribute_Kind is represented, call the Length_Clause_Attribute_Kind function.
Function Returns
Associated_Length_Clause_Representations A list containing the length clauses associated with the specified type definition
13.3 Enumeration-Representation Clauses
(Ada83 LRM 13.3, Ada95 LRM 13.4)
The LRM describes enumeration-representation clauses as follows:
(Ada83 LRM 13.3, Ada95 LRM 13.4 enumeration_representation_clause ::= for type_simple_name use aggregate;
ASIS describes enumeration-representation clauses as follows:
(A_Representation_Clause, An_Numeration_Representation_Clause ::= for Enumeration_Representation_Clause_- Type_Simple_Name use Enumeration_Representation_- Clause_Aggregate;
The component functions are described as follows:
Enumeration_Representation_Clause_- Type_Simple_Name ::= (An_Expression, A_Simple_Name) Enumeration_Representation_- Clause_Aggregate ::= (An_Expression, An_Aggregate)
Function Returns
Associated_Enumeration_Type_Representation The enumeration representation clause associated with the specified type definition
13.4 Record Representation Clauses
(Ada83 LRM 13.4, Ada95 LRM 13.5.1)
The LRM describes record representation clauses as follows:
(Ada83 LRM 13.4, Ada95 LRM 13.5.1) record_representation_clause ::= for type_simple_name use record [alignment_clause] {component_clause} end record;
ASIS describes record representation clauses, including the alignment clause, as follows:
(A_Representation_Clause, A_Record_Representation_Clause) ::= for Record_Representation_Clause_- Type_Simple_Name use record [at mod Record_Representation_- Clause_Alignment_Clause_- Expression;] {Component_Clauses} end record;
The component functions are described as follows:
Record_Representation_Clause_- Type_Simple_Name ::= (An_Expression, A_Simple_Name) Record_Representation_- Clause_Alignment_Clause_Expression ::= (An_Expression) Component_Clauses (0..N) ::= (A_Declaration, A_Component_Declaration)
Function Returns
Associated_Record_Type_Representation The record representation clause associated with the specified type definition
ASIS describes component clauses as follows:
(A_Declaration, A_Component_Declaration) ::= Component_Clause_Name at Component_Clause_Relative_Address range Component_Clause_Range;
The component functions are described as follows:
Component_Clause_Name ::= (An_Expression, A_Simple_Name | An_Attribute) Component_Clause_Relative_Address ::= (An_Expression) Component_Clause_Range ::= (A_Discrete_Range, A_Simple_Range)
13.5 Address Clauses
(Ada83 LRM 13.5, Ada95 LRM 13.3(12))
The LRM describes address clauses as follows:
(Ada83 LRM 13.5, Ada95 LRM 13.3(12) address_clause::= for simple_name use at simple_expression;
ASIS describes address clauses as follows:
(A_Representation_Clause, An_Address_Clause) ::= for Address_Clause_Simple_Name use at Address_Clause_Simple_Expression;
The component functions are described as follows:
Address_Clause_Simple_Name ::= (An_Expression, A_Simple_Name) Address_Clause_Simple_Expression ::= (An_Expression)
Function Returns
Associated_Address_Representation The address representation clause associated with the specified type definition
13.8 Machine Code Insertions
(Ada83 LRM 13.8, Ada95 LRM 13.8)
The LRM describes machine code insertions as follows:
(Ada83 LRM 13.8, Ada95 LRM 13.8) code_statement ::= type_mark'record_aggregate;
ASIS describes machine code insertions as follows:
(A_Statement, A_Code_Statement) ::= Qualified_Expression
The component function is described as follows:
Qualified_Expression ::= (An_Expression, A_Qualified_Expression)
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2002, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |