![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Type Expression_Kinds
type Expression_Kinds is (...);Expanded Name Asis.Expressions.Expression_Kinds
Describes the kinds of expressions available.
Description
The Expression_Kinds values do not correspond directly to a single syntactic construct or to a group of syntactic constructs. The enumeration values represent a minimal set of terminal and terminal elements that make up an expression. Most elements can be found in the syntactic definition of name and the composite constructs that make up name.
The meanings of four of the enumeration values in Expression-_Kinds are overloaded. To determine precisely what Expres-sion_Kinds represents, you must know what Elements.Element-_Kinds is represented.
The four Expression_Kinds values are:
- A_Character_Literal
- A_Simple_Name
- An_Enumeration_Literal
- An_Operator_Symbol
If the Element_Kinds is An_Entity_Name_Definition, each of the above represents a declaration.
If the Element_Kinds is An_Expression, each of the above represents a reference.
Enumerations
A_Character_LiteralIndicates that the element represents a character-literal declaration or reference (Ada83 LRM 2.5, Ada95 LRM 2.5).
A_Function_CallIndicates that the element represents a function call (Ada83 LRM 6.4, Ada95 LRM 6.4). Note that operators are defined as function calls. You must use the Prefix function to obtain the element that represents the operator symbol.
A_Null_LiteralIndicates that the element represents the reserved word null (Ada83 LRM 3.8, Ada95 LRM 3.8).
A_Parenthesized_ExpressionIndicates that the element represents an expression enclosed within parentheses (Ada83 LRM 4.4, Ada95 LRM 4.4).
A_Qualified_ExpressionIndicates that the element represents a qualified expression (Ada83 LRM 4.7, Ada95 LRM 4.7).
A_Real_LiteralIndicates that the element represents a universal real literal (Ada83 LRM 2.4, Ada95 LRM 2.4).
A_Selected_ComponentIndicates that the element represents a selected component (Ada83 LRM 4.1.3, Ada95 LRM 4.1.3).
A_Simple_NameIndicates that the operator represents a simple-name declaration or reference (Ada83 LRM 4.1, Ada95 LRM 4.1).
A_SliceIndicates that the element represents a slice (Ada83 LRM 4.1.2, Ada95 LRM 4.1.2).
A_Special_OperationIndicates that the element represents a short-circuit control form (Ada83 LRM 4.5.1, Ada95 LRM 4.5.1) or a membership test (Ada83 LRM 4.5.2, Ada95 LRM 4.5.2).
A_String_LiteralIndicates that the element represents a string literal (Ada83 LRM 2.6, Ada95 LRM 2.6).
A_Type_ConversionIndicates that the element represents a type conversion (Ada83 LRM 4.6, Ada95 LRM 4.6).
An_AggregateIndicates that the element represents an aggregate (Ada83 LRM 4.3, Ada95 LRM 4.3).
An_Allocation_From_Qualified_ExpressionIndicates that the element represents an allocation from an expression (Ada83 LRM 4.8, Ada95 LRM 4.8).
An_Allocation_From_SubtypeIndicates that the element represents an allocation from a subtype designator (Ada83 LRM 4.8, Ada95 LRM 4.8).
An_AttributeIndicates that the element represents an attribute designator (Ada83 LRM 4.1.4, Ada95 LRM 4.1.4).
An_Enumeration_LiteralIndicates that the element represents an enumeration literal declaration or reference (Ada83 LRM 3.5.1, Ada95 LRM 3.5.1).
An_Indexed_ComponentIndicates that the element represents an indexed component (Ada83 LRM 4.1.1, Ada95 LRM 4.1.1).
An_Integer_LiteralIndicates that the element represents a universal integer literal (Ada83 LRM 2.4, Ada95 LRM 2.4).
An_Operator_SymbolIndicates that the element represents a function declaration or reference (Ada83 LRM 4.5, Ada95 LRM 4.5). Operator symbols do not include short-circuit control forms or membership tests. These are defined as A_Special_Operation.
Not_An_ExpressionIndicates that the element does not represent a component of an expression.
Cross-References
Related subprograms and types:
Function Expression_Parenthesized
function Expression_Parenthesized (Expression : in Asis.Expression) return Asis.Expression;Expanded Name Asis.Expressions.Expression_Parenthesized
Returns the expression, within parentheses, from the specified expression.
Description
Primaries are defined by the following syntax:
primary ::=
numeric_literal | null | aggregate
| string_literal | name | allocator
| function_call | type_conversation
| qualified_expression | (expression)This function returns the expression, from within the parentheses, of the specified primary expression.
The returned expression may in turn be a parenthesized
expression.Parameters
Expression : in Asis.Expression;Specifies the expression that should be queried. The expression must be of the following kinds:
Element_Kinds Expression_Kinds
An_Expression A_Parenthesized_Expression
return Asis.Expression;The returned element is of the following kind:
Element_Kinds
An_Expression
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
- "Parenthetical Expressions"
- Ada83 LRM 4.4, Ada95 LRM 4.4
Function Expression_Type
function Expression_Type (Expression : in Asis.Expression) return Asis.Type_Definition;Expanded Name Asis.Expressions.Expression_Type
Returns the type definition for the specified expression.
Description
The function does not unwind subtypes or derived types to obtain the base type definition. You can call functions in package Declarations to perform these operations.
If an expression does not have a type definition, Asis.Nil_Element is returned.
There is one class of expression that does not have a type and another class that might not have a type:
- Expressions that name packages, subprograms, tasks, names of types, and so on do not have types. Such expressions appear in with clauses, use clauses, type declarations, and other places.
- Expressions that represent the actual parameters from a pragma might not have a type. Such expressions might reference a package, subprogram, task, and so on or name a keyword that a particular compiler recognizes.
If an actual parameter from a pragma has a type definition, the expression is either an ordinary expression or a naming expression that names a constant or variable object.
If an actual parameter from a pragma has no type definition, you can call Name_Definition and Name_Declaration to determine whether the expression is a naming expression that specifies a package, subprogram, task, or other name. If Name_Definition raises Asis_Failed, the actual parameter references an expression that does not follow Ada rules.
For example, in pragma Private_Part (Open => Yes);, the expression Yes represents a keyword and has no associated type definition. On the other hand, in pragma Pack (Buffers);, the expression Buffers references a type and thus has a type definition.
Parameters
Expression : in Asis.Expression;Specifies the expression that should be queried. The expression must be of the following kind:
Element_Kinds
An_Expression
return Asis.Type_Definition;The returned element is of the following kind:
Element_Kinds
A_Type_Definition
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.
Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete compilation unit.Examples
Cross-References
Function Function_Call_Parameters
function Function_Call_Parameters (Expression : in Asis.Expression; Normalized : in Boolean := False) return Asis.Association_List;Expanded Name Asis.Expressions.Function_Call_Parameters
Returns a list containing the parameter associations from the specified function-call expression.
Description
Function calls are partially defined by the following syntax:
function_call ::=
function_name [actual_parameter_part]parameter_association ::=
[formal_parameter =>] actual_parameterThis function returns a list of the parameter associations for the specified function call.
An ASIS implementation may choose to always normalize function-call parameter lists and include defaulted parameters in the list. If function-call parameter lists are always normalized, this function behaves as if the Normalized parameter has been specified as True.
- It contains only those arguments that appear in the source code and is ordered according to their order of appearance.
- The parameter associations are never Elements.Is_Equal to parameter associations from a normalized list.
- It includes defaulted parameters and is ordered according to their order of appearance in the declaration of the formal parameters.
- The parameter associations are Is_Normalized.
- The parameter associations are Declarations.Is_Part_Of-_Implicit.
For more information on parameter names, defaulted parameters, and list normalization, see package Environment, "Default Parameter Processing" and "Normalization of Parameter Lists," the Environment.Function_Call_Parameters_Include_Defaults function, and the Environment.Function_Call_Parameters-_Normalized function.
Use the Statements.Formal_Parameter and Statements.Actual-_Parameter functions to analyze the returned parameter
associations.Parameters
Expression : in Asis.Expression;Specifies the function call that should be queried. The expression must be of the following kinds:
Element_Kinds Expression_Kinds
An_Expression A_Function_Call
An_Attribute (function)
Normalized : in Boolean := False;Specifies whether the parameter list should contain normalized or unnormalized associations.
return Asis.Association_List;The returned list contains elements of the following kind:
Element_Kinds
A_Parameter_Association
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 Is_Normalized
- function Declarations.Is_Part_Of_Implicit
- function Elements.Is_Equal
- function Environment.Function_Call_Parameters-
_Include_Defaults- function Environment.Function_Call_Parameters-
_Normalized- function Statements.Actual_Parameter
- function Statements.Formal_Parameter
- "Processing Function Calls"
- package Environment, "Default Parameter Processing"
- package Environment, "Normalization of Parameter Lists"
- Ada83 LRM 6.4, Ada95 LRM 6.4
- Ada83 LRM 9.5, Ada95 LRM 9.5
Function In_Range_Operation_Right_Hand_Side
function In_Range_Operation_Right_Hand_Side (Expression : in Asis.Expression) return Asis.Range_Constraint;Expanded Name Asis.Expressions.In_Range_Operation_Right_Hand_Side
Returns the range component of the specified membership-test expression.
Description
Relations are defined by the following syntax:
relation ::=
simple_expression
[relational_operator simple_expression]
| simple_expression [not] in range
| simple_expression [not] in type_markThis function returns the range of the specified membership-test relation.
Parameters
Expression : in Asis.Expression;$ K to ELF: You indicated you wanted the below heading to go to three lines and I went ahead and did that. However, as I remember from talking to Judith the lack of hyphens and the `_' being at the end of the line is a no-no. I added hyphens, put the `_' at the front of the line, even tried adding some spaces and it all looked ugly. It think it looks best as shown and have updated all the tables the same way. When you decide how you really want it to look you can find them pretty quickly by looking for `Special_\r'.
Specifies the membership-test expression that should be queried. The expression must be of the following kinds:
Element_Kinds Expression_Kinds Special_
Operation_
Kinds
An_Expression A_Special_Operation A_Not_In_Range
An_In_Range
return Asis.Range_Constraint;The returned element is of the following kind:
Element_Kinds
A_Constraint
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 Special_Operation_Kind
- function Type_Definitions.Constraint_Kind
- function Type_Definitions.Lower_Bound
- function Type_Definitions.Upper_Bound
- "Processing Membership Tests"
- Ada83 LRM 4.4, Ada95 LRM 4.4
Function In_Type_Operation_Right_Hand_Side
function In_Type_Operation_Right_Hand_Side (Expression : in Asis.Expression) return Asis.Expression;Expanded Name Asis.Expressions.In_Type_Operation_Right_Hand_Side
Returns the type-mark component of the specified membership- test expression.
Description
Relations are defined by the following syntax:
relation ::=
simple_expression
[relational_operator simple_expression]
| simple_expression [not] in range
| simple_expression [not] in type_markThis function returns the type mark of the specified membership- test relation.
Parameters
Expression : in Asis.Expression;Specifies the membership-test expression that should be queried. The expression must be of the following kinds:
Element_Kinds Expression_Kinds Special_
Operation_
Kinds
An_Expression A_Special_Operation A_Not_In_Type
An_In_Type
return Asis.Expression;The returned element is of the following kind:
Element_Kinds Expression_Kinds
An_Expression A_Selected_Component
A_Simple_Name
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
- "Processing Membership Tests"
- Ada83 LRM 4.4, Ada95 LRM 4.4
Function Index_Expressions
function Index_Expressions (Expression : in Asis.Expression) return Asis.Expression_List;Expanded Name Asis.Expressions.Index_Expressions
Returns a list of the expressions in the specified indexed-
component expression.Description
Indexed components are defined by the following syntax:
Ada83 LRM 4.1.1, Ada95 LRM 4.1.1
indexed_component ::=
prefix(expression {, expression})This function returns a list of the expressions in the specified indexed component.
The expressions are returned in their order of appearance in the source code.
Parameters
Expression : in Asis.Expression;Specifies the indexed component that should be queried. The expression must be of the following kinds:
Element_Kinds Expression_Kinds
An_Expression An_Indexed_Component
return Asis.Expression_List;The returned list contains elements of the following kind:
Element_Kinds
An_Expression
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
- "Processing Indexed Components"
- Ada83 LRM 4.1.1, Ada95 LRM 4.1.1
Function Is_Derived
function Is_Derived (Reference : in Asis.Element) return Boolean;Expanded Name Asis.Expressions.Is_Derived
Returns a Boolean value indicating whether the specified entity reference is to a derived subprogram.
Description
A derived type definition defines a new (base) type whose characteristics are derived from those of a parent type (Ada83 LRM 3.4, Ada95 LRM 3.4). Certain subprograms that are operations of the parent type are said to be derivable. For each derivable subprogram of the parent type, there is a a corresponding derived subprogram for the derived type.
This function returns True if the specified entity reference is to a derived subprogram.
Elements of any portion of this subprogram declaration test as Declarations.Is_Part_Of_Derived.
- Use Expression_Type to obtain the type definition that created this subprogram.
- Use Name_Definition to obtain the declaration of the
subprogram.Parameters
Reference : in Asis.Element;Specifies the entity reference that should be queried. The reference must be of the following kinds:
return Boolean;Returns True for all elements in the above table that represent derived subprograms and False for all other elements.
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.
Examples
Cross-References
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |