![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Is_Equal
function Is_Equal (Left : in Asis.Element; Right : in Asis.Element) return Boolean;Expanded Name Asis.Elements.Is_Equal
Returns a Boolean value indicating whether the specified elements represent the same physical semantic component from the same physical compilation unit.
Description
- The elements represent the same physical element. The elements need not have been obtained from a compilation unit obtained from the same library value.
- The elements are both equal to Asis.Nil_Element.
Otherwise, this function returns False.
Parameters
Left : in Asis.Element;
Right : in Asis.Element;
return Boolean;Returns True if the specified elements represent the same physical semantic component from the same physical compilation unit.
Errors
Examples
Cross-References
Function Is_Identical
function Is_Identical (Left : in Asis.Element; Right : in Asis.Element) return Boolean;Expanded Name Asis.Elements.Is_Identical
Returns a Boolean value indicating whether the specified elements represent the same physical semantic component from the same physical compilation unit and were derived from the same library variable.
Description
- The elements represent the same physical element, from the same compilation unit, obtained from the same library value.
- The elements are both equal to Asis.Nil_Element.
Otherwise, this function returns False.
Parameters
Left : in Asis.Element;
Right : in Asis.Element;
return Boolean;Returns True if the specified elements represent the same physical semantic component from the same physical compilation unit and were derived from the same library variable.
Errors
Examples
Cross-References
Function Is_Nil
function Is_Nil (Right : in Asis.Element) return Boolean;
function Is_Nil (Right : in Asis.Element_List) return Boolean;Expanded Name Asis.Elements.Is_Nil
Returns a Boolean value indicating whether the specified element list has a 'Length attribute value of 0 or the specified element is Asis.Nil_Element.
Description
An element is nil if its value is Asis.Nil_Element.
An element list is nil if the value of its 'Length attribute is 0.
Parameters
Right : in Asis.Element_List;Specifies the element list to query.
Right : in Asis.Element;Specifies the element to query.
return Boolean;Returns True if the specified element list has a 'Length attribute value of 0 or the specified element is Asis.Nil_Element.
Errors
Examples
Cross-References
Function Is_Predefined
function Is_Predefined (Pragma_Element : in Asis.Pragma_Element) return Boolean;Expanded Name Asis.Elements.Is_Predefined
Returns a Boolean value indicating whether the specified pragma element represents a predefined language pragma (LRM Annex B).
Description
The predefined language pragmas are defined in Annex B of the LRM. Type Pragma_Kinds includes a value for each predefined language pragma, as well as An_Implementation_Defined-
_Pragma, An_Unknown_Pragma, and Not_A_Pragma.Is_Predefined returns True if the value returned by the Name function corresponds to a Pragma_Kinds enumeration value other than An_Implementation_Defined_Pragma, An_Unknown_Pragma, and Not_A_Pragma.
A pragma that does not test as Is_Predefined may be An_Implementation_Defined_Pragma or An_Unknown_Pragma. You can determine which by calling the Pragma_Kind function.
Process implementation-defined or unknown pragmas based on the name of the pragma. The name can be obtained with the Name function.
Parameters
Pragma_Element : in Asis.Pragma_Element;Specifies the pragma to query. The pragma element must be of the following kind
Element_Kinds
A_Pragma
:
return Boolean;Returns True for all elements in the above table that also represent a predefined language pragma and False for all other elements.
Errors
Examples
Cross-References
Function Name
function Name (Pragma_Element : in Asis.Pragma_Element) return String;Expanded Name Asis.Elements.Name
Returns the name of the specified pragma.
Description
Pragmas are partially defined by the following syntax:
pragma ::=
pragma identifier [(argument_association
{, argument_association})];This function returns the identifier of the specified pragma.
The case of names returned by this function will vary among vendors. Vendors are encouraged, but not required, to return names in the same case used in the original compilation text.
The case of the returned name from Rational ASIS under Apex has not yet been determined.
To be supplied: Update this when it is known.
Parameters
Pragma_Element : in Asis.Pragma_Element;Specifies the pragma that should be queried. The pragma element must be of the following kind:
Element_Kinds
A_Pragma
return String;Returns the name of the specified pragma.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a Library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
Function Pragma_Kind
function Pragma_Kind (Pragma_Element : Asis.Pragma_Element) return Pragma_Kinds;Expanded Name Asis.Elements.Pragma_Kind
Returns the kind of the specified pragma.
Description
Elements of kind A_Pragma are returned in the following lists:
- Component_Clause_List
- Context_Clause_List
- Declarative_Item_List
- Element_List
- Generic_Formal_Parameter_List
- Pragma_Element_List
- Record_Component_List
- Statement_List
- Variant_Component_List
Most of the functions that return the above kinds of lists contain an Include_Pragmas parameter. If Include_Pragmas is specified as True, A_Pragma elements are included in the returned list; otherwise, they do not appear in the returned list. This allows you to ignore pragmas while processing the constructs related to these interfaces.
A Pragma_Element_List is returned by the Associated_Pragmas and Pragmas functions. These functions allow you to obtain the pragmas associated with a statement or declaration, or within a context. Contexts include structures such as statement lists and declarative regions.
Parameters
Pragma_Element : Asis.Pragma_Element;Specifies the pragma that should be queried. The pragma element must be of the following kind:
Element_Kinds
A_Pragma
return Pragma_Kinds;Returns the kind of the specified pragma. If an unexpected element is specified, Not_A_Pragma is returned.
Errors
Examples
Cross-References
Related subprograms and types:
Type Pragma_Kinds
type Pragma_Kinds is (...);Expanded Name Asis.Elements.Pragma_Kinds
Describes the kinds of pragmas available.
Description
Elements that represent pragmas fall into three categories:
- Those defined in Annex B of the LRM. These pragmas are Is_Predefined and each has an assigned enumeration value as shown in the table in the "Enumerations" section.
- Those that are not defined in the Annex but are known to the compiler. These pragmas have an enumeration value of An_Implementation_Defined_Pragma.
- Those that are not known to the compiler. These pragmas have an enumeration value of An_Unknown_Pragma.
The enumeration value Not_A_Pragma is reserved for those elements that do not represent pragmas.
Enumerations
The pragma name associated with each enumeration value is presented below. The third column indicates the paragraph number in LRM Annex B where the pragma is described.
Cross-References
Function Pragmas
function Pragmas (Context : in Asis.Element) return Asis.Pragma_Element_List;Expanded Name Asis.Elements.Pragmas
Returns a list of the pragmas that exist within the specified context.
Description
The pragmas are returned in their order of appearance in the source code.
Only the pragmas that exist immediately within the specified context are returned. For example, if a declarative region contains pragmas as well as a record type definition that contains pragmas, this function will return, when provided with the context of the declarative region, only those pragmas directly within the region. If the function is provided with the context of the record type definition, it returns the pragmas contained within the record type definition.
If there are no pragmas in the specified context, Asis.Nil_Element-_List is returned.
Most functions that return lists of declarations, declaration components (such as record variants), and statements contain an Include_Pragmas parameter. The Include_Pragmas parameter specifies whether pragmas included within the context provided to these functions should be included in the returned lists. This function returns the same pragma definitions that can appear as components of those returned lists.
Parameters
Context : in Asis.Element;Specifies the context that should be queried. The context must be of the following kinds:
return Asis.Pragma_Element_List;The returned list contains elements of the following kind:
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a Library variable that is no longer open or a parameter is specified that is not appropriate for the query.
Examples
Cross-References
Type Traverse_Control
type Traverse_Control is (...);Expanded Name Asis.Elements.Traverse_Control
Defines the methods of element-tree traversal.
Description
Enumerations
Abandon_ChildrenPrevents traversal of the current element's child elements. Traversal resumes with the next sibling element of the current element. In a Post_Operation procedure, this is the same as Continue, because all child elements will already have been traversed.
Abandon_SiblingsPrevents the traversal of the current element's sibling elements. Traversal resumes with the parent element. In a Pre_Operation procedure, this skips the associated Post_Operation.
Siblings are found in association lists of subprogram calls, entry calls, generic instantiations, discriminants, and pragmas.
ContinueContinues the normal traversal.
TerminateTerminates the traversal. Neither the Pre_Operation nor the Post_Operation procedure is called for any additional elements.
Cross-References
Generic Procedure Traverse_Element
generic type State_Information is limited private; with procedure Pre_Operation (Element : in Asis.Element; Control : in out Elements.Traverse_Control; State : in out State_Information) is <>; with procedure Post_Operation (Element : in Asis.Element; Control : in out Elements.Traverse_Control; State : in out State_Information) is <>;procedure Traverse_Element (Element : in Asis.Element; Control : in out Elements.Traverse_Control; State : in out State_Information);Expanded Name Asis.Elements.Traverse_Element
Traverses the specified element and all its component elements, in top-to-bottom and left-to-right order.
Description
A component element is a child element. The child's parent element is its enclosing element. Child elements with the same parent element are sibling elements of each other.
In typical use, the Control parameter is set to Continue. At this setting, the formal procedure Pre_Operation is called when first visiting an element. All component elements are then visited, and finally the formal procedure Post_Operation is called when returning from visiting all component elements.
Regardless of the initial setting of Control, the formal procedure Pre_Operation is called with the initially specified element.
You can change the value of the Control parameter to alter what portions of the element tree are traversed. The effect of each Traverse_Control value is described in the following table:
Traversal of Implicit Elements
Elements that are Declarations.Is_Part_Of_Implicit are not normally reached by a traversal that starts with an element that is not Is_Part_Of_Implicit. This means that implicit predefined and implicit derived subprogram declarations are not visited when A_Type_Definition is traversed, generic instances are not visited when a generic instantiation is traversed, and all parameter and argument lists are traversed in their unnormalized forms.
- The not and equals (=) elements that are implicitly created if the Ada library content does not support the inequality (/=) operator. See package Declarations, "Equality Operators," for more information.
- The Return_Type of an enumeration literal specification. See package Type_Definitions, "Processing Enumeration-Type Definitions," for more information.
Element structures that are Is_Part_Of_Implicit can be traversed by starting the traversal with an Is_Part_Of_Implicit element. Typically, the traversal will start with the outermost enclosing element. This would be any of:
- A predefined or derived subprogram, operator, or attribute declaration
- A normalized association
- A derived subtype declaration
- A derived enumeration literal specification
- A generic instance (specification or body)
- An inherited representation clause
Implicit declarations, generic instances, and normalized parameter and argument lists can be made part of a traversal by explicitly calling the appropriate interfaces when a type definition, generic instantiation, call, or aggregate is encountered.
Traversal of Association Lists
Argument association lists for procedure calls, function calls, entry calls, generic instantiations, and aggregates are traversed in their unnormalized forms.
Applications that need to traverse the normalized association list can do so by querying at the appropriate locations to obtain the normalized list. This list then can be traversed by calling the instantiation of the traversal generic for each element. Once the association list traversal has completed, you can skip the unnormalized list and continue the traversal with the appropriate element by setting the Control parameter to Abandon_Children.
Parameters
type State_Information is limited private;Specifies a user-defined type that contains state information pertinent to the calling application.You must specify a value of this type when calling the Traverse_Element procedure. This value is then provided by ASIS to your Pre_Operation and Post_Operation procedures.
with procedure Pre_Operation (Element : in Asis.Element; Control : in out Elements.Traverse_Control; State : in out State_Information) is <>;Specifies the procedure ASIS should call when first visiting an element on the way down the tree. You can set the value of the Control parameter to indicate how the traversal should proceed.
with procedure Post_Operation (Element : in Asis.Element; Control : in out Elements.Traverse_Control; State : in out State_Information) is <>;Specifies the procedure ASIS should call when returning from visiting all component elements on the way up the tree. You can set the value of the Control parameter to indicate how the traversal should proceed.
Element : in Asis.Element;Specifies the element where the traversal should begin. This element is considered to be part of the tree being traversed. At a minimum, Pre_Operation is called with this element.
Control : in out Elements.Traverse_Control;Specifies how the tree traversal should proceed.
State : in out State_InformationSpecifies user-defined state information.
Errors
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a Library variable that is no longer open.
Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if Asis.Nil_Element is specified.
Examples
Cross-References
Related subprograms and types:
- type Traverse_Control
- procedure Traverse_Element.Post_Operation
- procedure Traverse_Element.Pre_Operation
Package Operations
package Operations is -- For Asis.Elements and Asis.Element_List function "&" (Left : Asis.Element_List; Right : Asis.Element_List) return Asis.Element_List; function "&" (Left : Asis.Element_List; Right : Asis.Element) return Asis.Element_List; function "&" (Left : Asis.Element; Right : Asis.Element_List) return Asis.Element_List; function "&" (Left : Asis.Element; Right : Asis.Element) return Asis.Element_List; function Is_Nil (Right : Asis.Element) ... function Is_Nil (Right : Asis.Element_List) ... function Is_Equal (Left, Right : Asis.Element) ... function Is_Identical (Left, Right : Asis.Element) ... -- For Element_Kinds function "=" (Left, Right : ... -- For Pragma_Kinds function "=" (Left, Right : ...end Operations;Expanded Name Asis.Elements.Operations
Package Operations provides a simple way to obtain visibility to operators for types used in package Elements. The package typically is referenced in a use clause by an application.
Cross-References
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |