TOC PREV NEXT INDEX DOC LIST MASTER INDEX




Type Expression_Kinds

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:

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

Indicates that the element represents a character-literal declaration or reference (Ada83 LRM 2.5, Ada95 LRM 2.5).

Indicates 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.

Indicates that the element represents the reserved word null (Ada83 LRM 3.8, Ada95 LRM 3.8).

Indicates that the element represents an expression enclosed within parentheses (Ada83 LRM 4.4, Ada95 LRM 4.4).

Indicates that the element represents a qualified expression (Ada83 LRM 4.7, Ada95 LRM 4.7).

Indicates that the element represents a universal real literal (Ada83 LRM 2.4, Ada95 LRM 2.4).

Indicates that the element represents a selected component (Ada83 LRM 4.1.3, Ada95 LRM 4.1.3).

Indicates that the operator represents a simple-name declaration or reference (Ada83 LRM 4.1, Ada95 LRM 4.1).

Indicates that the element represents a slice (Ada83 LRM 4.1.2, Ada95 LRM 4.1.2).

Indicates 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).

Indicates that the element represents a string literal (Ada83 LRM 2.6, Ada95 LRM 2.6).

Indicates that the element represents a type conversion (Ada83 LRM 4.6, Ada95 LRM 4.6).

Indicates that the element represents an aggregate (Ada83 LRM 4.3, Ada95 LRM 4.3).

Indicates that the element represents an allocation from an expression (Ada83 LRM 4.8, Ada95 LRM 4.8).

Indicates that the element represents an allocation from a subtype designator (Ada83 LRM 4.8, Ada95 LRM 4.8).

Indicates that the element represents an attribute designator (Ada83 LRM 4.1.4, Ada95 LRM 4.1.4).

Indicates that the element represents an enumeration literal declaration or reference (Ada83 LRM 3.5.1, Ada95 LRM 3.5.1).

Indicates that the element represents an indexed component (Ada83 LRM 4.1.1, Ada95 LRM 4.1.1).

Indicates that the element represents a universal integer literal (Ada83 LRM 2.4, Ada95 LRM 2.4).

Indicates 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.

Indicates that the element does not represent a component of an expression.

Cross-References

Related subprograms and types:

Related concept:


Function Expression_Parenthesized

Expanded Name Asis.Expressions.Expression_Parenthesized

Returns the expression, within parentheses, from the specified expression.

Description

Primaries are defined by the following syntax:

Ada83 LRM 4.4, Ada95 LRM 4.4

 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

Specifies the expression that should be queried. The expression must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Expression
A_Parenthesized_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

Related concepts:


Function Expression_Type

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:

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

Specifies the expression that should be queried. The expression must be of the following kind:
Element_Kinds

An_Expression

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

Related subprograms:

Related concept:


Function Function_Call_Parameters

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:

Ada83 LRM 6.4, Ada95 LRM 6.4

 function_call ::=
  function_name [actual_parameter_part]

 parameter_association ::=
  [formal_parameter =>] actual_parameter

This 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.

If a list is unnormalized:

If a list is normalized:

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

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)

Specifies whether the parameter list should contain normalized or unnormalized associations.

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

Related subprograms:

Related concepts:


Function In_Range_Operation_Right_Hand_Side

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:

Ada83 LRM 4.4, Ada95 LRM 4.4

 relation ::=
   simple_expression
    [relational_operator simple_expression]
  | simple_expression [not] in range
  | simple_expression [not] in type_mark

This function returns the range of the specified membership-test relation.

Parameters

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

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

Related subprograms:

Related concepts:


Function In_Type_Operation_Right_Hand_Side

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:

Ada83 LRM 4.4, Ada95 LRM 4.4

 relation ::=
   simple_expression
    [relational_operator simple_expression]
  | simple_expression [not] in range
  | simple_expression [not] in type_mark

This function returns the type mark of the specified membership- test relation.

Parameters

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

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

Related subprogram:

Related concepts:


Function Index_Expressions

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

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

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

Related subprogram:

Related concepts:


Function Is_Derived

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.

For further analysis:

Parameters

Specifies the entity reference that should be queried. The reference must be of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

An_Expression
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

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

Related subprograms:

Related concepts:


Rational Software Corporation  http://www.rational.com
support@rational.com
techpubs@rational.com
Copyright © 1993-2001, Rational Software Corporation. All rights reserved.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS