| ------------------------------------------------------------------------------ |
| -- -- |
| -- GNAT COMPILER COMPONENTS -- |
| -- -- |
| -- S I N F O -- |
| -- -- |
| -- S p e c -- |
| -- -- |
| -- Copyright (C) 1992-2004, Free Software Foundation, Inc. -- |
| -- -- |
| -- GNAT is free software; you can redistribute it and/or modify it under -- |
| -- terms of the GNU General Public License as published by the Free Soft- -- |
| -- ware Foundation; either version 2, or (at your option) any later ver- -- |
| -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- |
| -- for more details. You should have received a copy of the GNU General -- |
| -- Public License distributed with GNAT; see file COPYING. If not, write -- |
| -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- |
| -- MA 02111-1307, USA. -- |
| -- -- |
| -- As a special exception, if other files instantiate generics from this -- |
| -- unit, or you link this unit with other files to produce an executable, -- |
| -- this unit does not by itself cause the resulting executable to be -- |
| -- covered by the GNU General Public License. This exception does not -- |
| -- however invalidate any other reasons why the executable file might be -- |
| -- covered by the GNU Public License. -- |
| -- -- |
| -- GNAT was originally developed by the GNAT team at New York University. -- |
| -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| -- -- |
| ------------------------------------------------------------------------------ |
| |
| -- This package defines the structure of the abstract syntax tree. The Tree |
| -- package provides a basic tree structure. Sinfo describes how this |
| -- structure is used to represent the syntax of an Ada program. |
| |
| -- Note: the grammar used here is taken from Version 5.95 of the RM, dated |
| -- November 1994. The grammar in the RM is followed very closely in the tree |
| -- design, and is repeated as part of this source file. |
| |
| -- The tree contains not only the full syntactic representation of the |
| -- program, but also the results of semantic analysis. In particular, the |
| -- nodes for defining identifiers, defining character literals and defining |
| -- operator symbols, collectively referred to as entities, represent what |
| -- would normally be regarded as the symbol table information. In addition |
| -- a number of the tree nodes contain semantic information. |
| |
| -- WARNING: There is a C version of this package. Any changes to this |
| -- source file must be properly reflected in this C header file sinfo.h |
| -- which is created automatically from sinfo.ads using xsinfo.spt. |
| |
| with Types; use Types; |
| with Uintp; use Uintp; |
| with Urealp; use Urealp; |
| |
| package Sinfo is |
| |
| --------------------------------- |
| -- Making Changes to This File -- |
| --------------------------------- |
| |
| -- If changes are made to this file, a number of related steps must be |
| -- carried out to ensure consistency. First, if a field access function |
| -- is added, it appears in seven places: |
| |
| -- The documentation associated with the node |
| -- The spec of the access function in sinfo.ads |
| -- The body of the access function in sinfo.adb |
| -- The pragma Inline at the end of sinfo.ads for the access function |
| -- The spec of the set procedure in sinfo.ads |
| -- The body of the set procedure in sinfo.adb |
| -- The pragma Inline at the end of sinfo.ads for the set procedure |
| |
| -- The field chosen must be consistent in all places, and, for a node |
| -- that is a subexpression, must not overlap any of the standard |
| -- expression fields. |
| |
| -- In addition, if any of the standard expression fields is changed, then |
| -- the utiliy program which creates the Treeprs spec (in file treeprs.ads) |
| -- must be updated appropriately, since it special cases expression fields. |
| |
| -- If a new tree node is added, then the following changes are made |
| |
| -- Add it to the documentation in the appropriate place |
| -- Add its fields to this documentation section |
| -- Define it in the appropriate classification in Node_Kind |
| -- In the body (sinfo), add entries to the access functions for all |
| -- its fields (except standard expression fields) to include the new |
| -- node in the checks. |
| -- Add an appropriate section to the case statement in sprint.adb |
| -- Add an appropriate section to the case statement in sem.adb |
| -- Add an appropraite section to the case statement in exp_util.adb |
| -- (Insert_Actions procedure) |
| -- For a subexpression, add an appropriate sections to the case |
| -- statement in sem_eval.adb |
| -- For a subexpression, add an appropriate sections to the case |
| -- statement in sem_res.adb |
| |
| -- Finally, four utility programs must be run: |
| |
| -- Run CSinfo to check that you have made the changes consistently. |
| -- It checks most of the rules given above, with clear error messages. |
| -- This utility reads sinfo.ads and sinfo.adb and generates a report |
| -- to standard output. |
| |
| -- Run XSinfo to create a-sinfo.h, the corresponding C header. This |
| -- utility reads sinfo.ads and generates a-sinfo.h. Note that it |
| -- does not need to read sinfo.adb, since the contents of the body |
| -- are algorithmically determinable from the spec. |
| |
| -- Run XTreeprs to create treeprs.ads, an updated version of |
| -- the module that is used to drive the tree print routine. This |
| -- utility reads (but does not modify) treeprs.adt, the template |
| -- that provides the basic structure of the file, and then fills |
| -- in the data from the comments in sinfo.ads. |
| |
| -- Run XNmake to create nmake.ads and nmake.adb, the package body |
| -- and spec of the Nmake package which contains functions for |
| -- constructing nodes. |
| |
| -- Note: sometime we could write a utility that actually generated the |
| -- body of sinfo from the spec instead of simply checking it, since, as |
| -- noted above, the contents of the body can be determined from the spec. |
| |
| -------------------------------- |
| -- Implicit Nodes in the Tree -- |
| -------------------------------- |
| |
| -- Generally the structure of the tree very closely follows the grammar |
| -- as defined in the RM. However, certain nodes are omitted to save |
| -- space and simplify semantic processing. Two general classes of such |
| -- omitted nodes are as follows: |
| |
| -- If the only possibilities for a non-terminal are one or more other |
| -- non terminals (i.e. the rule is a "skinny" rule), then usually the |
| -- corresponding node is omitted from the tree, and the target construct |
| -- appears directly. For example, a real type definition is either a |
| -- floating point definition or a fixed point definition. No explicit |
| -- node appears for real type definition. Instead either the floating |
| -- point definition or fixed point definition appears directly. |
| |
| -- If a non-terminal corresponds to a list of some other non-terminal |
| -- (possibly with separating punctuation), then usually it is omitted |
| -- from the tree, and a list of components appears instead. For |
| -- example, sequence of statements does not appear explicitly in the |
| -- tree. Instead a list of statements appears directly. |
| |
| -- Some additional cases of omitted nodes occur and are documented |
| -- individually. In particular, many nodes are omitted in the tree |
| -- generated for an expression. |
| |
| ------------------------------------------- |
| -- Handling of Defining Identifier Lists -- |
| ------------------------------------------- |
| |
| -- In several declarative forms in the syntax, lists of defining |
| -- identifiers appear (object declarations, component declarations, |
| -- number declarations etc.) |
| |
| -- The semantics of such statements are equivalent to a series of |
| -- identical declarations of single defining identifiers (except that |
| -- conformance checks require the same grouping of identifiers in the |
| -- parameter case). |
| |
| -- To simplify semantic processing, the parser breaks down such multiple |
| -- declaration cases into sequences of single declarations, duplicating |
| -- type and initialization information as required. The flags More_Ids |
| -- and Prev_Ids are used to record the original form of the source in |
| -- the case where the original source used a list of names, More_Ids |
| -- being set on all but the last name and Prev_Ids being set on all |
| -- but the first name. These flags are used to reconstruct the original |
| -- source (e.g. in the Sprint package), and also are included in the |
| -- conformance checks, but otherwise have no semantic significance. |
| |
| -- Note: the reason that we use More_Ids and Prev_Ids rather than |
| -- First_Name and Last_Name flags is so that the flags are off in the |
| -- normal one identifier case, which minimizes tree print output. |
| |
| ----------------------- |
| -- Use of Node Lists -- |
| ----------------------- |
| |
| -- With a few exceptions, if a construction of the form {non-terminal} |
| -- appears in the tree, lists are used in the corresponding tree node |
| -- (see package Nlists for handling of node lists). In this case a field |
| -- of the parent node points to a list of nodes for the non-terminal. The |
| -- field name for such fields has a plural name which always ends in "s". |
| -- For example, a case statement has a field Alternatives pointing to a |
| -- list of case statement alternative nodes. |
| |
| -- Only fields pointing to lists have names ending in "s", so generally |
| -- the structure is strongly typed, fields not ending in s point to |
| -- single nodes, and fields ending in s point to lists. |
| |
| -- The following example shows how a traversal of a list is written. We |
| -- suppose here that Stmt points to a N_Case_Statement node which has |
| -- a list field called Alternatives: |
| |
| -- Alt := First (Alternatives (Stmt)); |
| -- while Present (Alt) loop |
| -- .. |
| -- -- processing for case statement alternative Alt |
| -- .. |
| -- Alt := Next (Alt); |
| -- end loop; |
| |
| -- The Present function tests for Empty, which in this case signals the |
| -- end of the list. First returns Empty immediately if the list is empty. |
| -- Present is defined in Atree, First and Next are defined in Nlists. |
| |
| -- The exceptions to this rule occur with {DEFINING_IDENTIFIERS} in all |
| -- contexts, which is handled as described in the previous section, and |
| -- with {,library_unit_NAME} in the N_With_Clause mode, which is handled |
| -- using the First_Name and Last_Name flags, as further detailed in the |
| -- description of the N_With_Clause node. |
| |
| ------------- |
| -- Pragmas -- |
| ------------- |
| |
| -- Pragmas can appear in many different context, but are not included |
| -- in the grammar. Still they must appear in the tree, so they can be |
| -- properly processed. |
| |
| -- Two approaches are used. In some cases, an extra field is defined |
| -- in an appropriate node that contains a list of pragmas appearing |
| -- in the expected context. For example pragmas can appear before an |
| -- Accept_Alternative in a Selective_Accept_Statement, and these pragmas |
| -- appear in the Pragmas_Before field of the N_Accept_Alternative node. |
| |
| -- The other approach is to simply allow pragmas to appear in syntactic |
| -- lists where the grammar (of course) does not include the possibility. |
| -- For example, the Variants field of an N_Variant_Part node points to |
| -- a list that can contain both N_Pragma and N_Variant nodes. |
| |
| -- To make processing easier in the latter case, the Nlists package |
| -- provides a set of routines (First_Non_Pragma, Last_Non_Pragma, |
| -- Next_Non_Pragma, Prev_Non_Pragma) that allow such lists to be |
| -- handled ignoring all pragmas. |
| |
| -- In the case of the variants list, we can either write: |
| |
| -- Variant := First (Variants (N)); |
| -- while Present (Variant) loop |
| -- ... |
| -- Variant := Next (Variant); |
| -- end loop; |
| |
| -- or |
| |
| -- Variant := First_Non_Pragma (Variants (N)); |
| -- while Present (Variant) loop |
| -- ... |
| -- Variant := Next_Non_Pragma (Variant); |
| -- end loop; |
| |
| -- In the first form of the loop, Variant can either be an N_Pragma or |
| -- an N_Variant node. In the second form, Variant can only be N_Variant |
| -- since all pragmas are skipped. |
| |
| --------------------- |
| -- Optional Fields -- |
| --------------------- |
| |
| -- Fields which correspond to a section of the syntax enclosed in square |
| -- brackets are generally omitted (and the corresponding field set to |
| -- Empty for a node, or No_List for a list). The documentation of such |
| -- fields notes these cases. One exception to this rule occurs in the |
| -- case of possibly empty statement sequences (such as the sequence of |
| -- statements in an entry call alternative). Such cases appear in the |
| -- syntax rules as [SEQUENCE_OF_STATEMENTS] and the fields corresponding |
| -- to such optional statement sequences always contain an empty list (not |
| -- No_List) if no statements are present. |
| |
| -- Note: the utility program that constructs the body and spec of the |
| -- Nmake package relies on the format of the comments to determine if |
| -- a field should have a default value in the corresponding make routine. |
| -- The rule is that if the first line of the description of the field |
| -- contains the string "(set to xxx if", then a default value of xxx is |
| -- provided for this field in the corresponding Make_yyy routine. |
| |
| ----------------------------------- |
| -- Note on Body/Spec Terminology -- |
| ----------------------------------- |
| |
| -- In informal discussions about Ada, it is customary to refer to package |
| -- and subprogram specs and bodies. However, this is not technically |
| -- correct, what is normally referred to as a spec or specification is in |
| -- fact a package declaration or subprogram declaration. We are careful |
| -- in GNAT to use the correct terminology and in particular, the full |
| -- word specification is never used as an incorrect substitute for |
| -- declaration. The structure and terminology used in the tree also |
| -- reflects the grammar and thus uses declaration and specification in |
| -- the technically correct manner. |
| |
| -- However, there are contexts in which the informal terminology is |
| -- useful. We have the word "body" to refer to the Interp_Etype declared by |
| -- the declaration of a unit body, and in some contexts we need a |
| -- similar term to refer to the entity declared by the package or |
| -- subprogram declaration, and simply using declaration can be confusing |
| -- since the body also has a declaration. |
| |
| -- An example of such a context is the link between the package body |
| -- and its declaration. With_Declaration is confusing, since |
| -- the package body itself is a declaration. |
| |
| -- To deal with this problem, we reserve the informal term Spec, i.e. |
| -- the popular abbreviation used in this context, to refer to the entity |
| -- declared by the package or subprogram declaration. So in the above |
| -- example case, the field in the body is called With_Spec. |
| |
| -- Another important context for the use of the word Spec is in error |
| -- messages, where a hyper-correct use of declaration would be confusing |
| -- to a typical Ada programmer, and even for an expert programmer can |
| -- cause confusion since the body has a declaration as well. |
| |
| -- So, to summarize: |
| |
| -- Declaration always refers to the syntactic entity that is called |
| -- a declaration. In particular, subprogram declaration |
| -- and package declaration are used to describe the |
| -- syntactic entity that includes the semicolon. |
| |
| -- Specification always refers to the syntactic entity that is called |
| -- a specification. In particular, the terms procedure |
| -- specification, function specification, package |
| -- specification, subprogram specification always refer |
| -- to the syntactic entity that has no semicolon. |
| |
| -- Spec is an informal term, used to refer to the entity |
| -- that is declared by a task declaration, protected |
| -- declaration, generic declaration, subprogram |
| -- declaration or package declaration. |
| |
| -- This convention is followed throughout the GNAT documentation |
| -- both internal and external, and in all error message text. |
| |
| ------------------------ |
| -- Internal Use Nodes -- |
| ------------------------ |
| |
| -- These are Node_Kind settings used in the internal implementation |
| -- which are not logically part of the specification. |
| |
| -- N_Unused_At_Start |
| -- Completely unused entry at the start of the enumeration type. This |
| -- is inserted so that no legitimate value is zero, which helps to get |
| -- better debugging behavior, since zero is a likely uninitialized value). |
| |
| -- N_Unused_At_End |
| -- Completely unused entry at the end of the enumeration type. This is |
| -- handy so that arrays with Node_Kind as the index type have an extra |
| -- entry at the end (see for example the use of the Pchar_Pos_Array in |
| -- Treepr, where the extra entry provides the limit value when dealing |
| -- with the last used entry in the array). |
| |
| ----------------------------------------- |
| -- Note on the settings of Sloc fields -- |
| ----------------------------------------- |
| |
| -- The Sloc field of nodes that come from the source is set by the |
| -- parser. For internal nodes, and nodes generated during expansion |
| -- the Sloc is usually set in the call to the constructor for the node. |
| -- In general the Sloc value chosen for an internal node is the Sloc of |
| -- the source node whose processing is responsible for the expansion. For |
| -- example, the Sloc of an inherited primitive operation is the Sloc of |
| -- the corresponding derived type declaration. |
| |
| -- For the nodes of a generic instantiation, the Sloc value is encoded |
| -- to represent both the original Sloc in the generic unit, and the Sloc |
| -- of the instantiation itself. See Sinput.ads for details. |
| |
| -- Subprogram instances create two callable entities: one is the visible |
| -- subprogram instance, and the other is an anonymous subprogram nested |
| -- within a wrapper package that contains the renamings for the actuals. |
| -- Both of these entities have the Sloc of the defining entity in the |
| -- instantiation node. This simplifies some ASIS queries. |
| |
| ----------------------- |
| -- Field Definitions -- |
| ----------------------- |
| |
| -- In the following node definitions, all fields, both syntactic and |
| -- semantic, are documented. The one exception is in the case of entities |
| -- (defining indentifiers, character literals and operator symbols), |
| -- where the usage of the fields depends on the entity kind. Entity |
| -- fields are fully documented in the separate package Einfo. |
| |
| -- In the node definitions, three common sets of fields are abbreviated |
| -- to save both space in the documentation, and also space in the string |
| -- (defined in Tree_Print_Strings) used to print trees. The following |
| -- abbreviations are used: |
| |
| -- Note: the utility program that creates the Treeprs spec (in the file |
| -- xtreeprs.adb) knows about the special fields here, so it must be |
| -- modified if any change is made to these fields. |
| |
| -- "plus fields for binary operator" |
| -- Chars (Name1) Name_Id for the operator |
| -- Left_Opnd (Node2) left operand expression |
| -- Right_Opnd (Node3) right operand expression |
| -- Entity (Node4-Sem) defining entity for operator |
| -- Associated_Node (Node4-Sem) for generic processing |
| -- Do_Overflow_Check (Flag17-Sem) set if overflow check needed |
| -- Has_Private_View (Flag11-Sem) set in generic units. |
| |
| -- "plus fields for unary operator" |
| -- Chars (Name1) Name_Id for the operator |
| -- Right_Opnd (Node3) right operand expression |
| -- Entity (Node4-Sem) defining entity for operator |
| -- Associated_Node (Node4-Sem) for generic processing |
| -- Do_Overflow_Check (Flag17-Sem) set if overflow check needed |
| -- Has_Private_View (Flag11-Sem) set in generic units. |
| |
| -- "plus fields for expression" |
| -- Paren_Count number of parentheses levels |
| -- Etype (Node5-Sem) type of the expression |
| -- Is_Overloaded (Flag5-Sem) >1 type interpretation exists |
| -- Is_Static_Expression (Flag6-Sem) set for static expression |
| -- Raises_Constraint_Error (Flag7-Sem) evaluation raises CE |
| -- Must_Not_Freeze (Flag8-Sem) set if must not freeze |
| -- Do_Range_Check (Flag9-Sem) set if a range check needed |
| -- Assignment_OK (Flag15-Sem) set if modification is OK |
| -- Is_Controlling_Actual (Flag16-Sem) set for controlling argument |
| |
| -- Note: see under (EXPRESSION) for further details on the use of |
| -- the Paren_Count field to record the number of parentheses levels. |
| |
| -- Node_Kind is the type used in the Nkind field to indicate the node |
| -- kind. The actual definition of this type is given later (the reason |
| -- for this is that we want the descriptions ordered by logical chapter |
| -- in the RM, but the type definition is reordered to facilitate the |
| -- definition of some subtype ranges. The individual descriptions of |
| -- the nodes show how the various fields are used in each node kind, |
| -- as well as providing logical names for the fields. Functions and |
| -- procedures are provided for accessing and setting these fields |
| -- using these logical names. |
| |
| ----------------------- |
| -- Gigi Restrictions -- |
| ----------------------- |
| |
| -- The tree passed to Gigi is more restricted than the general tree form. |
| -- For example, as a result of expansion, most of the tasking nodes can |
| -- never appear. For each node to which either a complete or partial |
| -- restriction applies, a note entitled "Gigi restriction" appears which |
| -- documents the restriction. |
| |
| -- Note that most of these restrictions apply only to trees generated when |
| -- code is being generated, since they involved expander actions that |
| -- destroy the tree. |
| |
| ------------------------ |
| -- Common Flag Fields -- |
| ------------------------ |
| |
| -- The following flag fields appear in all nodes |
| |
| -- Analyzed |
| -- This flag is used to indicate that a node (and all its children |
| -- have been analyzed. It is used to avoid reanalysis of a node that |
| -- has already been analyzed, both for efficiency and functional |
| -- correctness reasons. |
| |
| -- Error_Posted |
| -- This flag is used to avoid multiple error messages being posted |
| -- on or referring to the same node. This flag is set if an error |
| -- message refers to a node or is posted on its source location, |
| -- and has the effect of inhibiting further messages involving |
| -- this same node. |
| |
| -- Comes_From_Source |
| -- This flag is on for any nodes built by the scanner or parser from |
| -- the source program, and off for any nodes built by the analyzer or |
| -- expander. It indicates that a node comes from the original source. |
| -- This flag is defined in Atree. |
| |
| -- Has_Dynamic_Length_Check and Has_Dynamic_Range_Check also appear on |
| -- all nodes. They are fully described in the next section. |
| |
| ------------------------------------ |
| -- Description of Semantic Fields -- |
| ------------------------------------ |
| |
| -- The meaning of the syntactic fields is generally clear from their |
| -- names without any further description, since the names are chosen |
| -- to correspond very closely to the syntax in the reference manual. |
| -- This section describes the usage of the semantic fields, which are |
| -- used to contain additional information determined during semantic |
| -- analysis. |
| |
| -- ABE_Is_Certain (Flag18-Sem) |
| -- This flag is set in an instantiation node or a call node is |
| -- determined to be sure to raise an ABE. This is used to trigger |
| -- special handling of such cases, particularly in the instantiation |
| -- case where we avoid instantiating the body if this flag is set. |
| -- This flag is also present in an N_Formal_Package_Declaration_Node |
| -- since formal package declarations are treated like instantiations, |
| -- but it is always set to False in this context. |
| |
| -- Accept_Handler_Records (List5-Sem) |
| -- This field is present only in an N_Accept_Alternative node. It is |
| -- used to temporarily hold the exception handler records from an |
| -- accept statement in a selective accept. These exception handlers |
| -- will eventually be placed in the Handler_Records list of the |
| -- procedure built for this accept (see Expand_N_Selective_Accept |
| -- procedure in Exp_Ch9 for further details). |
| |
| -- Access_Types_To_Process (Elist2-Sem) |
| -- Present in N_Freeze_Entity nodes for Incomplete or private types. |
| -- Contains the list of access types which may require specific |
| -- treatment when the nature of the type completion is completely |
| -- known. An example of such treatement is the generation of the |
| -- associated_final_chain. |
| |
| -- Actions (List1-Sem) |
| -- This field contains a sequence of actions that are associated |
| -- with the node holding the field. See the individual node types |
| -- for details of how this field is used, as well as the description |
| -- of the specific use for a particular node type. |
| |
| -- Activation_Chain_Entity (Node3-Sem) |
| -- This is used in tree nodes representing task activators (blocks, |
| -- subprogram bodies, package declarations, and task bodies). It is |
| -- initially Empty, and then gets set to point to the entity for the |
| -- declared Activation_Chain variable when the first task is declared. |
| -- When tasks are declared in the corresponding declarative region |
| -- this entity is located by name (its name is always _Chain) and |
| -- the declared tasks are added to the chain. |
| |
| -- Acts_As_Spec (Flag4-Sem) |
| -- A flag set in the N_Subprogram_Body node for a subprogram body |
| -- which is acting as its own spec. This flag also appears in the |
| -- compilation unit node at the library level for such a subprogram |
| -- (see further description in spec of Lib package). |
| |
| -- Aggregate_Bounds (Node3-Sem) |
| -- Present in array N_Aggregate nodes. If the aggregate contains |
| -- component associations this field points to an N_Range node whose |
| -- bounds give the lowest and highest discrete choice values. If the |
| -- named aggregate contains a dynamic or null choice this field is |
| -- empty. If the aggregate contains positional elements this field |
| -- points to an N_Integer_Literal node giving the number of positional |
| -- elements. Note that if the aggregate contains positional elements |
| -- and an other choice the N_Integer_Literal only accounts for the |
| -- number of positional elements. |
| |
| -- All_Others (Flag11-Sem) |
| -- Present in an N_Others_Choice node. This flag is set in the case |
| -- of an others exception where all exceptions are to be caught, even |
| -- those that are not normally handled (in particular the tasking abort |
| -- signal). This is used for translation of the at end handler into |
| -- a normal exception handler. |
| |
| -- Assignment_OK (Flag15-Sem) |
| -- This flag is set in a subexpression node for an object, indicating |
| -- that the associated object can be modified, even if this would not |
| -- normally be permissible (either by direct assignment, or by being |
| -- passed as an out or in-out parameter). This is used by the expander |
| -- for a number of purposes, including initialzation of constants and |
| -- limited type objects (such as tasks), setting discriminant fields, |
| -- setting tag values, etc. N_Object_Declaration nodes also have this |
| -- flag defined. Here it is used to indicate that an initialization |
| -- expression is valid, even where it would normally not be allowed |
| -- (e.g. where the type involved is limited). |
| |
| -- Associated_Node (Node4-Sem) |
| -- Present in nodes that can denote an entity: identifiers, character |
| -- literals, operator symbols, expanded names, operator nodes, and |
| -- attribute reference nodes (all these nodes have an Entity field). |
| -- This field is also present in N_Aggregate, N_Selected_Component, |
| -- and N_Extension_Aggregate nodes. This field is used in generic |
| -- processing to create links between the generic template and the |
| -- generic copy. See Sem_Ch12.Get_Associated_Node for full details. |
| -- Note that this field overlaps Entity, which is fine, since, as |
| -- explained in Sem_Ch12, the normal function of Entity is not |
| -- required at the point where the Associated_Node is set. Note |
| -- also, that in generic templates, this means that the Entity field |
| -- does not necessarily point to an Entity. Since the back end is |
| -- expected to ignore generic templates, this is harmless. |
| |
| -- At_End_Proc (Node1) |
| -- This field is present in an N_Handled_Sequence_Of_Statements node. |
| -- It contains an identifier reference for the cleanup procedure to |
| -- be called. See description of this node for further details. |
| |
| -- Backwards_OK (Flag6-Sem) |
| -- A flag present in the N_Assignment_Statement node. It is used only |
| -- if the type being assigned is an array type, and is set if analysis |
| -- determines that it is definitely safe to do the copy backwards, i.e. |
| -- starting at the highest addressed element. Note that if neither of |
| -- the flags Forwards_OK or Backwards_OK is set, it means that the |
| -- front end could not determine that either direction is definitely |
| -- safe, and a runtime check is required. |
| |
| -- Body_To_Inline (Node3-Sem) |
| -- present in subprogram declarations. Denotes analyzed but unexpanded |
| -- body of subprogram, to be used when inlining calls. Present when the |
| -- subprogram has an Inline pragma and inlining is enabled. If the |
| -- declaration is completed by a renaming_as_body, and the renamed en- |
| -- tity is a subprogram, the Body_To_Inline is the name of that entity, |
| -- which is used directly in later calls to the original subprogram. |
| |
| -- Body_Required (Flag13-Sem) |
| -- A flag that appears in the N_Compilation_Unit node indicating that |
| -- the corresponding unit requires a body. For the package case, this |
| -- indicates that a completion is required. In Ada 95, if the flag |
| -- is not set for the package case, then a body may not be present. |
| -- In Ada 83, if the flag is not set for the package case, then a |
| -- body is optional. For a subprogram declaration, the flag is set |
| -- except in the case where a pragma Import or Interface applies, |
| -- in which case no body is permitted (in Ada 83 or Ada 95). |
| |
| -- By_Ref (Flag5-Sem) |
| -- A flag present in the N_Return_Statement_Node. It is set when the |
| -- returned expression is already allocated on the secondary stack |
| -- and thus the result is passed by reference rather than copied |
| -- another time. |
| |
| -- Check_Address_Alignment (Flag11-Sem) |
| -- A flag present in N_Attribute_Definition clause for a 'Address |
| -- attribute definition. This flag is set if a dynamic check should |
| -- be generated at the freeze point for the entity to which this |
| -- address clause applies. The reason that we need this flag is that |
| -- we want to check for range checks being suppressed at the point |
| -- where the attribute definition clause is given, rather than |
| -- testing this at the freeze point. |
| |
| -- Compile_Time_Known_Aggregate (Flag18-Sem) |
| -- Present in N_Aggregate nodes. Set for aggregates which can be |
| -- fully evaluated at compile time without raising constraint error. |
| -- Such aggregates can be passed as is to Gigi without any expansion. |
| -- See Sem_Aggr for the specific conditions under which an aggregate |
| -- has this flag set. See also the flag Static_Processing_OK. |
| |
| -- Condition_Actions (List3-Sem) |
| -- This field appears in else-if nodes and in the iteration scheme |
| -- node for while loops. This field is only used during semantic |
| -- processing to temporarily hold actions inserted into the tree. |
| -- In the tree passed to gigi, the condition actions field is always |
| -- set to No_List. For details on how this field is used, see the |
| -- routine Insert_Actions in package Exp_Util, and also the expansion |
| -- routines for the relevant nodes. |
| |
| -- Controlling_Argument (Node1-Sem) |
| -- This field is set in procedure and function call nodes if the call |
| -- is a dispatching call (it is Empty for a non-dispatching call). |
| -- It indicates the source of the controlling tag for the call. For |
| -- Procedure calls, the Controlling_Argument is one of the actuals. |
| -- For a function that has a dispatching result, it is an entity in |
| -- the context of the call that can provide a tag, or else it is the |
| -- tag of the root type of the class. |
| |
| -- Conversion_OK (Flag14-Sem) |
| -- A flag set on type conversion nodes to indicate that the conversion |
| -- is to be considered as being valid, even though it is the case that |
| -- the conversion is not valid Ada. This is used for the Enum_Rep, |
| -- Fixed_Value and Integer_Value attributes, for internal conversions |
| -- done for fixed-point operations, and for certain conversions for |
| -- calls to initialization procedures. If Conversion_OK is set, then |
| -- Etype must be set (the analyzer assumes that Etype has been set). |
| -- For the case of fixed-point operands, it also indicates that the |
| -- conversion is to be a direct conversion of the underlying integer |
| -- result, with no regard to the small operand. |
| |
| -- Corresponding_Body (Node5-Sem) |
| -- This field is set in subprogram declarations, package declarations, |
| -- entry declarations of protected types, and in generic units. It |
| -- points to the defining entity for the corresponding body (NOT the |
| -- node for the body itself). |
| |
| -- Corresponding_Generic_Association (Node5-Sem) |
| -- This field is defined for object declarations and object renaming |
| -- declarations. It is set for the declarations within an instance that |
| -- map generic formals to their actuals. If set, the field points to |
| -- a generic_association which is the original parent of the expression |
| -- or name appearing in the declaration. This simplifies ASIS queries. |
| |
| -- Corresponding_Integer_Value (Uint4-Sem) |
| -- This field is set in real literals of fixed-point types (it is not |
| -- used for floating-point types). It contains the integer value used |
| -- to represent the fixed-point value. It is also set on the universal |
| -- real literals used to represent bounds of fixed-point base types |
| -- and their first named subtypes. |
| |
| -- Corresponding_Spec (Node5-Sem) |
| -- This field is set in subprogram, package, task, and protected body |
| -- nodes, where it points to the defining entity in the corresponding |
| -- spec. The attribute is also set in N_With_Clause nodes, where |
| -- it points to the defining entity for the with'ed spec, and in |
| -- a subprogram renaming declaration when it is a Renaming_As_Body. |
| -- The field is Empty if there is no corresponding spec, as in the |
| -- case of a subprogram body that serves as its own spec. |
| |
| -- Corresponding_Stub (Node3-Sem) |
| -- This field is present in an N_Subunit node. It holds the node in |
| -- the parent unit that is the stub declaration for the subunit. it is |
| -- set when analysis of the stub forces loading of the proper body. If |
| -- expansion of the proper body creates new declarative nodes, they are |
| -- inserted at the point of the corresponding_stub. |
| |
| -- Dcheck_Function (Node5-Sem) |
| -- This field is present in an N_Variant node, It references the entity |
| -- for the discriminant checking function for the variant. |
| |
| -- Debug_Statement (Node3) |
| -- This field is present in an N_Pragma node. It is used only for |
| -- a Debug pragma or pragma Assert with a second parameter. The |
| -- parameter is of the form of an expression, as required by the |
| -- pragma syntax, but is actually a procedure call. To simplify |
| -- semantic processing, the parser creates a copy of the argument |
| -- rearranged into a procedure call statement and places it in the |
| -- Debug_Statement field. Note that this field is considered a |
| -- syntactic field, since it is created by the parser. |
| |
| -- Default_Expression (Node5-Sem) |
| -- This field is Empty if there is no default expression. If there |
| -- is a simple default expression (one with no side effects), then |
| -- this field simply contains a copy of the Expression field (both |
| -- point to the tree for the default expression). Default_Expression |
| -- is used for conformance checking. |
| |
| -- Delay_Finalize_Attach (Flag14-Sem) |
| -- This flag is present in an N_Object_Declaration node. If it is set, |
| -- then in the case of a controlled type being declared and initialized, |
| -- the normal code for attaching the result to the appropriate local |
| -- finalization list is suppressed. This is used for functions that |
| -- return controlled types without using the secondary stack, where |
| -- it is the caller who must do the attachment. |
| |
| -- Discr_Check_Funcs_Built (Flag11-Sem) |
| -- This flag is present in N_Full_Type_Declaration nodes. It is set when |
| -- discriminant checking functions are constructed. The purpose is to |
| -- avoid attempting to set these functions more than once. |
| |
| -- Do_Accessibility_Check (Flag13-Sem) |
| -- This flag is set on N_Parameter_Specification nodes to indicate |
| -- that an accessibility check is required for the parameter. It is |
| -- not yet decided who takes care of this check (TBD ???). |
| |
| -- Do_Discriminant_Check (Flag13-Sem) |
| -- This flag is set on N_Selected_Component nodes to indicate that a |
| -- discriminant check is required using the discriminant check routine |
| -- associated with the selector. The actual check is generated by the |
| -- expander when processing selected components. |
| |
| -- Do_Division_Check (Flag13-Sem) |
| -- This flag is set on a division operator (/ mod rem) to indicate |
| -- that a zero divide check is required. The actual check is dealt |
| -- with by the backend (all the front end does is to set the flag). |
| |
| -- Do_Length_Check (Flag4-Sem) |
| -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or, |
| -- N_Op_Xor, or N_Type_Conversion node to indicate that a length check |
| -- is required. It is not determined who deals with this flag (???). |
| |
| -- Do_Overflow_Check (Flag17-Sem) |
| -- This flag is set on an operator where an overflow check is required |
| -- on the operation. The actual check is dealt with by the backend |
| -- (all the front end does is to set the flag). The other cases where |
| -- this flag is used is on a Type_Conversion node and for attribute |
| -- reference nodes. For a type conversion, it means that the conversion |
| -- is from one base type to another, and the value may not fit in the |
| -- target base type. See also the description of Do_Range_Check for |
| -- this case. The only attribute references which use this flag are |
| -- Pred and Succ, where it means that the result should be checked |
| -- for going outside the base range. |
| |
| -- Do_Range_Check (Flag9-Sem) |
| -- This flag is set on an expression which appears in a context where |
| -- a range check is required. The target type is clear from the |
| -- context. The contexts in which this flag can appear are limited to |
| -- the following. |
| |
| -- Right side of an assignment. In this case the target type is |
| -- taken from the left side of the assignment, which is referenced |
| -- by the Name of the N_Assignment_Statement node. |
| |
| -- Subscript expressions in an indexed component. In this case the |
| -- target type is determined from the type of the array, which is |
| -- referenced by the Prefix of the N_Indexed_Component node. |
| |
| -- Argument expression for a parameter, appearing either directly |
| -- in the Parameter_Associations list of a call or as the Expression |
| -- of an N_Parameter_Association node that appears in this list. In |
| -- either case, the check is against the type of the formal. Note |
| -- that the flag is relevant only in IN and IN OUT parameters, and |
| -- will be ignored for OUT parameters, where no check is required |
| -- in the call, and if a check is required on the return, it is |
| -- generated explicitly with a type conversion. |
| |
| -- Initialization expression for the initial value in an object |
| -- declaration. In this case the Do_Range_Check flag is set on |
| -- the initialization expression, and the check is against the |
| -- range of the type of the object being declared. |
| |
| -- The expression of a type conversion. In this case the range check |
| -- is against the target type of the conversion. See also the use of |
| -- Do_Overflow_Check on a type conversion. The distinction is that |
| -- the overflow check protects against a value that is outside the |
| -- range of the target base type, whereas a range check checks that |
| -- the resulting value (which is a value of the base type of the |
| -- target type), satisfies the range constraint of the target type. |
| |
| -- Note: when a range check is required in contexts other than those |
| -- listed above (e.g. in a return statement), an additional type |
| -- conversion node is introduced to represent the required check. |
| |
| -- Do_Storage_Check (Flag17-Sem) |
| -- This flag is set in an N_Allocator node to indicate that a storage |
| -- check is required for the allocation, or in an N_Subprogram_Body |
| -- node to indicate that a stack check is required in the subprogram |
| -- prolog. The N_Allocator case is handled by the routine that expands |
| -- the call to the runtime routine. The N_Subprogram_Body case is |
| -- handled by the backend, and all the semantics does is set the flag. |
| |
| -- Do_Tag_Check (Flag13-Sem) |
| -- This flag is set on an N_Assignment_Statement, N_Function_Call, |
| -- N_Procedure_Call_Statement, N_Type_Conversion or N_Return_Statememt |
| -- node to indicate that the tag check can be suppressed. It is not |
| -- yet decided how this flag is used (TBD ???). |
| |
| -- Elaborate_Present (Flag4-Sem) |
| -- This flag is set in the N_With_Clause node to indicate that a |
| -- pragma Elaborate pragma appears for the with'ed units. |
| |
| -- Elaborate_All_Present (Flag15-Sem) |
| -- This flag is set in the N_With_Clause node to indicate that a |
| -- pragma Elaborate_All pragma appears for the with'ed units. |
| |
| -- Elaboration_Boolean (Node2-Sem) |
| -- This field is present in function and procedure specification |
| -- nodes. If set, it points to the entity for a Boolean flag that |
| -- must be tested for certain calls to check for access before |
| -- elaboration. See body of Sem_Elab for further details. This |
| -- field is Empty if no elaboration boolean is required. |
| |
| -- Else_Actions (List3-Sem) |
| -- This field is present in conditional expression nodes. During code |
| -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert |
| -- actions at an appropriate place in the tree to get elaborated at the |
| -- right time. For conditional expressions, we have to be sure that the |
| -- actions for the Else branch are only elaborated if the condition is |
| -- False. The Else_Actions field is used as a temporary parking place |
| -- for these actions. The final tree is always rewritten to eliminate |
| -- the need for this field, so in the tree passed to Gigi, this field |
| -- is always set to No_List. |
| |
| -- Enclosing_Variant (Node2-Sem) |
| -- This field is present in the N_Variant node and identifies the |
| -- Node_Id corresponding to the immediately enclosing variant when |
| -- the variant is nested, and N_Empty otherwise. Set during semantic |
| -- processing of the variant part of a record type. |
| |
| -- Entity (Node4-Sem) |
| -- Appears in all direct names (identifier, character literal, |
| -- operator symbol), as well as expanded names, and attributes that |
| -- denote entities, such as 'Class. Points to the entity for the |
| -- corresponding defining occurrence. Set after name resolution. |
| -- In the case of identifiers in a WITH list, the corresponding |
| -- defining occurrence is in a separately compiled file, and this |
| -- pointer must be set using the library Load procedure. Note that |
| -- during name resolution, the value in Entity may be temporarily |
| -- incorrect (e.g. during overload resolution, Entity is initially |
| -- set to the first possible correct interpretation, and then later |
| -- modified if necessary to contain the correct value after resolution). |
| -- Note that this field overlaps Associated_Node, which is used during |
| -- generic processing (see Sem_Ch12 for details). Note also that in |
| -- generic templates, this means that the Entity field does not always |
| -- point to an Entity. Since the back end is expected to ignore |
| -- generic templates, this is harmless. |
| |
| -- Entity_Or_Associated_Node (Node4-Sem) |
| -- A synonym for both Entity and Asasociated_Node. Used by convention |
| -- in the code when referencing this field in cases where it is not |
| -- known whether the field contains an Entity or an Associated_Node. |
| |
| -- Etype (Node5-Sem) |
| -- Appears in all expression nodes, all direct names, and all |
| -- entities. Points to the entity for the related type. Set after |
| -- type resolution. Normally this is the actual subtype of the |
| -- expression. However, in certain contexts such as the right side |
| -- of an assignment, subscripts, arguments to calls, returned value |
| -- in a function, initial value etc. it is the desired target type. |
| -- In the event that this is different from the actual type, the |
| -- Do_Range_Check flag will be set if a range check is required. |
| -- Note: if the Is_Overloaded flag is set, then Etype points to |
| -- an essentially arbitrary choice from the possible set of types. |
| |
| -- Exception_Junk (Flag11-Sem) |
| -- This flag is set in a various nodes appearing in a statement |
| -- sequence to indicate that the corresponding node is an artifact |
| -- of the generated code for exception handling, and should be |
| -- ignored when analyzing the control flow of the relevant sequence |
| -- of statements (e.g. to check that it does not end with a bad |
| -- return statement). |
| |
| -- Expansion_Delayed (Flag11-Sem) |
| -- Set on aggregates and extension aggregates that need a top-down |
| -- rather than bottom up expansion. Typically aggregate expansion |
| -- happens bottom up. For nested aggregates the expansion is delayed |
| -- until the enclosing aggregate itself is expanded, e.g. in the context |
| -- of a declaration. To delay it we set this flag. This is done to |
| -- avoid creating a temporary for each level of a nested aggregates, |
| -- and also to prevent the premature generation of constraint checks. |
| -- This is also a requirement if we want to generate the proper |
| -- attachment to the internal finalization lists (for record with |
| -- controlled components). Top down expansion of aggregates is also |
| -- used for in-place array aggregate assignment or initialization. |
| -- When the full context is known, the target of the assignment or |
| -- initialization is used to generate the left-hand side of individual |
| -- assignment to each sub-component. |
| |
| -- First_Inlined_Subprogram (Node3-Sem) |
| -- Present in the N_Compilation_Unit node for the main program. Points |
| -- to a chain of entities for subprograms that are to be inlined. The |
| -- Next_Inlined_Subprogram field of these entities is used as a link |
| -- pointer with Empty marking the end of the list. This field is Empty |
| -- if there are no inlined subprograms or inlining is not active. |
| |
| -- First_Named_Actual (Node4-Sem) |
| -- Present in procedure call statement and function call nodes, and |
| -- also in Intrinsic nodes. Set during semantic analysis to point to |
| -- the first named parameter where parameters are ordered by declaration |
| -- order (as opposed to the actual order in the call which may be |
| -- different due to named associations). Note: this field points to the |
| -- explicit actual parameter itself, not the N_Parameter_Association |
| -- node (its parent). |
| |
| -- First_Real_Statement (Node2-Sem) |
| -- Present in N_Handled_Sequence_Of_Statements node. Normally set to |
| -- Empty. Used only when declarations are moved into the statement |
| -- part of a construct as a result of wrapping an AT END handler that |
| -- is required to cover the declarations. In this case, this field is |
| -- used to remember the location in the statements list of the first |
| -- real statement, i.e. the statement that used to be first in the |
| -- statement list before the declarations were prepended. |
| |
| -- First_Subtype_Link (Node5-Sem) |
| -- Present in N_Freeze_Entity node for an anonymous base type that |
| -- is implicitly created by the declaration of a first subtype. It |
| -- points to the entity for the first subtype. |
| |
| -- Float_Truncate (Flag11-Sem) |
| -- A flag present in type conversion nodes. This is used for float |
| -- to integer conversions where truncation is required rather than |
| -- rounding. Note that Gigi does not handle type conversions from real |
| -- to integer with rounding (see Expand_N_Type_Conversion). |
| |
| -- Forwards_OK (Flag5-Sem) |
| -- A flag present in the N_Assignment_Statement node. It is used only |
| -- if the type being assigned is an array type, and is set if analysis |
| -- determines that it is definitely safe to do the copy forwards, i.e. |
| -- starting at the lowest addressed element. Note that if neither of |
| -- the flags Forwards_OK or Backwards_OK is set, it means that the |
| -- front end could not determine that either direction is definitely |
| -- safe, and a runtime check is required. |
| |
| -- From_At_Mod (Flag4-Sem) |
| -- This flag is set on the attribute definition clause node that is |
| -- generated by a transformation of an at mod phrase in a record |
| -- representation clause. This is used to give slightly different |
| -- (Ada 83 compatible) semantics to such a clause, namely it is |
| -- used to specify a minimum acceptable alignment for the base type |
| -- and all subtypes. In Ada 95 terms, the actual alignment of the |
| -- base type and all subtypes must be a multiple of the given value, |
| -- and the representation clause is considered to be type specific |
| -- instead of subtype specific. |
| |
| -- Generic_Parent (Node5-Sem) |
| -- Generic_parent is defined on declaration nodes that are instances. |
| -- The value of Generic_Parent is the generic entity from which the |
| -- instance is obtained. Generic_Parent is also defined for the renaming |
| -- declarations and object declarations created for the actuals in an |
| -- instantiation. The generic parent of such a declaration is the |
| -- corresponding generic association in the Instantiation node. |
| |
| -- Generic_Parent_Type (Node4-Sem) |
| -- Generic_Parent_Type is defined on Subtype_Declaration nodes for |
| -- the actuals of formal private and derived types. Within the instance, |
| -- the operations on the actual are those inherited from the parent. |
| -- For a formal private type, the parent type is the generic type |
| -- itself. The Generic_Parent_Type is also used in an instance to |
| -- determine whether a private operation overrides an inherited one. |
| |
| -- Handler_List_Entry (Node2-Sem) |
| -- This field is present in N_Object_Declaration nodes. It is set only |
| -- for the Handler_Record entry generated for an exception in zero cost |
| -- exception handling mode. It references the corresponding item in the |
| -- handler list, and is used to delete this entry if the corresponding |
| -- handler is deleted during optimization. For further details on why |
| -- this is required, see Exp_Ch11.Remove_Handler_Entries. |
| |
| -- Has_Dynamic_Length_Check (Flag10-Sem) |
| -- This flag is present on all nodes. It is set to indicate that one |
| -- of the routines in unit Checks has generated a length check action |
| -- which has been inserted at the flagged node. This is used to avoid |
| -- the generation of duplicate checks. |
| |
| -- Has_Dynamic_Range_Check (Flag12-Sem) |
| -- This flag is present on all nodes. It is set to indicate that one |
| -- of the routines in unit Checks has generated a range check action |
| -- which has been inserted at the flagged node. This is used to avoid |
| -- the generation of duplicate checks. |
| |
| -- Has_No_Elaboration_Code (Flag17-Sem) |
| -- A flag that appears in the N_Compilation_Unit node to indicate |
| -- whether or not elaboration code is present for this unit. It is |
| -- initially set true for subprogram specs and bodies and for all |
| -- generic units and false for non-generic package specs and bodies. |
| -- Gigi may set the flag in the non-generic package case if it |
| -- determines that no elaboration code is generated. Note that this |
| -- flag is not related to the Is_Preelaborated status, there can be |
| -- preelaborated packages that generate elaboration code, and non- |
| -- preelaborated packages which do not generate elaboration code. |
| |
| -- Has_Priority_Pragma (Flag6-Sem) |
| -- A flag present in N_Subprogram_Body, N_Task_Definition and |
| -- N_Protected_Definition nodes to flag the presence of either |
| -- a Priority or Interrupt_Priority pragma in the declaration |
| -- sequence (public or private in the task and protected cases) |
| |
| -- Has_Private_View (Flag11-Sem) |
| -- A flag present in generic nodes that have an entity, to indicate |
| -- that the node has a private type. Used to exchange private |
| -- and full declarations if the visibility at instantiation is |
| -- different from the visibility at generic definition. |
| |
| -- Has_Storage_Size_Pragma (Flag5-Sem) |
| -- A flag present in an N_Task_Definition node to flag the presence |
| -- of a Storage_Size pragma |
| |
| -- Has_Task_Info_Pragma (Flag7-Sem) |
| -- A flag present in an N_Task_Definition node to flag the presence |
| -- of a Task_Info pragma. Used to detect duplicate pragmas. |
| |
| -- Has_Task_Name_Pragma (Flag8-Sem) |
| -- A flag present in N_Task_Definition nodes to flag the presence |
| -- of a Task_Name pragma in the declaration sequence for the task. |
| |
| -- Has_Wide_Character (Flag11-Sem) |
| -- Present in string literals, set if any wide character (i.e. a |
| -- character code outside the Character range) appears in the string. |
| |
| -- Hidden_By_Use_Clause (Elist4-Sem) |
| -- An entity list present in use clauses that appear within |
| -- instantiations. For the resolution of local entities, entities |
| -- introduced by these use clauses have priority over global ones, |
| -- and outer entities must be explicitly hidden/restored on exit. |
| |
| -- Implicit_With (Flag16-Sem) |
| -- This flag is set in the N_With_Clause node that is implicitly |
| -- generated for runtime units that are loaded by the expander, and |
| -- also for package System, if it is loaded implicitly by a use of |
| -- the 'Address or 'Tag attribute |
| |
| -- Includes_Infinities (Flag11-Sem) |
| -- This flag is present in N_Range nodes. It is set for the range |
| -- of unconstrained float types defined in Standard, which include |
| -- not only the given range of values, but also legtitimately can |
| -- include infinite values. This flag is false for any float type |
| -- for which an explicit range is given by the programmer, even if |
| -- that range is identical to the range for float. |
| |
| -- Instance_Spec (Node5-Sem) |
| -- This field is present in generic instantiation nodes, and also in |
| -- formal package declaration nodes (formal package declarations are |
| -- treated in a manner very similar to package instantiations). It |
| -- points to the node for the spec of the instance, inserted as part |
| -- of the semantic processing for instantiations in Sem_Ch12. |
| |
| -- Is_Asynchronous_Call_Block (Flag7-Sem) |
| -- A flag set in a Block_Statement node to indicate that it is the |
| -- expansion of an asynchronous entry call. Such a block needs a |
| -- cleanup handler to assure that the call is cancelled. |
| |
| -- Is_Component_Left_Opnd (Flag13-Sem) |
| -- Is_Component_Right_Opnd (Flag14-Sem) |
| -- Present in concatenation nodes, to indicate that the corresponding |
| -- operand is of the component type of the result. Used in resolving |
| -- concatenation nodes in instances. |
| |
| -- Is_Controlling_Actual (Flag16-Sem) |
| -- This flag is set on in an expression that is a controlling argument |
| -- in a dispatching call. It is off in all other cases. See Sem_Disp |
| -- for details of its use. |
| |
| -- Is_In_Discriminant_Check (Flag11-Sem) |
| -- This flag is present in a selected component, and is used to |
| -- indicate that the reference occurs within a discriminant check. |
| -- The significance is that optimizations based on assuming that |
| -- the discriminant check has a correct value cannot be performed |
| -- in this case (or the disriminant check may be optimized away!) |
| |
| -- Is_Machine_Number (Flag11-Sem) |
| -- This flag is set in an N_Real_Literal node to indicate that the |
| -- value is a machine number. This avoids some unnecessary cases |
| -- of converting real literals to machine numbers. |
| |
| -- Is_Null_Loop (Flag16-Sem) |
| -- This flag is set in an N_Loop_Statement node if the corresponding |
| -- loop can be determined to be null at compile time. This is used to |
| -- suppress any warnings that would otherwise be issued inside the |
| -- loop since they are probably not useful. |
| |
| -- Is_Power_Of_2_For_Shift (Flag13-Sem) |
| -- A flag present only in N_Op_Expon nodes. It is set when the |
| -- exponentiation is of the forma 2 ** N, where the type of N is |
| -- an unsigned integral subtype whose size does not exceed the size |
| -- of Standard_Integer (i.e. a type that can be safely converted to |
| -- Natural), and the exponentiation appears as the right operand of |
| -- an integer multiplication or an integer division where the dividend |
| -- is unsigned. It is also required that overflow checking is off for |
| -- both the exponentiation and the multiply/divide node. If this set |
| -- of conditions holds, and the flag is set, then the division or |
| -- multiplication can be (and is) converted to a shift. |
| |
| -- Is_Overloaded (Flag5-Sem) |
| -- A flag present in all expression nodes. Used temporarily during |
| -- overloading determination. The setting of this flag is not |
| -- relevant once overloading analysis is complete. |
| |
| -- Is_Protected_Subprogram_Body (Flag7-Sem) |
| -- A flag set in a Subprogram_Body block to indicate that it is the |
| -- implemenation of a protected subprogram. Such a body needs a |
| -- cleanup handler to make sure that the associated protected object |
| -- is unlocked when the subprogram completes. |
| |
| -- Is_Static_Expression (Flag6-Sem) |
| -- Indicates that an expression is a static expression (RM 4.9). See |
| -- spec of package Sem_Eval for full details on the use of this flag. |
| |
| -- Is_Subprogram_Descriptor (Flag16-Sem) |
| -- Present in N_Object_Declaration, and set only for the object |
| -- declaration generated for a subprogram descriptor in fast exception |
| -- mode. See Exp_Ch11 for details of use. |
| |
| -- Is_Task_Allocation_Block (Flag6-Sem) |
| -- A flag set in a Block_Statement node to indicate that it is the |
| -- expansion of a task allocator, or the allocator of an object |
| -- containing tasks. Such a block requires a cleanup handler to call |
| -- Expunge_Unactivted_Tasks to complete any tasks that have been |
| -- allocated but not activated when the allocator completes abnormally. |
| |
| -- Is_Task_Master (Flag5-Sem) |
| -- A flag set in a Subprogram_Body, Block_Statement or Task_Body node |
| -- to indicate that the construct is a task master (i.e. has declared |
| -- tasks or declares an access to a task type). |
| |
| -- Itype (Node1-Sem) |
| -- Used in N_Itype_Reference node to reference an itype for which it |
| -- is important to ensure that it is defined. See description of this |
| -- node for further details. |
| |
| -- Kill_Range_Check (Flag11-Sem) |
| -- Used in an N_Unchecked_Type_Conversion node to indicate that the |
| -- result should not be subjected to range checks. This is used for |
| -- the implementation of Normalize_Scalars. |
| |
| -- Label_Construct (Node2-Sem) |
| -- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label, |
| -- N_Block_Statement or N_Loop_Statement node to which the label |
| -- declaration applies. This is not currently used in the compiler |
| -- itself, but it is useful in the implementation of ASIS queries. |
| |
| -- Library_Unit (Node4-Sem) |
| -- In a stub node, the Library_Unit field points to the compilation unit |
| -- node of the corresponding subunit. |
| -- |
| -- In a with clause node, the Library_Unit field points to the spec |
| -- of the with'ed unit. |
| -- |
| -- In a compilation unit node, the use of this field depends on |
| -- the unit type: |
| -- |
| -- For a subprogram body, the Library_Unit field points to the |
| -- compilation unit node of the corresponding spec, unless |
| -- Acts_As_Spec is set, in which case it points to itself. |
| -- |
| -- For a package body, the Library_Unit field points to the |
| -- compilation unit node of the corresponding spec. |
| -- |
| -- For a subprogram spec to which pragma Inline applies, the |
| -- Library_Unit field points to the compilation unit node of |
| -- the corresponding body, if inlining is active. |
| -- |
| -- For a generic declaration, the Library_Unit field points |
| -- to the compilation unit node of the corresponding generic body. |
| -- |
| -- For a subunit, the Library_Unit field points to the compilation |
| -- unit node of the parent body. |
| -- |
| -- Note that this field is not used to hold the parent pointer for a |
| -- child unit (which might in any case need to use it for some other |
| -- purpose as described above). Instead for a child unit, implicit |
| -- with's are generated for all parents. |
| |
| -- Loop_Actions (List2-Sem) |
| -- A list present in Component_Association nodes in array aggregates. |
| -- Used to collect actions that must be executed within the loop because |
| -- they may need to be evaluated anew each time through. |
| |
| -- Limited_View_Installed (Flag18-Sem) |
| -- Present in With_Clauses and in package specifications. If set on a |
| -- with_clause, it indicates that this clause has created the current |
| -- limited view of the designated package. On a package specification, |
| -- it indicates that the limited view has already been created because |
| -- the package is mentioned in a limited_with_clause in the closure of |
| -- the unit being compiled. |
| |
| -- Must_Be_Byte_Aligned (Flag14-Sem) |
| -- This flag is present in N_Attribute_Reference nodes. It can be set |
| -- only for the Address and Unrestricted_Access attributes. If set it |
| -- means that the object for which the address/access is given must be |
| -- on a byte (more accurately a storage unit) boundary. If necessary, |
| -- a copy of the object is to be made before taking the address (this |
| -- copy is in the current scope on the stack frame). This is used for |
| -- certain cases of code generated by the expander that passes |
| -- parameters by address. |
| -- |
| -- The reason the copy is not made by the front end is that the back |
| -- end has more information about type layout and may be able to (but |
| -- is not guaranteed to) prevent making unnecessary copies. |
| |
| -- Must_Not_Freeze (Flag8-Sem) |
| -- A flag present in all expression nodes. Normally expressions cause |
| -- freezing as described in the RM. If this flag is set, then this |
| -- is inhibited. This is used by the analyzer and expander to label |
| -- nodes that are created by semantic analysis or expansion and which |
| -- must not cause freezing even though they normally would. This flag |
| -- is also present in an N_Subtype_Indication node, since we also use |
| -- these in calls to Freeze_Expression. |
| |
| -- Next_Entity (Node2-Sem) |
| -- Present in defining identifiers, defining character literals and |
| -- defining operator symbols (i.e. in all entities). The entities of |
| -- a scope are chained, and this field is used as the forward pointer |
| -- for this list. See Einfo for further details. |
| |
| -- Next_Named_Actual (Node4-Sem) |
| -- Present in parameter association node. Set during semantic |
| -- analysis to point to the next named parameter, where parameters |
| -- are ordered by declaration order (as opposed to the actual order |
| -- in the call, which may be different due to named associations). |
| -- Not that this field points to the explicit actual parameter itself, |
| -- not to the N_Parameter_Association node (its parent). |
| |
| -- Next_Rep_Item (Node4-Sem) |
| -- Present in pragma nodes and attribute definition nodes. Used to |
| -- link representation items that apply to an entity. See description |
| -- of First_Rep_Item field in Einfo for full details. |
| |
| -- Next_Use_Clause (Node3-Sem) |
| -- While use clauses are active during semantic processing, they |
| -- are chained from the scope stack entry, using Next_Use_Clause |
| -- as a link pointer, with Empty marking the end of the list. The |
| -- head pointer is in the scope stack entry (First_Use_Clause). At |
| -- the end of semantic processing (i.e. when Gigi sees the tree, |
| -- the contents of this field is undefined and should not be read). |
| |
| -- No_Ctrl_Actions (Flag7-Sem) |
| -- Present in N_Assignment_Statement to indicate that no finalize nor |
| -- nor adjust should take place on this assignment eventhough the rhs |
| -- is controlled. This is used in init procs and aggregate expansions |
| -- where the generated assignments are more initialisations than real |
| -- assignments. |
| |
| -- No_Elaboration_Check (Flag14-Sem) |
| -- Present in N_Function_Call and N_Procedure_Call_Statement. Indicates |
| -- that no elaboration check is needed on the call, because it appears |
| -- in the context of a local Suppress pragma. This is used on calls |
| -- within task bodies, where the actual elaboration checks are applied |
| -- after analysis, when the local scope stack is not present. |
| |
| -- No_Entities_Ref_In_Spec (Flag8-Sem) |
| -- Present in N_With_Clause nodes. Set if the with clause is on the |
| -- package or subprogram spec where the main unit is the corresponding |
| -- body, and no entities of the with'ed unit are referenced by the spec |
| -- (an entity may still be referenced in the body, so this flag is used |
| -- to generate the proper message (see Sem_Util.Check_Unused_Withs for |
| -- full details) |
| |
| -- No_Initialization (Flag13-Sem) |
| -- Present in N_Object_Declaration & N_Allocator to indicate |
| -- that the object must not be initialized (by Initialize or a |
| -- call to an init proc). This is needed for controlled aggregates. |
| -- When the Object declaration has an expression, this flag means |
| -- that this expression should not be taken into account (needed |
| -- for in place initialization with aggregates) |
| |
| -- No_Truncation (Flag17-Sem) |
| -- Present in N_Unchecked_Type_Conversion node. This flag has an effect |
| -- only if the RM_Size of the source is greater than the RM_Size of the |
| -- target for scalar operands. Normally in such a case we truncate some |
| -- higher order bits of the source, and then sign/zero extend the result |
| -- to form the output value. But if this flag is set, then we do not do |
| -- any truncation, so for example, if an 8 bit input is converted to a |
| -- 5 bit result which is in fact stored in 8 bits, then the high order |
| -- three bits of the target result will be copied from the source. This |
| -- is used for properly setting out of range values for use by pragmas |
| -- Initialize_Scalars and Normalize_Scalars. |
| |
| -- OK_For_Stream (Flag4-Sem) |
| -- Present in N_Attribute_Definition clauses for stream attributes. If |
| -- set, indicates that the attribute is permitted even though the type |
| -- involved is a limited type. In the case of a protected type, the |
| -- result is to stream all components (including discriminants) in |
| -- lexical order. For other limited types, the effect is simply to |
| -- use the corresponding stream routine for the full type. This flag |
| -- is used for internally generated code, where the streaming of these |
| -- types is required, even though not normally allowed by the language. |
| |
| -- Original_Discriminant (Node2-Sem) |
| -- Present in identifiers. Used in references to discriminants that |
| -- appear in generic units. Because the names of the discriminants |
| -- may be different in an instance, we use this field to recover the |
| -- position of the discriminant in the original type, and replace it |
| -- with the discriminant at the same position in the instantiated type. |
| |
| -- Original_Entity (Node2-Sem) |
| -- Present in numeric literals. Used to denote the named number that |
| -- has been constant-folded into the given literal. If literal is from |
| -- source, or the result of some other constant-folding operation, then |
| -- Original_Entity is empty. This field is needed to handle properly |
| -- named numbers in generic units, where the Associated_Node field |
| -- interferes with the Entity field, making it impossible to preserve |
| -- the original entity at the point of instantiation (ASIS problem). |
| |
| -- Others_Discrete_Choices (List1-Sem) |
| -- When a case statement or variant is analyzed, the semantic checks |
| -- determine the actual list of choices that correspond to an others |
| -- choice. This list is materialized for later use by the expander |
| -- and the Others_Discrete_Choices field of an N_Others_Choice node |
| -- points to this materialized list of choices, which is in standard |
| -- format for a list of discrete choices, except that of course it |
| -- cannot contain an N_Others_Choice entry. |
| |
| -- Parameter_List_Truncated (Flag17-Sem) |
| -- Present in N_Function_Call and N_Procedure_Call_Statement nodes. |
| -- Set (for OpenVMS ports of GNAT only) if the parameter list is |
| -- truncated as a result of a First_Optional_Parameter specification |
| -- in an Import_Function, Import_Procedure, or Import_Valued_Procedure |
| -- pragma. The truncation is done by the expander by removing trailing |
| -- parameters from the argument list, in accordance with the set of |
| -- rules allowing such parameter removal. In particular, parameters |
| -- can be removed working from the end of the parameter list backwards |
| -- up to and including the entry designated by First_Optional_Parameter |
| -- in the Import pragma. Parameters can be removed if they are implicit |
| -- and the default value is a known-at-compile-time value, including |
| -- the use of the Null_Parameter attribute, or if explicit parameter |
| -- values are present that match the corresponding defaults. |
| |
| -- Parent_Spec (Node4-Sem) |
| -- For a library unit that is a child unit spec (package or subprogram |
| -- declaration, generic declaration or instantiation, or library level |
| -- rename, this field points to the compilation unit node for the parent |
| -- package specification. This field is Empty for library bodies (the |
| -- parent spec in this case can be found from the corresponding spec). |
| |
| -- Present_Expr (Uint3-Sem) |
| -- Present in an N_Variant node. This has a meaningful value only after |
| -- Gigi has back annotated the tree with representation information. |
| -- At this point, it contains a reference to a gcc expression that |
| -- depends on the values of one or more discriminants. Give a set of |
| -- discriminant values, this expression evaluates to False (zero) if |
| -- variant is not present, and True (non-zero) if it is present. See |
| -- unit Repinfo for further details on gigi back annotation. This |
| -- field is used during ASIS processing (data decomposition annex) |
| -- to determine if a field is present or not. |
| |
| -- Print_In_Hex (Flag13-Sem) |
| -- Set on an N_Integer_Literal node to indicate that the value should |
| -- be printed in hexadecimal in the sprint listing. Has no effect on |
| -- legality or semantics of program, only on the displayed output. |
| -- This is used to clarify output from the packed array cases. |
| |
| -- Procedure_To_Call (Node4-Sem) |
| -- Present in N_Allocator. N_Free_Statement, and N_Return_Statement |
| -- nodes. References the entity for the declaration of the procedure |
| -- to be called to accomplish the required operation (i.e. for the |
| -- Allocate procedure in the case of N_Allocator and N_Return_Statement |
| -- (for allocating the return value), and for the Deallocate procedure |
| -- in the case of N_Free_Statement. |
| |
| -- Raises_Constraint_Error (Flag7-Sem) |
| -- Set on an expression whose evaluation will definitely fail a |
| -- constraint error check. In the case of static expressions, this |
| -- flag must be set accurately (and if it is set, the expression is |
| -- typically illegal unless it appears as a non-elaborated branch of |
| -- a short-circuit form). For a non-static expression, this flag may |
| -- be set whenever an expression (e.g. an aggregate) is known to raise |
| -- constraint error. If set, the expression definitely will raise CE |
| -- if elaborated at runtime. If not set, the expression may or may |
| -- not raise CE. In other words, on static expressions, the flag is |
| -- set accurately, on non-static expressions it is set conservatively. |
| |
| -- Redundant_Use (Flag13-Sem) |
| -- A flag present in nodes that can appear as an operand in a use |
| -- clause or use type clause (identifiers, expanded names, attribute |
| -- references). Set to indicate that a use is redundant (and therefore |
| -- need not be undone on scope exit). |
| |
| -- Return_Type (Node2-Sem) |
| -- Present in N_Return_Statement node. For a procedure, this is set |
| -- to Standard_Void_Type. For a function it references the entity |
| -- for the returned type. |
| |
| -- Rounded_Result (Flag18-Sem) |
| -- Present in N_Type_Conversion, N_Op_Divide and N_Op_Multiply nodes. |
| -- Used in the fixed-point cases to indicate that the result must be |
| -- rounded as a result of the use of the 'Round attribute. Also used |
| -- for integer N_Op_Divide nodes to indicate that the result should |
| -- be rounded to the nearest integer (breaking ties away from zero), |
| -- rather than truncated towards zero as usual. These rounded integer |
| -- operations are the result of expansion of rounded fixed-point |
| -- divide, conersion and multiplication operations. |
| |
| -- Scope (Node3-Sem) |
| -- Present in defining identifiers, defining character literals and |
| -- defining operator symbols (i.e. in all entities). The entities of |
| -- a scope all use this field to reference the corresponding scope |
| -- entity. See Einfo for further details. |
| |
| -- Shift_Count_OK (Flag4-Sem) |
| -- A flag present in shift nodes to indicate that the shift count is |
| -- known to be in range, i.e. is in the range from zero to word length |
| -- minus one. If this flag is not set, then the shift count may be |
| -- outside this range, i.e. larger than the word length, and the code |
| -- must ensure that such shift counts give the appropriate result. |
| |
| -- Source_Type (Node1-Sem) |
| -- Used in an N_Validate_Unchecked_Conversion node to point to the |
| -- source type entity for the unchecked conversion instantiation |
| -- which gigi must do size validation for. |
| |
| -- Static_Processing_OK (Flag4-Sem) |
| -- Present in N_Aggregate nodes. When the Compile_Time_Known_Aggregate |
| -- flag is set, the full value of the aggregate can be determined at |
| -- compile time and the aggregate can be passed as is to the back-end. |
| -- In this event it is irrelevant whether this flag is set or not. |
| -- However, if the Compile_Time_Known_Aggregate flag is not set but |
| -- Static_Processing_OK is set, the aggregate can (but need not) be |
| -- converted into a compile time known aggregate by the expander. |
| -- See Sem_Aggr for the specific conditions under which an aggregate |
| -- has its Static_Processing_OK flag set. |
| |
| -- Storage_Pool (Node1-Sem) |
| -- Present in N_Allocator, N_Free_Statement and N_Return_Statement |
| -- nodes. References the entity for the storage pool to be used for |
| -- the allocate or free call or for the allocation of the returned |
| -- value from a function. Empty indicates that the global default |
| -- default pool is to be used. Note that in the case of a return |
| -- statement, this field is set only if the function returns a |
| -- value of a type whose size is not known at compile time on the |
| -- secondary stack. It is never set on targets for which the target |
| -- parameter Targparm.Functions_Return_By_DSP_On_Target is True. |
| |
| -- Target_Type (Node2-Sem) |
| -- Used in an N_Validate_Unchecked_Conversion node to point to the |
| -- target type entity for the unchecked conversion instantiation |
| -- which gigi must do size validation for. |
| |
| -- Task_Body_Procedure (Node2-Sem) |
| -- Present in task type declaration nodes. Points to the entity for |
| -- the task body procedure (as further described in Exp_Ch9, task |
| -- bodies are expanded into procedures). A convenient function to |
| -- retrieve this field is Sem_Util.Get_Task_Body_Procedure. |
| |
| -- Then_Actions (List3-Sem) |
| -- This field is present in conditional expression nodes. During code |
| -- expansion we use the Insert_Actions procedure (in Exp_Util) to insert |
| -- actions at an appropriate place in the tree to get elaborated at the |
| -- right time. For conditional expressions, we have to be sure that the |
| -- actions for the Then branch are only elaborated if the condition is |
| -- True. The Then_Actions field is used as a temporary parking place |
| -- for these actions. The final tree is always rewritten to eliminate |
| -- the need for this field, so in the tree passed to Gigi, this field |
| -- is always set to No_List. |
| |
| -- Treat_Fixed_As_Integer (Flag14-Sem) |
| -- This flag appears in operator nodes for divide, multiply, mod and |
| -- rem on fixed-point operands. It indicates that the operands are |
| -- to be treated as integer values, ignoring small values. This flag |
| -- is only set as a result of expansion of fixed-point operations. |
| -- Typically a fixed-point multplication in the source generates |
| -- subsidiary multiplication and division operations that work with |
| -- the underlying integer values and have this flag set. Note that |
| -- this flag is not needed on other arithmetic operations (add, neg, |
| -- subtract etc) since in these cases it is always the case that fixed |
| -- is treated as integer. The Etype field MUST be set if this flag |
| -- is set. The analyzer knows to leave such nodes alone, and whoever |
| -- makes them must set the correct Etype value. |
| |
| -- TSS_Elist (Elist3-Sem) |
| -- Present in N_Freeze_Entity nodes. Holds an element list containing |
| -- entries for each TSS (type support subprogram) associated with the |
| -- frozen type. The elements of the list are the entities for the |
| -- subprograms (see package Exp_TSS for further details). Set to |
| -- No_Elist if there are no type support subprograms for the type |
| -- or if the freeze node is not for a type. |
| |
| -- Unreferenced_In_Spec (Flag7-Sem) |
| -- Present in N_With_Clause nodes. Set if the with clause is on the |
| -- package or subprogram spec where the main unit is the corresponding |
| -- body, and is not referenced by the spec (it may still be referenced |
| -- by the body, so this flag is used to generate the proper message |
| -- (see Sem_Util.Check_Unused_Withs for details) |
| |
| -- Was_Originally_Stub (Flag13-Sem) |
| -- This flag is set in the node for a proper body that replaces a |
| -- stub. During the analysis procedure, stubs in some situations |
| -- get rewritten by the corresponding bodies, and we set this flag |
| -- to remember that this happened. Note that it is not good enough |
| -- to rely on the use of Original_Tree here because of the case of |
| -- nested instantiations where the substituted node can be copied. |
| |
| -- Zero_Cost_Handling (Flag5-Sem) |
| -- This flag is set in all handled sequence of statement and exception |
| -- handler nodes if eceptions are to be handled using the zero-cost |
| -- mechanism (see Ada.Exceptions and System.Exceptions in files |
| -- a-except.ads/adb and s-except.ads for full details). What gigi |
| -- needs to do for such a handler is simply to put the code in the |
| -- handler somewhere. The front end has generated all necessary labels. |
| |
| -------------------------------------------------- |
| -- Note on Use of End_Label and End_Span Fields -- |
| -------------------------------------------------- |
| |
| -- Several constructs have end lines: |
| |
| -- Loop Statement end loop [loop_IDENTIFIER]; |
| -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER] |
| -- Task Definition end [task_IDENTIFIER] |
| -- Protected Definition end [protected_IDENTIFIER] |
| -- Protected Body end [protected_IDENTIFIER] |
| |
| -- Block Statement end [block_IDENTIFIER]; |
| -- Subprogram Body end [DESIGNATOR]; |
| -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER]; |
| -- Task Body end [task_IDENTIFIER]; |
| -- Accept Statement end [entry_IDENTIFIER]]; |
| -- Entry Body end [entry_IDENTIFIER]; |
| |
| -- If Statement end if; |
| -- Case Statement end case; |
| |
| -- Record Definition end record; |
| -- Enumeration Definition ); |
| |
| -- The End_Label and End_Span fields are used to mark the locations |
| -- of these lines, and also keep track of the label in the case where |
| -- a label is present. |
| |
| -- For the first group above, the End_Label field of the corresponding |
| -- node is used to point to the label identifier. In the case where |
| -- there is no label in the source, the parser supplies a dummy |
| -- identifier (with Comes_From_Source set to False), and the Sloc |
| -- of this dummy identifier marks the location of the token following |
| -- the END token. |
| |
| -- For the second group, the use of End_Label is similar, but the |
| -- End_Label is found in the N_Handled_Sequence_Of_Statements node. |
| -- This is done simply because in some cases there is no room in |
| -- the parent node. |
| |
| -- For the third group, there is never any label, and instead of |
| -- using End_Label, we use the End_Span field which gives the |
| -- location of the token following END, relative to the starting |
| -- Sloc of the construct, i.e. add Sloc (Node) + End_Span (Node) |
| -- to get the Sloc of the IF or CASE following the End_Label. |
| |
| -- The record definition case is handled specially, we treat it |
| -- as though it required an optional label which is never present, |
| -- and so the parser always builds a dummy identifier with Comes |
| -- From Source set False. The reason we do this, rather than using |
| -- End_Span in this case, is that we want to generate a cross-ref |
| -- entry for the end of a record, since it represents a scope for |
| -- name declaration purposes. |
| |
| -- The enumeration definition case is handled in an exactly similar |
| -- manner, building a dummy identifier to get a cross-reference. |
| |
| -- Note: the reason we store the difference as a Uint, instead of |
| -- storing the Source_Ptr value directly, is that Source_Ptr values |
| -- cannot be distinguished from other types of values, and we count |
| -- on all general use fields being self describing. To make things |
| -- easier for clients, note that we provide function End_Location, |
| -- and procedure Set_End_Location to allow access to the logical |
| -- value (which is the Source_Ptr value for the end token). |
| |
| --------------------- |
| -- Syntactic Nodes -- |
| --------------------- |
| |
| --------------------- |
| -- 2.3 Identifier -- |
| --------------------- |
| |
| -- IDENTIFIER ::= IDENTIFIER_LETTER {[UNDERLINE] LETTER_OR_DIGIT} |
| -- LETTER_OR_DIGIT ::= IDENTIFIER_LETTER | DIGIT |
| |
| -- An IDENTIFIER shall not be a reserved word |
| |
| -- In the Ada grammar identifiers are the bottom level tokens which |
| -- have very few semantics. Actual program identifiers are direct |
| -- names. If we were being 100% honest with the grammar, then we would |
| -- have a node called N_Direct_Name which would point to an identifier. |
| -- However, that's too many extra nodes, so we just use the N_Identifier |
| -- node directly as a direct name, and it contains the expression fields |
| -- and Entity field that correspond to its use as a direct name. In |
| -- those few cases where identifiers appear in contexts where they are |
| -- not direct names (pragmas, pragma argument associations, attribute |
| -- references and attribute definition clauses), the Chars field of the |
| -- node contains the Name_Id for the identifier name. |
| |
| -- Note: in GNAT, a reserved word can be treated as an identifier |
| -- in two cases. First, an incorrect use of a reserved word as an |
| -- identifier is diagnosed and then treated as a normal identifier. |
| -- Second, an attribute designator of the form of a reserved word |
| -- (access, delta, digits, range) is treated as an identifier. |
| |
| -- Note: The set of letters that is permitted in an identifier depends |
| -- on the character set in use. See package Csets for full details. |
| |
| -- N_Identifier |
| -- Sloc points to identifier |
| -- Chars (Name1) contains the Name_Id for the identifier |
| -- Entity (Node4-Sem) |
| -- Associated_Node (Node4-Sem) |
| -- Original_Discriminant (Node2-Sem) |
| -- Redundant_Use (Flag13-Sem) |
| -- Has_Private_View (Flag11-Sem) (set in generic units) |
| -- plus fields for expression |
| |
| -------------------------- |
| -- 2.4 Numeric Literal -- |
| -------------------------- |
| |
| -- NUMERIC_LITERAL ::= DECIMAL_LITERAL | BASED_LITERAL |
| |
| ---------------------------- |
| -- 2.4.1 Decimal Literal -- |
| ---------------------------- |
| |
| -- DECIMAL_LITERAL ::= NUMERAL [.NUMERAL] [EXPONENT] |
| |
| -- NUMERAL ::= DIGIT {[UNDERLINE] DIGIT} |
| |
| -- EXPONENT ::= E [+] NUMERAL | E - NUMERAL |
| |
| -- Decimal literals appear in the tree as either integer literal nodes |
| -- or real literal nodes, depending on whether a period is present. |
| |
| -- Note: literal nodes appear as a result of direct use of literals |
| -- in the source program, and also as the result of evaluating |
| -- expressions at compile time. In the latter case, it is possible |
| -- to construct real literals that have no syntactic representation |
| -- using the standard literal format. Such literals are listed by |
| -- Sprint using the notation [numerator / denominator]. |
| |
| -- N_Integer_Literal |
| -- Sloc points to literal |
| -- Original_Entity (Node2-Sem) If not Empty, holds Named_Number that |
| -- has been constant-folded into its literal value. |
| -- Intval (Uint3) contains integer value of literal |
| -- plus fields for expression |
| -- Print_In_Hex (Flag13-Sem) |
| |
| -- N_Real_Literal |
| -- Sloc points to literal |
| -- Original_Entity (Node2-Sem) If not Empty, holds Named_Number that |
| -- has been constant-folded into its literal value. |
| -- Realval (Ureal3) contains real value of literal |
| -- Corresponding_Integer_Value (Uint4-Sem) |
| -- Is_Machine_Number (Flag11-Sem) |
| -- plus fields for expression |
| |
| -------------------------- |
| -- 2.4.2 Based Literal -- |
| -------------------------- |
| |
| -- BASED_LITERAL ::= |
| -- BASE # BASED_NUMERAL [.BASED_NUMERAL] # [EXPONENT] |
| |
| -- BASE ::= NUMERAL |
| |
| -- BASED_NUMERAL ::= |
| -- EXTENDED_DIGIT {[UNDERLINE] EXTENDED_DIGIT} |
| |
| -- EXTENDED_DIGIT ::= DIGIT | A | B | C | D | E | F |
| |
| -- Based literals appear in the tree as either integer literal nodes |
| -- or real literal nodes, depending on whether a period is present. |
| |
| ---------------------------- |
| -- 2.5 Character Literal -- |
| ---------------------------- |
| |
| -- CHARACTER_LITERAL ::= ' GRAPHIC_CHARACTER ' |
| |
| -- N_Character_Literal |
| -- Sloc points to literal |
| -- Chars (Name1) contains the Name_Id for the identifier |
| -- Char_Literal_Value (Char_Code2) contains the literal value |
| -- Entity (Node4-Sem) |
| -- Associated_Node (Node4-Sem) |
| -- Has_Private_View (Flag11-Sem) set in generic units. |
| -- plus fields for expression |
| |
| -- Note: the Entity field will be missing (and set to Empty) for |
| -- character literals whose type is Standard.Wide_Character or |
| -- Standard.Character or a type derived from one of these two. |
| -- In this case the character literal stands for its own coding. |
| -- The reason we take this irregular short cut is to avoid the |
| -- need to build lots of junk defining character literal nodes. |
| |
| ------------------------- |
| -- 2.6 String Literal -- |
| ------------------------- |
| |
| -- STRING LITERAL ::= "{STRING_ELEMENT}" |
| |
| -- A STRING_ELEMENT is either a pair of quotation marks ("), or a |
| -- single GRAPHIC_CHARACTER other than a quotation mark. |
| |
| -- N_String_Literal |
| -- Sloc points to literal |
| -- Strval (Str3) contains Id of string value |
| -- Has_Wide_Character (Flag11-Sem) |
| -- plus fields for expression |
| |
| ------------------ |
| -- 2.7 Comment -- |
| ------------------ |
| |
| -- A COMMENT starts with two adjacent hyphens and extends up to the |
| -- end of the line. A COMMENT may appear on any line of a program. |
| |
| -- Comments are skipped by the scanner and do not appear in the tree. |
| -- It is possible to reconstruct the position of comments with respect |
| -- to the elements of the tree by using the source position (Sloc) |
| -- pointers that appear in every tree node. |
| |
| ----------------- |
| -- 2.8 Pragma -- |
| ----------------- |
| |
| -- PRAGMA ::= pragma IDENTIFIER |
| -- [(PRAGMA_ARGUMENT_ASSOCIATION {, PRAGMA_ARGUMENT_ASSOCIATION})]; |
| |
| -- Note that a pragma may appear in the tree anywhere a declaration |
| -- or a statement may appear, as well as in some other situations |
| -- which are explicitly documented. |
| |
| -- N_Pragma |
| -- Sloc points to PRAGMA |
| -- Chars (Name1) identifier name from pragma identifier |
| -- Pragma_Argument_Associations (List2) (set to No_List if none) |
| -- Debug_Statement (Node3) (set to Empty if not Debug, Assert) |
| -- Next_Rep_Item (Node4-Sem) |
| |
| -------------------------------------- |
| -- 2.8 Pragma Argument Association -- |
| -------------------------------------- |
| |
| -- PRAGMA_ARGUMENT_ASSOCIATION ::= |
| -- [pragma_argument_IDENTIFIER =>] NAME |
| -- | [pragma_argument_IDENTIFIER =>] EXPRESSION |
| |
| -- N_Pragma_Argument_Association |
| -- Sloc points to first token in association |
| -- Chars (Name1) (set to No_Name if no pragma argument identifier) |
| -- Expression (Node3) |
| |
| ------------------------ |
| -- 2.9 Reserved Word -- |
| ------------------------ |
| |
| -- Reserved words are parsed by the scanner, and returned as the |
| -- corresponding token types (e.g. PACKAGE is returned as Tok_Package) |
| |
| ---------------------------- |
| -- 3.1 Basic Declaration -- |
| ---------------------------- |
| |
| -- BASIC_DECLARATION ::= |
| -- TYPE_DECLARATION | SUBTYPE_DECLARATION |
| -- | OBJECT_DECLARATION | NUMBER_DECLARATION |
| -- | SUBPROGRAM_DECLARATION | ABSTRACT_SUBPROGRAM_DECLARATION |
| -- | PACKAGE_DECLARATION | RENAMING_DECLARATION |
| -- | EXCEPTION_DECLARATION | GENERIC_DECLARATION |
| -- | GENERIC_INSTANTIATION |
| |
| -- Basic declaration also includes IMPLICIT_LABEL_DECLARATION |
| -- see further description in section on semantic nodes. |
| |
| -- Also, in the tree that is constructed, a pragma may appear |
| -- anywhere that a declaration may appear. |
| |
| ------------------------------ |
| -- 3.1 Defining Identifier -- |
| ------------------------------ |
| |
| -- DEFINING_IDENTIFIER ::= IDENTIFIER |
| |
| -- A defining identifier is an entity, which has additional fields |
| -- depending on the setting of the Ekind field. These additional |
| -- fields are defined (and access subprograms declared) in package |
| -- Einfo. |
| |
| -- Note: N_Defining_Identifier is an extended node whose fields are |
| -- deliberate layed out to match the layout of fields in an ordinary |
| -- N_Identifier node allowing for easy alteration of an identifier |
| -- node into a defining identifier node. For details, see procedure |
| -- Sinfo.CN.Change_Identifier_To_Defining_Identifier. |
| |
| -- N_Defining_Identifier |
| -- Sloc points to identifier |
| -- Chars (Name1) contains the Name_Id for the identifier |
| -- Next_Entity (Node2-Sem) |
| -- Scope (Node3-Sem) |
| -- Etype (Node5-Sem) |
| |
| ----------------------------- |
| -- 3.2.1 Type Declaration -- |
| ----------------------------- |
| |
| -- TYPE_DECLARATION ::= |
| -- FULL_TYPE_DECLARATION |
| -- | INCOMPLETE_TYPE_DECLARATION |
| -- | PRIVATE_TYPE_DECLARATION |
| -- | PRIVATE_EXTENSION_DECLARATION |
| |
| ---------------------------------- |
| -- 3.2.1 Full Type Declaration -- |
| ---------------------------------- |
| |
| -- FULL_TYPE_DECLARATION ::= |
| -- type DEFINING_IDENTIFIER [KNOWN_DISCRIMINANT_PART] |
| -- is TYPE_DEFINITION; |
| -- | TASK_TYPE_DECLARATION |
| -- | PROTECTED_TYPE_DECLARATION |
| |
| -- The full type declaration node is used only for the first case. The |
| -- second case (concurrent type declaration), is represented directly |
| -- by a task type declaration or a protected type declaration. |
| |
| -- N_Full_Type_Declaration |
| -- Sloc points to TYPE |
| -- Defining_Identifier (Node1) |
| -- Discriminant_Specifications (List4) (set to No_List if none) |
| -- Type_Definition (Node3) |
| -- Discr_Check_Funcs_Built (Flag11-Sem) |
| |
| ---------------------------- |
| -- 3.2.1 Type Definition -- |
| ---------------------------- |
| |
| -- TYPE_DEFINITION ::= |
| -- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION |
| -- | REAL_TYPE_DEFINITION | ARRAY_TYPE_DEFINITION |
| -- | RECORD_TYPE_DEFINITION | ACCESS_TYPE_DEFINITION |
| -- | DERIVED_TYPE_DEFINITION |
| |
| -------------------------------- |
| -- 3.2.2 Subtype Declaration -- |
| -------------------------------- |
| |
| -- SUBTYPE_DECLARATION ::= |
| -- subtype DEFINING_IDENTIFIER is SUBTYPE_INDICATION; |
| |
| -- The subtype indication field is set to Empty for subtypes |
| -- declared in package Standard (Positive, Natural). |
| |
| -- N_Subtype_Declaration |
| -- Sloc points to SUBTYPE |
| -- Defining_Identifier (Node1) |
| -- Subtype_Indication (Node5) |
| -- Generic_Parent_Type (Node4-Sem) (set for an actual derived type). |
| -- Exception_Junk (Flag11-Sem) |
| |
| ------------------------------- |
| -- 3.2.2 Subtype Indication -- |
| ------------------------------- |
| |
| -- SUBTYPE_INDICATION ::= SUBTYPE_MARK [CONSTRAINT] |
| |
| -- Note: if no constraint is present, the subtype indication appears |
| -- directly in the tree as a subtype mark. The N_Subtype_Indication |
| -- node is used only if a constraint is present. |
| |
| -- Note: the reason that this node has expression fields is that a |
| -- subtype indication can appear as an operand of a membership test. |
| |
| -- N_Subtype_Indication |
| -- Sloc points to first token of subtype mark |
| -- Subtype_Mark (Node4) |
| -- Constraint (Node3) |
| -- Etype (Node5-Sem) |
| -- Must_Not_Freeze (Flag8-Sem) |
| |
| -- Note: Etype is a copy of the Etype field of the Subtype_Mark. The |
| -- reason for this redundancy is so that in a list of array index types, |
| -- the Etype can be uniformly accessed to determine the subscript type. |
| -- This means that no Itype is constructed for the actual subtype that |
| -- is created by the subtype indication. If such an Itype is required, |
| -- it is constructed in the context in which the indication appears. |
| |
| ------------------------- |
| -- 3.2.2 Subtype Mark -- |
| ------------------------- |
| |
| -- SUBTYPE_MARK ::= subtype_NAME |
| |
| ----------------------- |
| -- 3.2.2 Constraint -- |
| ----------------------- |
| |
| -- CONSTRAINT ::= SCALAR_CONSTRAINT | COMPOSITE_CONSTRAINT |
| |
| ------------------------------ |
| -- 3.2.2 Scalar Constraint -- |
| ------------------------------ |
| |
| -- SCALAR_CONSTRAINT ::= |
| -- RANGE_CONSTRAINT | DIGITS_CONSTRAINT | DELTA_CONSTRAINT |
| |
| --------------------------------- |
| -- 3.2.2 Composite Constraint -- |
| --------------------------------- |
| |
| -- COMPOSITE_CONSTRAINT ::= |
| -- INDEX_CONSTRAINT | DISCRIMINANT_CONSTRAINT |
| |
| ------------------------------- |
| -- 3.3.1 Object Declaration -- |
| ------------------------------- |
| |
| -- OBJECT_DECLARATION ::= |
| -- DEFINING_IDENTIFIER_LIST : [aliased] [constant] |
| -- SUBTYPE_INDICATION [:= EXPRESSION]; |
| -- | DEFINING_IDENTIFIER_LIST : [aliased] [constant] |
| -- ARRAY_TYPE_DEFINITION [:= EXPRESSION]; |
| -- | SINGLE_TASK_DECLARATION |
| -- | SINGLE_PROTECTED_DECLARATION |
| |
| -- Note: aliased is not permitted in Ada 83 mode |
| |
| -- The N_Object_Declaration node is only for the first two cases. |
| -- Single task declaration is handled by P_Task (9.1) |
| -- Single protected declaration is handled by P_protected (9.5) |
| |
| -- Although the syntax allows multiple identifiers in the list, the |
| -- semantics is as though successive declarations were given with |
| -- identical type definition and expression components. To simplify |
| -- semantic processing, the parser represents a multiple declaration |
| -- case as a sequence of single declarations, using the More_Ids and |
| -- Prev_Ids flags to preserve the original source form as described |
| -- in the section on "Handling of Defining Identifier Lists". |
| |
| -- Note: if a range check is required for the initialization |
| -- expression then the Do_Range_Check flag is set in the Expression, |
| -- with the check being done against the type given by the object |
| -- definition, which is also the Etype of the defining identifier. |
| |
| -- Note: the contents of the Expression field must be ignored (i.e. |
| -- treated as though it were Empty) if No_Initialization is set True. |
| |
| -- Note: the back end places some restrictions on the form of the |
| -- Expression field. If the object being declared is Atomic, then |
| -- the Expression may not have the form of an aggregate (since this |
| -- might cause the back end to generate separate assignments). It |
| -- also cannot be a reference to an object marked as a true constant |
| -- (Is_True_Constant flag set), where the object is itself initalized |
| -- with an aggregate. If necessary the front end must generate an |
| -- extra temporary (with Is_True_Constant set False), and initialize |
| -- this temporary as required (the temporary itself is not atomic). |
| |
| -- N_Object_Declaration |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- Aliased_Present (Flag4) set if ALIASED appears |
| -- Constant_Present (Flag17) set if CONSTANT appears |
| -- Object_Definition (Node4) subtype indication/array type definition |
| -- Expression (Node3) (set to Empty if not present) |
| -- Handler_List_Entry (Node2-Sem) |
| -- Corresponding_Generic_Association (Node5-Sem) |
| -- More_Ids (Flag5) (set to False if no more identifiers in list) |
| -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) |
| -- No_Initialization (Flag13-Sem) |
| -- Assignment_OK (Flag15-Sem) |
| -- Exception_Junk (Flag11-Sem) |
| -- Delay_Finalize_Attach (Flag14-Sem) |
| -- Is_Subprogram_Descriptor (Flag16-Sem) |
| |
| ------------------------------------- |
| -- 3.3.1 Defining Identifier List -- |
| ------------------------------------- |
| |
| -- DEFINING_IDENTIFIER_LIST ::= |
| -- DEFINING_IDENTIFIER {, DEFINING_IDENTIFIER} |
| |
| ------------------------------- |
| -- 3.3.2 Number Declaration -- |
| ------------------------------- |
| |
| -- NUMBER_DECLARATION ::= |
| -- DEFINING_IDENTIFIER_LIST : constant := static_EXPRESSION; |
| |
| -- Although the syntax allows multiple identifiers in the list, the |
| -- semantics is as though successive declarations were given with |
| -- identical expressions. To simplify semantic processing, the parser |
| -- represents a multiple declaration case as a sequence of single |
| -- declarations, using the More_Ids and Prev_Ids flags to preserve |
| -- the original source form as described in the section on "Handling |
| -- of Defining Identifier Lists". |
| |
| -- N_Number_Declaration |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- Expression (Node3) |
| -- More_Ids (Flag5) (set to False if no more identifiers in list) |
| -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) |
| |
| ---------------------------------- |
| -- 3.4 Derived Type Definition -- |
| ---------------------------------- |
| |
| -- DERIVED_TYPE_DEFINITION ::= |
| -- [abstract] new parent_SUBTYPE_INDICATION [RECORD_EXTENSION_PART] |
| |
| -- Note: ABSTRACT, record extension part not permitted in Ada 83 mode |
| |
| -- Note: a record extension part is required if ABSTRACT is present |
| |
| -- N_Derived_Type_Definition |
| -- Sloc points to NEW |
| -- Abstract_Present (Flag4) |
| -- Subtype_Indication (Node5) |
| -- Record_Extension_Part (Node3) (set to Empty if not present) |
| |
| --------------------------- |
| -- 3.5 Range Constraint -- |
| --------------------------- |
| |
| -- RANGE_CONSTRAINT ::= range RANGE |
| |
| -- N_Range_Constraint |
| -- Sloc points to RANGE |
| -- Range_Expression (Node4) |
| |
| ---------------- |
| -- 3.5 Range -- |
| ---------------- |
| |
| -- RANGE ::= |
| -- RANGE_ATTRIBUTE_REFERENCE |
| -- | SIMPLE_EXPRESSION .. SIMPLE_EXPRESSION |
| |
| -- Note: the case of a range given as a range attribute reference |
| -- appears directly in the tree as an attribute reference. |
| |
| -- Note: the field name for a reference to a range is Range_Expression |
| -- rather than Range, because range is a reserved keyword in Ada! |
| |
| -- Note: the reason that this node has expression fields is that a |
| -- range can appear as an operand of a membership test. The Etype |
| -- field is the type of the range (we do NOT construct an implicit |
| -- subtype to represent the range exactly). |
| |
| -- N_Range |
| -- Sloc points to .. |
| -- Low_Bound (Node1) |
| -- High_Bound (Node2) |
| -- Includes_Infinities (Flag11) |
| -- plus fields for expression |
| |
| -- Note: if the range appears in a context, such as a subtype |
| -- declaration, where range checks are required on one or both of |
| -- the expression fields, then type conversion nodes are inserted |
| -- to represent the required checks. |
| |
| ---------------------------------------- |
| -- 3.5.1 Enumeration Type Definition -- |
| ---------------------------------------- |
| |
| -- ENUMERATION_TYPE_DEFINITION ::= |
| -- (ENUMERATION_LITERAL_SPECIFICATION |
| -- {, ENUMERATION_LITERAL_SPECIFICATION}) |
| |
| -- Note: the Literals field in the node described below is null for |
| -- the case of the standard types CHARACTER and WIDE_CHARACTER, for |
| -- which special processing handles these types as special cases. |
| |
| -- N_Enumeration_Type_Definition |
| -- Sloc points to left parenthesis |
| -- Literals (List1) (Empty for CHARACTER or WIDE_CHARACTER) |
| -- End_Label (Node4) (set to Empty if internally generated record) |
| |
| ---------------------------------------------- |
| -- 3.5.1 Enumeration Literal Specification -- |
| ---------------------------------------------- |
| |
| -- ENUMERATION_LITERAL_SPECIFICATION ::= |
| -- DEFINING_IDENTIFIER | DEFINING_CHARACTER_LITERAL |
| |
| --------------------------------------- |
| -- 3.5.1 Defining Character Literal -- |
| --------------------------------------- |
| |
| -- DEFINING_CHARACTER_LITERAL ::= CHARACTER_LITERAL |
| |
| -- A defining character literal is an entity, which has additional |
| -- fields depending on the setting of the Ekind field. These |
| -- additional fields are defined (and access subprograms declared) |
| -- in package Einfo. |
| |
| -- Note: N_Defining_Character_Literal is an extended node whose fields |
| -- are deliberate layed out to match the layout of fields in an ordinary |
| -- N_Character_Literal node allowing for easy alteration of a character |
| -- literal node into a defining character literal node. For details, see |
| -- Sinfo.CN.Change_Character_Literal_To_Defining_Character_Literal. |
| |
| -- N_Defining_Character_Literal |
| -- Sloc points to literal |
| -- Chars (Name1) contains the Name_Id for the identifier |
| -- Next_Entity (Node2-Sem) |
| -- Scope (Node3-Sem) |
| -- Etype (Node5-Sem) |
| |
| ------------------------------------ |
| -- 3.5.4 Integer Type Definition -- |
| ------------------------------------ |
| |
| -- Note: there is an error in this rule in the latest version of the |
| -- grammar, so we have retained the old rule pending clarification. |
| |
| -- INTEGER_TYPE_DEFINITION ::= |
| -- SIGNED_INTEGER_TYPE_DEFINITION |
| -- MODULAR_TYPE_DEFINITION |
| |
| ------------------------------------------- |
| -- 3.5.4 Signed Integer Type Definition -- |
| ------------------------------------------- |
| |
| -- SIGNED_INTEGER_TYPE_DEFINITION ::= |
| -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION |
| |
| -- Note: the Low_Bound and High_Bound fields are set to Empty for |
| -- integer types defined in package Standard. |
| |
| -- N_Signed_Integer_Type_Definition |
| -- Sloc points to RANGE |
| -- Low_Bound (Node1) |
| -- High_Bound (Node2) |
| |
| ----------------------------------------- |
| -- 3.5.4 Unsigned Range Specification -- |
| ----------------------------------------- |
| |
| -- MODULAR_TYPE_DEFINITION ::= mod static_EXPRESSION |
| |
| -- N_Modular_Type_Definition |
| -- Sloc points to MOD |
| -- Expression (Node3) |
| |
| --------------------------------- |
| -- 3.5.6 Real Type Definition -- |
| --------------------------------- |
| |
| -- REAL_TYPE_DEFINITION ::= |
| -- FLOATING_POINT_DEFINITION | FIXED_POINT_DEFINITION |
| |
| -------------------------------------- |
| -- 3.5.7 Floating Point Definition -- |
| -------------------------------------- |
| |
| -- FLOATING_POINT_DEFINITION ::= |
| -- digits static_SIMPLE_EXPRESSION [REAL_RANGE_SPECIFICATION] |
| |
| -- Note: The Digits_Expression and Real_Range_Specifications fields |
| -- are set to Empty for floating-point types declared in Standard. |
| |
| -- N_Floating_Point_Definition |
| -- Sloc points to DIGITS |
| -- Digits_Expression (Node2) |
| -- Real_Range_Specification (Node4) (set to Empty if not present) |
| |
| ------------------------------------- |
| -- 3.5.7 Real Range Specification -- |
| ------------------------------------- |
| |
| -- REAL_RANGE_SPECIFICATION ::= |
| -- range static_SIMPLE_EXPRESSION .. static_SIMPLE_EXPRESSION |
| |
| -- N_Real_Range_Specification |
| -- Sloc points to RANGE |
| -- Low_Bound (Node1) |
| -- High_Bound (Node2) |
| |
| ----------------------------------- |
| -- 3.5.9 Fixed Point Definition -- |
| ----------------------------------- |
| |
| -- FIXED_POINT_DEFINITION ::= |
| -- ORDINARY_FIXED_POINT_DEFINITION | DECIMAL_FIXED_POINT_DEFINITION |
| |
| -------------------------------------------- |
| -- 3.5.9 Ordinary Fixed Point Definition -- |
| -------------------------------------------- |
| |
| -- ORDINARY_FIXED_POINT_DEFINITION ::= |
| -- delta static_EXPRESSION REAL_RANGE_SPECIFICATION |
| |
| -- Note: In Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION |
| |
| -- Note: the Delta_Expression and Real_Range_Specification fields |
| -- are set to Empty for fixed point types declared in Standard. |
| |
| -- N_Ordinary_Fixed_Point_Definition |
| -- Sloc points to DELTA |
| -- Delta_Expression (Node3) |
| -- Real_Range_Specification (Node4) |
| |
| ------------------------------------------- |
| -- 3.5.9 Decimal Fixed Point Definition -- |
| ------------------------------------------- |
| |
| -- DECIMAL_FIXED_POINT_DEFINITION ::= |
| -- delta static_EXPRESSION |
| -- digits static_EXPRESSION [REAL_RANGE_SPECIFICATION] |
| |
| -- Note: decimal types are not permitted in Ada 83 mode |
| |
| -- N_Decimal_Fixed_Point_Definition |
| -- Sloc points to DELTA |
| -- Delta_Expression (Node3) |
| -- Digits_Expression (Node2) |
| -- Real_Range_Specification (Node4) (set to Empty if not present) |
| |
| ------------------------------ |
| -- 3.5.9 Digits Constraint -- |
| ------------------------------ |
| |
| -- DIGITS_CONSTRAINT ::= |
| -- digits static_EXPRESSION [RANGE_CONSTRAINT] |
| |
| -- Note: in Ada 83, the EXPRESSION must be a SIMPLE_EXPRESSION |
| -- Note: in Ada 95, reduced accuracy subtypes are obsolescent |
| |
| -- N_Digits_Constraint |
| -- Sloc points to DIGITS |
| -- Digits_Expression (Node2) |
| -- Range_Constraint (Node4) (set to Empty if not present) |
| |
| -------------------------------- |
| -- 3.6 Array Type Definition -- |
| -------------------------------- |
| |
| -- ARRAY_TYPE_DEFINITION ::= |
| -- UNCONSTRAINED_ARRAY_DEFINITION | CONSTRAINED_ARRAY_DEFINITION |
| |
| ----------------------------------------- |
| -- 3.6 Unconstrained Array Definition -- |
| ----------------------------------------- |
| |
| -- UNCONSTRAINED_ARRAY_DEFINITION ::= |
| -- array (INDEX_SUBTYPE_DEFINITION {, INDEX_SUBTYPE_DEFINITION}) of |
| -- COMPONENT_DEFINITION |
| |
| -- Note: dimensionality of array is indicated by number of entries in |
| -- the Subtype_Marks list, which has one entry for each dimension. |
| |
| -- N_Unconstrained_Array_Definition |
| -- Sloc points to ARRAY |
| -- Subtype_Marks (List2) |
| -- Component_Definition (Node4) |
| |
| ----------------------------------- |
| -- 3.6 Index Subtype Definition -- |
| ----------------------------------- |
| |
| -- INDEX_SUBTYPE_DEFINITION ::= SUBTYPE_MARK range <> |
| |
| -- There is no explicit node in the tree for an index subtype |
| -- definition since the N_Unconstrained_Array_Definition node |
| -- incorporates the type marks which appear in this context. |
| |
| --------------------------------------- |
| -- 3.6 Constrained Array Definition -- |
| --------------------------------------- |
| |
| -- CONSTRAINED_ARRAY_DEFINITION ::= |
| -- array (DISCRETE_SUBTYPE_DEFINITION |
| -- {, DISCRETE_SUBTYPE_DEFINITION}) |
| -- of COMPONENT_DEFINITION |
| |
| -- Note: dimensionality of array is indicated by number of entries |
| -- in the Discrete_Subtype_Definitions list, which has one entry |
| -- for each dimension. |
| |
| -- N_Constrained_Array_Definition |
| -- Sloc points to ARRAY |
| -- Discrete_Subtype_Definitions (List2) |
| -- Component_Definition (Node4) |
| |
| -------------------------------------- |
| -- 3.6 Discrete Subtype Definition -- |
| -------------------------------------- |
| |
| -- DISCRETE_SUBTYPE_DEFINITION ::= |
| -- discrete_SUBTYPE_INDICATION | RANGE |
| |
| ------------------------------- |
| -- 3.6 Component Definition -- |
| ------------------------------- |
| |
| -- COMPONENT_DEFINITION ::= [aliased] SUBTYPE_INDICATION |
| |
| -- Note: although the syntax does not permit a component definition to |
| -- be an anonymous array (and the parser will diagnose such an attempt |
| -- with an appropriate message), it is possible for anonymous arrays |
| -- to appear as component definitions. The semantics and back end handle |
| -- this case properly, and the expander in fact generates such cases. |
| |
| -- N_Component_Definition |
| -- Sloc points to ALIASED or to first token of subtype mark |
| -- Aliased_Present (Flag4) |
| -- Subtype_Indication (Node5) |
| |
| ----------------------------- |
| -- 3.6.1 Index Constraint -- |
| ----------------------------- |
| |
| -- INDEX_CONSTRAINT ::= (DISCRETE_RANGE {, DISCRETE_RANGE}) |
| |
| -- It is not in general possible to distinguish between discriminant |
| -- constraints and index constraints at parse time, since a simple |
| -- name could be either the subtype mark of a discrete range, or an |
| -- expression in a discriminant association with no name. Either |
| -- entry appears simply as the name, and the semantic parse must |
| -- distinguish between the two cases. Thus we use a common tree |
| -- node format for both of these constraint types. |
| |
| -- See Discriminant_Constraint for format of node |
| |
| --------------------------- |
| -- 3.6.1 Discrete Range -- |
| --------------------------- |
| |
| -- DISCRETE_RANGE ::= discrete_SUBTYPE_INDICATION | RANGE |
| |
| ---------------------------- |
| -- 3.7 Discriminant Part -- |
| ---------------------------- |
| |
| -- DISCRIMINANT_PART ::= |
| -- UNKNOWN_DISCRIMINANT_PART | KNOWN_DISCRIMINANT_PART |
| |
| ------------------------------------ |
| -- 3.7 Unknown Discriminant Part -- |
| ------------------------------------ |
| |
| -- UNKNOWN_DISCRIMINANT_PART ::= (<>) |
| |
| -- Note: unknown discriminant parts are not permitted in Ada 83 mode |
| |
| -- There is no explicit node in the tree for an unknown discriminant |
| -- part. Instead the Unknown_Discriminants_Present flag is set in the |
| -- parent node. |
| |
| ---------------------------------- |
| -- 3.7 Known Discriminant Part -- |
| ---------------------------------- |
| |
| -- KNOWN_DISCRIMINANT_PART ::= |
| -- (DISCRIMINANT_SPECIFICATION {; DISCRIMINANT_SPECIFICATION}) |
| |
| ------------------------------------- |
| -- 3.7 Discriminant Specification -- |
| ------------------------------------- |
| |
| -- DISCRIMINANT_SPECIFICATION ::= |
| -- DEFINING_IDENTIFIER_LIST : SUBTYPE_MARK |
| -- [:= DEFAULT_EXPRESSION] |
| -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION |
| -- [:= DEFAULT_EXPRESSION] |
| |
| -- Although the syntax allows multiple identifiers in the list, the |
| -- semantics is as though successive specifications were given with |
| -- identical type definition and expression components. To simplify |
| -- semantic processing, the parser represents a multiple declaration |
| -- case as a sequence of single specifications, using the More_Ids and |
| -- Prev_Ids flags to preserve the original source form as described |
| -- in the section on "Handling of Defining Identifier Lists". |
| |
| -- N_Discriminant_Specification |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- Discriminant_Type (Node5) subtype mark or |
| -- access parameter definition |
| -- Expression (Node3) (set to Empty if no default expression) |
| -- More_Ids (Flag5) (set to False if no more identifiers in list) |
| -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) |
| |
| ----------------------------- |
| -- 3.7 Default Expression -- |
| ----------------------------- |
| |
| -- DEFAULT_EXPRESSION ::= EXPRESSION |
| |
| ------------------------------------ |
| -- 3.7.1 Discriminant Constraint -- |
| ------------------------------------ |
| |
| -- DISCRIMINANT_CONSTRAINT ::= |
| -- (DISCRIMINANT_ASSOCIATION {, DISCRIMINANT_ASSOCIATION}) |
| |
| -- It is not in general possible to distinguish between discriminant |
| -- constraints and index constraints at parse time, since a simple |
| -- name could be either the subtype mark of a discrete range, or an |
| -- expression in a discriminant association with no name. Either |
| -- entry appears simply as the name, and the semantic parse must |
| -- distinguish between the two cases. Thus we use a common tree |
| -- node format for both of these constraint types. |
| |
| -- N_Index_Or_Discriminant_Constraint |
| -- Sloc points to left paren |
| -- Constraints (List1) points to list of discrete ranges or |
| -- discriminant associations |
| |
| ------------------------------------- |
| -- 3.7.1 Discriminant Association -- |
| ------------------------------------- |
| |
| -- DISCRIMINANT_ASSOCIATION ::= |
| -- [discriminant_SELECTOR_NAME |
| -- {| discriminant_SELECTOR_NAME} =>] EXPRESSION |
| |
| -- Note: a discriminant association that has no selector name list |
| -- appears directly as an expression in the tree. |
| |
| -- N_Discriminant_Association |
| -- Sloc points to first token of discriminant association |
| -- Selector_Names (List1) (always non-empty, since if no selector |
| -- names are present, this node is not used, see comment above) |
| -- Expression (Node3) |
| |
| --------------------------------- |
| -- 3.8 Record Type Definition -- |
| --------------------------------- |
| |
| -- RECORD_TYPE_DEFINITION ::= |
| -- [[abstract] tagged] [limited] RECORD_DEFINITION |
| |
| -- Note: ABSTRACT, TAGGED, LIMITED are not permitted in Ada 83 mode |
| |
| -- There is no explicit node in the tree for a record type definition. |
| -- Instead the flags for Tagged_Present and Limited_Present appear in |
| -- the N_Record_Definition node for a record definition appearing in |
| -- the context of a record type definition. |
| |
| ---------------------------- |
| -- 3.8 Record Definition -- |
| ---------------------------- |
| |
| -- RECORD_DEFINITION ::= |
| -- record |
| -- COMPONENT_LIST |
| -- end record |
| -- | null record |
| |
| -- Note: the Abstract_Present, Tagged_Present and Limited_Present |
| -- flags appear only for a record definition appearing in a record |
| -- type definition. |
| |
| -- Note: the NULL RECORD case is not permitted in Ada 83 |
| |
| -- N_Record_Definition |
| -- Sloc points to RECORD or NULL |
| -- End_Label (Node4) (set to Empty if internally generated record) |
| -- Abstract_Present (Flag4) |
| -- Tagged_Present (Flag15) |
| -- Limited_Present (Flag17) |
| -- Component_List (Node1) empty in null record case |
| -- Null_Present (Flag13) set in null record case |
| |
| ------------------------- |
| -- 3.8 Component List -- |
| ------------------------- |
| |
| -- COMPONENT_LIST ::= |
| -- COMPONENT_ITEM {COMPONENT_ITEM} |
| -- | {COMPONENT_ITEM} VARIANT_PART |
| -- | null; |
| |
| -- N_Component_List |
| -- Sloc points to first token of component list |
| -- Component_Items (List3) |
| -- Variant_Part (Node4) (set to Empty if no variant part) |
| -- Null_Present (Flag13) |
| |
| ------------------------- |
| -- 3.8 Component Item -- |
| ------------------------- |
| |
| -- COMPONENT_ITEM ::= COMPONENT_DECLARATION | REPRESENTATION_CLAUSE |
| |
| -- Note: A component item can also be a pragma, and in the tree |
| -- that is obtained after semantic processing, a component item |
| -- can be an N_Null node resulting from a non-recognized pragma. |
| |
| -------------------------------- |
| -- 3.8 Component Declaration -- |
| -------------------------------- |
| |
| -- COMPONENT_DECLARATION ::= |
| -- DEFINING_IDENTIFIER_LIST : COMPONENT_DEFINITION |
| -- [:= DEFAULT_EXPRESSION] |
| |
| -- Note: although the syntax does not permit a component definition to |
| -- be an anonymous array (and the parser will diagnose such an attempt |
| -- with an appropriate message), it is possible for anonymous arrays |
| -- to appear as component definitions. The semantics and back end handle |
| -- this case properly, and the expander in fact generates such cases. |
| |
| -- Although the syntax allows multiple identifiers in the list, the |
| -- semantics is as though successive declarations were given with the |
| -- same component definition and expression components. To simplify |
| -- semantic processing, the parser represents a multiple declaration |
| -- case as a sequence of single declarations, using the More_Ids and |
| -- Prev_Ids flags to preserve the original source form as described |
| -- in the section on "Handling of Defining Identifier Lists". |
| |
| -- N_Component_Declaration |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- Component_Definition (Node4) |
| -- Expression (Node3) (set to Empty if no default expression) |
| -- More_Ids (Flag5) (set to False if no more identifiers in list) |
| -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) |
| |
| ------------------------- |
| -- 3.8.1 Variant Part -- |
| ------------------------- |
| |
| -- VARIANT_PART ::= |
| -- case discriminant_DIRECT_NAME is |
| -- VARIANT |
| -- {VARIANT} |
| -- end case; |
| |
| -- Note: the variants list can contain pragmas as well as variants. |
| -- In a properly formed program there is at least one variant. |
| |
| -- N_Variant_Part |
| -- Sloc points to CASE |
| -- Name (Node2) |
| -- Variants (List1) |
| |
| -------------------- |
| -- 3.8.1 Variant -- |
| -------------------- |
| |
| -- VARIANT ::= |
| -- when DISCRETE_CHOICE_LIST => |
| -- COMPONENT_LIST |
| |
| -- N_Variant |
| -- Sloc points to WHEN |
| -- Discrete_Choices (List4) |
| -- Component_List (Node1) |
| -- Enclosing_Variant (Node2-Sem) |
| -- Present_Expr (Uint3-Sem) |
| -- Dcheck_Function (Node5-Sem) |
| |
| --------------------------------- |
| -- 3.8.1 Discrete Choice List -- |
| --------------------------------- |
| |
| -- DISCRETE_CHOICE_LIST ::= DISCRETE_CHOICE {| DISCRETE_CHOICE} |
| |
| ---------------------------- |
| -- 3.8.1 Discrete Choice -- |
| ---------------------------- |
| |
| -- DISCRETE_CHOICE ::= EXPRESSION | DISCRETE_RANGE | others |
| |
| -- Note: in Ada 83 mode, the expression must be a simple expression |
| |
| -- The only choice that appears explicitly is the OTHERS choice, as |
| -- defined here. Other cases of discrete choice (expression and |
| -- discrete range) appear directly. This production is also used |
| -- for the OTHERS possibility of an exception choice. |
| |
| -- Note: in accordance with the syntax, the parser does not check that |
| -- OTHERS appears at the end on its own in a choice list context. This |
| -- is a semantic check. |
| |
| -- N_Others_Choice |
| -- Sloc points to OTHERS |
| -- Others_Discrete_Choices (List1-Sem) |
| -- All_Others (Flag11-Sem) |
| |
| ---------------------------------- |
| -- 3.9.1 Record Extension Part -- |
| ---------------------------------- |
| |
| -- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION |
| |
| -- Note: record extension parts are not permitted in Ada 83 mode |
| |
| ---------------------------------- |
| -- 3.10 Access Type Definition -- |
| ---------------------------------- |
| |
| -- ACCESS_TYPE_DEFINITION ::= |
| -- ACCESS_TO_OBJECT_DEFINITION |
| -- | ACCESS_TO_SUBPROGRAM_DEFINITION |
| |
| --------------------------------------- |
| -- 3.10 Access To Object Definition -- |
| --------------------------------------- |
| |
| -- ACCESS_TO_OBJECT_DEFINITION ::= |
| -- access [GENERAL_ACCESS_MODIFIER] SUBTYPE_INDICATION |
| |
| -- N_Access_To_Object_Definition |
| -- Sloc points to ACCESS |
| -- All_Present (Flag15) |
| -- Subtype_Indication (Node5) |
| -- Constant_Present (Flag17) |
| |
| ----------------------------------- |
| -- 3.10 General Access Modifier -- |
| ----------------------------------- |
| |
| -- GENERAL_ACCESS_MODIFIER ::= all | constant |
| |
| -- Note: general access modifiers are not permitted in Ada 83 mode |
| |
| -- There is no explicit node in the tree for general access modifier. |
| -- Instead the All_Present or Constant_Present flags are set in the |
| -- parent node. |
| |
| ------------------------------------------- |
| -- 3.10 Access To Subprogram Definition -- |
| ------------------------------------------- |
| |
| -- ACCESS_TO_SUBPROGRAM_DEFINITION |
| -- access [protected] procedure PARAMETER_PROFILE |
| -- | access [protected] function PARAMETER_AND_RESULT_PROFILE |
| |
| -- Note: access to subprograms are not permitted in Ada 83 mode |
| |
| -- N_Access_Function_Definition |
| -- Sloc points to ACCESS |
| -- Protected_Present (Flag15) |
| -- Parameter_Specifications (List3) (set to No_List if no formal part) |
| -- Subtype_Mark (Node4) result subtype |
| |
| -- N_Access_Procedure_Definition |
| -- Sloc points to ACCESS |
| -- Protected_Present (Flag15) |
| -- Parameter_Specifications (List3) (set to No_List if no formal part) |
| |
| ----------------------------- |
| -- 3.10 Access Definition -- |
| ----------------------------- |
| |
| -- ACCESS_DEFINITION ::= access SUBTYPE_MARK |
| |
| -- N_Access_Definition |
| -- Sloc points to ACCESS |
| -- Subtype_Mark (Node4) |
| |
| ----------------------------------------- |
| -- 3.10.1 Incomplete Type Declaration -- |
| ----------------------------------------- |
| |
| -- INCOMPLETE_TYPE_DECLARATION ::= |
| -- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]; |
| |
| -- N_Incomplete_Type_Declaration |
| -- Sloc points to TYPE |
| -- Defining_Identifier (Node1) |
| -- Discriminant_Specifications (List4) (set to No_List if no |
| -- discriminant part, or if the discriminant part is an |
| -- unknown discriminant part) |
| -- Unknown_Discriminants_Present (Flag13) set if (<>) discriminant |
| |
| ---------------------------- |
| -- 3.11 Declarative Part -- |
| ---------------------------- |
| |
| -- DECLARATIVE_PART ::= {DECLARATIVE_ITEM} |
| |
| -- Note: although the parser enforces the syntactic requirement that |
| -- a declarative part can contain only declarations, the semantic |
| -- processing may add statements to the list of actions in a |
| -- declarative part, so the code generator should be prepared |
| -- to accept a statement in this position. |
| |
| ---------------------------- |
| -- 3.11 Declarative Item -- |
| ---------------------------- |
| |
| -- DECLARATIVE_ITEM ::= BASIC_DECLARATIVE_ITEM | BODY |
| |
| ---------------------------------- |
| -- 3.11 Basic Declarative Item -- |
| ---------------------------------- |
| |
| -- BASIC_DECLARATIVE_ITEM ::= |
| -- BASIC_DECLARATION | REPRESENTATION_CLAUSE | USE_CLAUSE |
| |
| ---------------- |
| -- 3.11 Body -- |
| ---------------- |
| |
| -- BODY ::= PROPER_BODY | BODY_STUB |
| |
| ----------------------- |
| -- 3.11 Proper Body -- |
| ----------------------- |
| |
| -- PROPER_BODY ::= |
| -- SUBPROGRAM_BODY | PACKAGE_BODY | TASK_BODY | PROTECTED_BODY |
| |
| --------------- |
| -- 4.1 Name -- |
| --------------- |
| |
| -- NAME ::= |
| -- DIRECT_NAME | EXPLICIT_DEREFERENCE |
| -- | INDEXED_COMPONENT | SLICE |
| -- | SELECTED_COMPONENT | ATTRIBUTE_REFERENCE |
| -- | TYPE_CONVERSION | FUNCTION_CALL |
| -- | CHARACTER_LITERAL |
| |
| ---------------------- |
| -- 4.1 Direct Name -- |
| ---------------------- |
| |
| -- DIRECT_NAME ::= IDENTIFIER | OPERATOR_SYMBOL |
| |
| ----------------- |
| -- 4.1 Prefix -- |
| ----------------- |
| |
| -- PREFIX ::= NAME | IMPLICIT_DEREFERENCE |
| |
| ------------------------------- |
| -- 4.1 Explicit Dereference -- |
| ------------------------------- |
| |
| -- EXPLICIT_DEREFERENCE ::= NAME . all |
| |
| -- N_Explicit_Dereference |
| -- Sloc points to ALL |
| -- Prefix (Node3) |
| -- plus fields for expression |
| |
| ------------------------------- |
| -- 4.1 Implicit Dereference -- |
| ------------------------------- |
| |
| -- IMPLICIT_DEREFERENCE ::= NAME |
| |
| ------------------------------ |
| -- 4.1.1 Indexed Component -- |
| ------------------------------ |
| |
| -- INDEXED_COMPONENT ::= PREFIX (EXPRESSION {, EXPRESSION}) |
| |
| -- Note: the parser may generate this node in some situations where it |
| -- should be a function call. The semantic pass must correct this |
| -- misidentification (which is inevitable at the parser level). |
| |
| -- N_Indexed_Component |
| -- Sloc contains a copy of the Sloc value of the Prefix |
| -- Prefix (Node3) |
| -- Expressions (List1) |
| -- plus fields for expression |
| |
| -- Note: if any of the subscripts requires a range check, then the |
| -- Do_Range_Check flag is set on the corresponding expression, with |
| -- the index type being determined from the type of the Prefix, which |
| -- references the array being indexed. |
| |
| -- Note: in a fully analyzed and expanded indexed component node, and |
| -- hence in any such node that gigi sees, if the prefix is an access |
| -- type, then an explicit dereference operation has been inserted. |
| |
| ------------------ |
| -- 4.1.2 Slice -- |
| ------------------ |
| |
| -- SLICE ::= PREFIX (DISCRETE_RANGE) |
| |
| -- Note: an implicit subtype is created to describe the resulting |
| -- type, so that the bounds of this type are the bounds of the slice. |
| |
| -- N_Slice |
| -- Sloc points to first token of prefix |
| -- Prefix (Node3) |
| -- Discrete_Range (Node4) |
| -- plus fields for expression |
| |
| ------------------------------- |
| -- 4.1.3 Selected Component -- |
| ------------------------------- |
| |
| -- SELECTED_COMPONENT ::= PREFIX . SELECTOR_NAME |
| |
| -- Note: selected components that are semantically expanded names get |
| -- changed during semantic processing into the separate N_Expanded_Name |
| -- node. See description of this node in the section on semantic nodes. |
| |
| -- N_Selected_Component |
| -- Sloc points to period |
| -- Prefix (Node3) |
| -- Selector_Name (Node2) |
| -- Associated_Node (Node4-Sem) |
| -- Do_Discriminant_Check (Flag13-Sem) |
| -- Is_In_Discriminant_Check (Flag11-Sem) |
| -- plus fields for expression |
| |
| -------------------------- |
| -- 4.1.3 Selector Name -- |
| -------------------------- |
| |
| -- SELECTOR_NAME ::= IDENTIFIER | CHARACTER_LITERAL | OPERATOR_SYMBOL |
| |
| -------------------------------- |
| -- 4.1.4 Attribute Reference -- |
| -------------------------------- |
| |
| -- ATTRIBUTE_REFERENCE ::= PREFIX ' ATTRIBUTE_DESIGNATOR |
| |
| -- Note: the syntax is quite ambiguous at this point. Consider: |
| |
| -- A'Length (X) X is part of the attribute designator |
| -- A'Pos (X) X is an explicit actual parameter of function A'Pos |
| -- A'Class (X) X is the expression of a type conversion |
| |
| -- It would be possible for the parser to distinguish these cases |
| -- by looking at the attribute identifier. However, that would mean |
| -- more work in introducing new implementation defined attributes, |
| -- and also it would mean that special processing for attributes |
| -- would be scattered around, instead of being centralized in the |
| -- semantic routine that handles an N_Attribute_Reference node. |
| -- Consequently, the parser in all the above cases stores the |
| -- expression (X in these examples) as a single element list in |
| -- in the Expressions field of the N_Attribute_Reference node. |
| |
| -- Similarly, for attributes like Max which take two arguments, |
| -- we store the two arguments as a two element list in the |
| -- Expressions field. Of course it is clear at parse time that |
| -- this case is really a function call with an attribute as the |
| -- prefix, but it turns out to be convenient to handle the two |
| -- argument case in a similar manner to the one argument case, |
| -- and indeed in general the parser will accept any number of |
| -- expressions in this position and store them as a list in the |
| -- attribute reference node. This allows for future addition of |
| -- attributes that take more than two arguments. |
| |
| -- Note: named associates are not permitted in function calls where |
| -- the function is an attribute (see RM 6.4(3)) so it is legitimate |
| -- to skip the normal subprogram argument processing. |
| |
| -- Note: for the attributes whose designators are technically keywords, |
| -- i.e. digits, access, delta, range, the Attribute_Name field contains |
| -- the corresponding name, even though no identifier is involved. |
| |
| -- The flag OK_For_Stream is used in generated code to indicate that |
| -- a stream attribute is permissible for a limited type, and results |
| -- in the use of the stream attribute for the underlying full type, |
| -- or in the case of a protected type, the components (including any |
| -- disriminants) are merely streamed in order. |
| |
| -- See Exp_Attr for a complete description of which attributes are |
| -- passed onto Gigi, and which are handled entirely by the front end. |
| |
| -- Gigi restriction: For the Pos attribute, the prefix cannot be |
| -- a non-standard enumeration type or a nonzero/zero semantics |
| -- boolean type, so the value is simply the stored representation. |
| |
| -- Note: In generated code, the Address and Unrestricted_Access |
| -- attributes can be applied to any expression, and the meaning is |
| -- to create an object containing the value (the object is in the |
| -- current stack frame), and pass the address of this value. If the |
| -- Must_Be_Byte_Aligned flag is set, then the object whose address |
| -- is taken must be on a byte (storage unit) boundary, and if it is |
| -- not (or may not be), then the generated code must create a copy |
| -- that is byte aligned, and pass the address of this copy. |
| |
| -- N_Attribute_Reference |
| -- Sloc points to apostrophe |
| -- Prefix (Node3) |
| -- Attribute_Name (Name2) identifier name from attribute designator |
| -- Expressions (List1) (set to No_List if no associated expressions) |
| -- Entity (Node4-Sem) used if the attribute yields a type |
| -- Associated_Node (Node4-Sem) |
| -- Do_Overflow_Check (Flag17-Sem) |
| -- Redundant_Use (Flag13-Sem) |
| -- OK_For_Stream (Flag4-Sem) |
| -- Must_Be_Byte_Aligned (Flag14) |
| -- plus fields for expression |
| |
| --------------------------------- |
| -- 4.1.4 Attribute Designator -- |
| --------------------------------- |
| |
| -- ATTRIBUTE_DESIGNATOR ::= |
| -- IDENTIFIER [(static_EXPRESSION)] |
| -- | access | delta | digits |
| |
| -- There is no explicit node in the tree for an attribute designator. |
| -- Instead the Attribute_Name and Expressions fields of the parent |
| -- node (N_Attribute_Reference node) hold the information. |
| |
| -- Note: if ACCESS, DELTA or DIGITS appears in an attribute |
| -- designator, then they are treated as identifiers internally |
| -- rather than the keywords of the same name. |
| |
| -------------------------------------- |
| -- 4.1.4 Range Attribute Reference -- |
| -------------------------------------- |
| |
| -- RANGE_ATTRIBUTE_REFERENCE ::= PREFIX ' RANGE_ATTRIBUTE_DESIGNATOR |
| |
| -- A range attribute reference is represented in the tree using the |
| -- normal N_Attribute_Reference node. |
| |
| --------------------------------------- |
| -- 4.1.4 Range Attribute Designator -- |
| --------------------------------------- |
| |
| -- RANGE_ATTRIBUTE_DESIGNATOR ::= Range [(static_EXPRESSION)] |
| |
| -- A range attribute designator is represented in the tree using the |
| -- normal N_Attribute_Reference node. |
| |
| -------------------- |
| -- 4.3 Aggregate -- |
| -------------------- |
| |
| -- AGGREGATE ::= |
| -- RECORD_AGGREGATE | EXTENSION_AGGREGATE | ARRAY_AGGREGATE |
| |
| ----------------------------- |
| -- 4.3.1 Record Aggregate -- |
| ----------------------------- |
| |
| -- RECORD_AGGREGATE ::= (RECORD_COMPONENT_ASSOCIATION_LIST) |
| |
| -- N_Aggregate |
| -- Sloc points to left parenthesis |
| -- Expressions (List1) (set to No_List if none or null record case) |
| -- Component_Associations (List2) (set to No_List if none) |
| -- Null_Record_Present (Flag17) |
| -- Aggregate_Bounds (Node3-Sem) |
| -- Associated_Node (Node4-Sem) |
| -- Static_Processing_OK (Flag4-Sem) |
| -- Compile_Time_Known_Aggregate (Flag18-Sem) |
| -- Expansion_Delayed (Flag11-Sem) |
| -- plus fields for expression |
| |
| -- Note: this structure is used for both record and array aggregates |
| -- since the two cases are not separable by the parser. The parser |
| -- makes no attempt to enforce consistency here, so it is up to the |
| -- semantic phase to make sure that the aggregate is consistent (i.e. |
| -- that it is not a "half-and-half" case that mixes record and array |
| -- syntax. In particular, for a record aggregate, the expressions |
| -- field will be set if there are positional associations. |
| |
| -- Note: gigi/gcc can handle array aggregates correctly providing that |
| -- they are entirely positional, and the array subtype involved has a |
| -- known at compile time length and is not bit packed, or a convention |
| -- Fortran array with more than one dimension. If these conditions |
| -- are not met, then the front end must translate the aggregate into |
| -- an appropriate set of assignments into a temporary. |
| |
| -- Note: for the record aggregate case, gigi/gcc can handle all cases |
| -- of record aggregates, including those for packed, and rep-claused |
| -- records, and also variant records, providing that there are no |
| -- variable length fields whose size is not known at runtime, and |
| -- providing that the aggregate is presented in fully named form. |
| |
| ---------------------------------------------- |
| -- 4.3.1 Record Component Association List -- |
| ---------------------------------------------- |
| |
| -- RECORD_COMPONENT_ASSOCIATION_LIST ::= |
| -- RECORD_COMPONENT_ASSOCIATION {, RECORD_COMPONENT_ASSOCIATION} |
| -- | null record |
| |
| -- There is no explicit node in the tree for a record component |
| -- association list. Instead the Null_Record_Present flag is set in |
| -- the parent node for the NULL RECORD case. |
| |
| ------------------------------------------------------ |
| -- 4.3.1 Record Component Association (also 4.3.3) -- |
| ------------------------------------------------------ |
| |
| -- RECORD_COMPONENT_ASSOCIATION ::= |
| -- [COMPONENT_CHOICE_LIST =>] EXPRESSION |
| |
| -- N_Component_Association |
| -- Sloc points to first selector name |
| -- Choices (List1) |
| -- Loop_Actions (List2-Sem) |
| -- Expression (Node3) |
| -- Box_Present (Flag15) |
| |
| -- Note: this structure is used for both record component associations |
| -- and array component associations, since the two cases aren't always |
| -- separable by the parser. The choices list may represent either a |
| -- list of selector names in the record aggregate case, or a list of |
| -- discrete choices in the array aggregate case or an N_Others_Choice |
| -- node (which appears as a singleton list). Box_Present gives support |
| -- to Ada0Y (AI-287). |
| |
| ------------------------------------ |
| -- 4.3.1 Commponent Choice List -- |
| ------------------------------------ |
| |
| -- COMPONENT_CHOICE_LIST ::= |
| -- component_SELECTOR_NAME {| component_SELECTOR_NAME} |
| -- | others |
| |
| -- The entries of a component choice list appear in the Choices list |
| -- of the associated N_Component_Association, as either selector |
| -- names, or as an N_Others_Choice node. |
| |
| -------------------------------- |
| -- 4.3.2 Extension Aggregate -- |
| -------------------------------- |
| |
| -- EXTENSION_AGGREGATE ::= |
| -- (ANCESTOR_PART with RECORD_COMPONENT_ASSOCIATION_LIST) |
| |
| -- Note: extension aggregates are not permitted in Ada 83 mode |
| |
| -- N_Extension_Aggregate |
| -- Sloc points to left parenthesis |
| -- Ancestor_Part (Node3) |
| -- Associated_Node (Node4-Sem) |
| -- Expressions (List1) (set to No_List if none or null record case) |
| -- Component_Associations (List2) (set to No_List if none) |
| -- Null_Record_Present (Flag17) |
| -- Expansion_Delayed (Flag11-Sem) |
| -- plus fields for expression |
| |
| -------------------------- |
| -- 4.3.2 Ancestor Part -- |
| -------------------------- |
| |
| -- ANCESTOR_PART ::= EXPRESSION | SUBTYPE_MARK |
| |
| ---------------------------- |
| -- 4.3.3 Array Aggregate -- |
| ---------------------------- |
| |
| -- ARRAY_AGGREGATE ::= |
| -- POSITIONAL_ARRAY_AGGREGATE | NAMED_ARRAY_AGGREGATE |
| |
| --------------------------------------- |
| -- 4.3.3 Positional Array Aggregate -- |
| --------------------------------------- |
| |
| -- POSITIONAL_ARRAY_AGGREGATE ::= |
| -- (EXPRESSION, EXPRESSION {, EXPRESSION}) |
| -- | (EXPRESSION {, EXPRESSION}, others => EXPRESSION) |
| |
| -- See Record_Aggregate (4.3.1) for node structure |
| |
| ---------------------------------- |
| -- 4.3.3 Named Array Aggregate -- |
| ---------------------------------- |
| |
| -- NAMED_ARRAY_AGGREGATE ::= |
| -- | (ARRAY_COMPONENT_ASSOCIATION {, ARRAY_COMPONENT_ASSOCIATION}) |
| |
| -- See Record_Aggregate (4.3.1) for node structure |
| |
| ---------------------------------------- |
| -- 4.3.3 Array Component Association -- |
| ---------------------------------------- |
| |
| -- ARRAY_COMPONENT_ASSOCIATION ::= |
| -- DISCRETE_CHOICE_LIST => EXPRESSION |
| |
| -- See Record_Component_Association (4.3.1) for node structure |
| |
| -------------------------------------------------- |
| -- 4.4 Expression/Relation/Term/Factor/Primary -- |
| -------------------------------------------------- |
| |
| -- EXPRESSION ::= |
| -- RELATION {and RELATION} | RELATION {and then RELATION} |
| -- | RELATION {or RELATION} | RELATION {or else RELATION} |
| -- | RELATION {xor RELATION} |
| |
| -- RELATION ::= |
| -- SIMPLE_EXPRESSION [RELATIONAL_OPERATOR SIMPLE_EXPRESSION] |
| -- | SIMPLE_EXPRESSION [not] in RANGE |
| -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK |
| |
| -- SIMPLE_EXPRESSION ::= |
| -- [UNARY_ADDING_OPERATOR] TERM {BINARY_ADDING_OPERATOR TERM} |
| |
| -- TERM ::= FACTOR {MULTIPLYING_OPERATOR FACTOR} |
| |
| -- FACTOR ::= PRIMARY [** PRIMARY] | abs PRIMARY | not PRIMARY |
| |
| -- No nodes are generated for any of these constructs. Instead, the |
| -- node for the operator appears directly. When we refer to an |
| -- expression in this description, we mean any of the possible |
| -- consistuent components of an expression (e.g. identifier is |
| -- an example of an expression). |
| |
| ------------------ |
| -- 4.4 Primary -- |
| ------------------ |
| |
| -- PRIMARY ::= |
| -- NUMERIC_LITERAL | null |
| -- | STRING_LITERAL | AGGREGATE |
| -- | NAME | QUALIFIED_EXPRESSION |
| -- | ALLOCATOR | (EXPRESSION) |
| |
| -- Usually there is no explicit node in the tree for primary. Instead |
| -- the constituent (e.g. AGGREGATE) appears directly. There are two |
| -- exceptions. First, there is an explicit node for a null primary. |
| |
| -- N_Null |
| -- Sloc points to NULL |
| -- plus fields for expression |
| |
| -- Second, the case of (EXPRESSION) is handled specially. Ada requires |
| -- that the parser keep track of which subexpressions are enclosed |
| -- in parentheses, and how many levels of parentheses are used. This |
| -- information is required for optimization purposes, and also for |
| -- some semantic checks (e.g. (((1))) in a procedure spec does not |
| -- conform with ((((1)))) in the body). |
| |
| -- The parentheses are recorded by keeping a Paren_Count field in every |
| -- subexpression node (it is actually present in all nodes, but only |
| -- used in subexpression nodes). This count records the number of |
| -- levels of parentheses. If the number of levels in the source exceeds |
| -- the maximum accomodated by this count, then the count is simply left |
| -- at the maximum value. This means that there are some pathalogical |
| -- cases of failure to detect conformance failures (e.g. an expression |
| -- with 500 levels of parens will conform with one with 501 levels), |
| -- but we do not need to lose sleep over this. |
| |
| -- Historical note: in versions of GNAT prior to 1.75, there was a node |
| -- type N_Parenthesized_Expression used to accurately record unlimited |
| -- numbers of levels of parentheses. However, it turned out to be a |
| -- real nuisance to have to take into account the possible presence of |
| -- this node during semantic analysis, since basically parentheses have |
| -- zero relevance to semantic analysis. |
| |
| -- Note: the level of parentheses always present in things like |
| -- aggregates does not count, only the parentheses in the primary |
| -- (EXPRESSION) affect the setting of the Paren_Count field. |
| |
| -- 2nd Note: the contents of the Expression field must be ignored (i.e. |
| -- treated as though it were Empty) if No_Initialization is set True. |
| |
| -------------------------------------- |
| -- 4.5 Short Circuit Control Forms -- |
| -------------------------------------- |
| |
| -- EXPRESSION ::= |
| -- RELATION {and then RELATION} | RELATION {or else RELATION} |
| |
| -- Gigi restriction: For both these control forms, the operand and |
| -- result types are always Standard.Boolean. The expander inserts the |
| -- required conversion operations where needed to ensure this is the |
| -- case. |
| |
| -- N_And_Then |
| -- Sloc points to AND of AND THEN |
| -- Left_Opnd (Node2) |
| -- Right_Opnd (Node3) |
| -- Actions (List1-Sem) |
| -- plus fields for expression |
| |
| -- N_Or_Else |
| -- Sloc points to OR of OR ELSE |
| -- Left_Opnd (Node2) |
| -- Right_Opnd (Node3) |
| -- Actions (List1-Sem) |
| -- plus fields for expression |
| |
| -- Note: The Actions field is used to hold actions associated with |
| -- the right hand operand. These have to be treated specially since |
| -- they are not unconditionally executed. See Insert_Actions for a |
| -- more detailed description of how these actions are handled. |
| |
| --------------------------- |
| -- 4.5 Membership Tests -- |
| --------------------------- |
| |
| -- RELATION ::= |
| -- SIMPLE_EXPRESSION [not] in RANGE |
| -- | SIMPLE_EXPRESSION [not] in SUBTYPE_MARK |
| |
| -- Note: although the grammar above allows only a range or a |
| -- subtype mark, the parser in fact will accept any simple |
| -- expression in place of a subtype mark. This means that the |
| -- semantic analyzer must be prepared to deal with, and diagnose |
| -- a simple expression other than a name for the right operand. |
| -- This simplifies error recovery in the parser. |
| |
| -- N_In |
| -- Sloc points to IN |
| -- Left_Opnd (Node2) |
| -- Right_Opnd (Node3) |
| -- plus fields for expression |
| |
| -- N_Not_In |
| -- Sloc points to NOT of NOT IN |
| -- Left_Opnd (Node2) |
| -- Right_Opnd (Node3) |
| -- plus fields for expression |
| |
| -------------------- |
| -- 4.5 Operators -- |
| -------------------- |
| |
| -- LOGICAL_OPERATOR ::= and | or | xor |
| |
| -- RELATIONAL_OPERATOR ::= = | /= | < | <= | > | >= |
| |
| -- BINARY_ADDING_OPERATOR ::= + | - | & |
| |
| -- UNARY_ADDING_OPERATOR ::= + | - |
| |
| -- MULTIPLYING_OPERATOR ::= * | / | mod | rem |
| |
| -- HIGHEST_PRECEDENCE_OPERATOR ::= ** | abs | not |
| |
| -- Sprint syntax if Treat_Fixed_As_Integer is set: |
| |
| -- x #* y |
| -- x #/ y |
| -- x #mod y |
| -- x #rem y |
| |
| -- Gigi restriction: For * / mod rem with fixed-point operands, Gigi |
| -- will only be given nodes with the Treat_Fixed_As_Integer flag set. |
| -- All handling of smalls for multiplication and division is handled |
| -- by the front end (mod and rem result only from expansion). Gigi |
| -- thus never needs to worry about small values (for other operators |
| -- operating on fixed-point, e.g. addition, the small value does not |
| -- have any semantic effect anyway, these are always integer operations. |
| |
| -- Gigi restriction: For all operators taking Boolean operands, the |
| -- type is always Standard.Boolean. The expander inserts the required |
| -- conversion operations where needed to ensure this is the case. |
| |
| -- N_Op_And |
| -- Sloc points to AND |
| -- Do_Length_Check (Flag4-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Or |
| -- Sloc points to OR |
| -- Do_Length_Check (Flag4-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Xor |
| -- Sloc points to XOR |
| -- Do_Length_Check (Flag4-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Eq |
| -- Sloc points to = |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Ne |
| -- Sloc points to /= |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Lt |
| -- Sloc points to < |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Le |
| -- Sloc points to <= |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Gt |
| -- Sloc points to > |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Ge |
| -- Sloc points to >= |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Add |
| -- Sloc points to + (binary) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Subtract |
| -- Sloc points to - (binary) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Concat |
| -- Sloc points to & |
| -- Is_Component_Left_Opnd (Flag13-Sem) |
| -- Is_Component_Right_Opnd (Flag14-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Multiply |
| -- Sloc points to * |
| -- Treat_Fixed_As_Integer (Flag14-Sem) |
| -- Rounded_Result (Flag18-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Divide |
| -- Sloc points to / |
| -- Treat_Fixed_As_Integer (Flag14-Sem) |
| -- Do_Division_Check (Flag13-Sem) |
| -- Rounded_Result (Flag18-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Mod |
| -- Sloc points to MOD |
| -- Treat_Fixed_As_Integer (Flag14-Sem) |
| -- Do_Division_Check (Flag13-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Rem |
| -- Sloc points to REM |
| -- Treat_Fixed_As_Integer (Flag14-Sem) |
| -- Do_Division_Check (Flag13-Sem) |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Expon |
| -- Is_Power_Of_2_For_Shift (Flag13-Sem) |
| -- Sloc points to ** |
| -- plus fields for binary operator |
| -- plus fields for expression |
| |
| -- N_Op_Plus |
| -- Sloc points to + (unary) |
| -- plus fields for unary operator |
| -- plus fields for expression |
| |
| -- N_Op_Minus |
| -- Sloc points to - (unary) |
| -- plus fields for unary operator |
| -- plus fields for expression |
| |
| -- N_Op_Abs |
| -- Sloc points to ABS |
| -- plus fields for unary operator |
| -- plus fields for expression |
| |
| -- N_Op_Not |
| -- Sloc points to NOT |
| -- plus fields for unary operator |
| -- plus fields for expression |
| |
| -- See also shift operators in section B.2 |
| |
| -- Note on fixed-point operations passed to Gigi: For adding operators, |
| -- the semantics is to treat these simply as integer operations, with |
| -- the small values being ignored (the bounds are already stored in |
| -- units of small, so that constraint checking works as usual). For the |
| -- case of multiply/divide/rem/mod operations, Gigi will only see fixed |
| -- point operands if the Treat_Fixed_As_Integer flag is set and will |
| -- thus treat these nodes in identical manner, ignoring small values. |
| |
| -------------------------- |
| -- 4.6 Type Conversion -- |
| -------------------------- |
| |
| -- TYPE_CONVERSION ::= |
| -- SUBTYPE_MARK (EXPRESSION) | SUBTYPE_MARK (NAME) |
| |
| -- In the (NAME) case, the name is stored as the expression |
| |
| -- Note: the parser never generates a type conversion node, since it |
| -- looks like an indexed component which is generated by preference. |
| -- The semantic pass must correct this misidentification. |
| |
| -- Gigi handles conversions that involve no change in the root type, |
| -- and also all conversions from integer to floating-point types. |
| -- Conversions from floating-point to integer are only handled in |
| -- the case where Float_Truncate flag set. Other conversions from |
| -- floating-point to integer (involving rounding) and all conversions |
| -- involving fixed-point types are handled by the expander. |
| |
| -- Sprint syntax if Float_Truncate set: X^(Y) |
| -- Sprint syntax if Conversion_OK set X?(Y) |
| -- Sprint syntax if both flags set X?^(Y) |
| |
| -- Note: If either the operand or result type is fixed-point, Gigi will |
| -- only see a type conversion node with Conversion_OK set. The front end |
| -- takes care of all handling of small's for fixed-point conversions. |
| |
| -- N_Type_Conversion |
| -- Sloc points to first token of subtype mark |
| -- Subtype_Mark (Node4) |
| -- Expression (Node3) |
| -- Do_Tag_Check (Flag13-Sem) |
| -- Do_Length_Check (Flag4-Sem) |
| -- Do_Overflow_Check (Flag17-Sem) |
| -- Float_Truncate (Flag11-Sem) |
| -- Rounded_Result (Flag18-Sem) |
| -- Conversion_OK (Flag14-Sem) |
| -- plus fields for expression |
| |
| -- Note: if a range check is required, then the Do_Range_Check flag |
| -- is set in the Expression with the check being done against the |
| -- target type range (after the base type conversion, if any). |
| |
| ------------------------------- |
| -- 4.7 Qualified Expression -- |
| ------------------------------- |
| |
| -- QUALIFIED_EXPRESSION ::= |
| -- SUBTYPE_MARK ' (EXPRESSION) | SUBTYPE_MARK ' AGGREGATE |
| |
| -- Note: the parentheses in the (EXPRESSION) case are deemed to enclose |
| -- the expression, so the Expression field of this node always points |
| -- to a parenthesized expression in this case (i.e. Paren_Count will |
| -- always be non-zero for the referenced expression if it is not an |
| -- aggregate). |
| |
| -- N_Qualified_Expression |
| -- Sloc points to apostrophe |
| -- Subtype_Mark (Node4) |
| -- Expression (Node3) expression or aggregate |
| -- plus fields for expression |
| |
| -------------------- |
| -- 4.8 Allocator -- |
| -------------------- |
| |
| -- ALLOCATOR ::= |
| -- new SUBTYPE_INDICATION | new QUALIFIED_EXPRESSION |
| |
| -- Sprint syntax (when storage pool present) |
| -- new xxx (storage_pool = pool) |
| |
| -- N_Allocator |
| -- Sloc points to NEW |
| -- Expression (Node3) subtype indication or qualified expression |
| -- Storage_Pool (Node1-Sem) |
| -- Procedure_To_Call (Node4-Sem) |
| -- No_Initialization (Flag13-Sem) |
| -- Do_Storage_Check (Flag17-Sem) |
| -- plus fields for expression |
| |
| --------------------------------- |
| -- 5.1 Sequence Of Statements -- |
| --------------------------------- |
| |
| -- SEQUENCE_OF_STATEMENTS ::= STATEMENT {STATEMENT} |
| |
| -- Note: Although the parser will not accept a declaration as a |
| -- statement, the semantic analyzer may insert declarations (e.g. |
| -- declarations of implicit types needed for execution of other |
| -- statements) into a sequence of statements, so the code genmerator |
| -- should be prepared to accept a declaration where a statement is |
| -- expected. Note also that pragmas can appear as statements. |
| |
| -------------------- |
| -- 5.1 Statement -- |
| -------------------- |
| |
| -- STATEMENT ::= |
| -- {LABEL} SIMPLE_STATEMENT | {LABEL} COMPOUND_STATEMENT |
| |
| -- There is no explicit node in the tree for a statement. Instead, the |
| -- individual statement appears directly. Labels are treated as a |
| -- kind of statement, i.e. they are linked into a statement list at |
| -- the point they appear, so the labeled statement appears following |
| -- the label or labels in the statement list. |
| |
| --------------------------- |
| -- 5.1 Simple Statement -- |
| --------------------------- |
| |
| -- SIMPLE_STATEMENT ::= NULL_STATEMENT |
| -- | ASSIGNMENT_STATEMENT | EXIT_STATEMENT |
| -- | GOTO_STATEMENT | PROCEDURE_CALL_STATEMENT |
| -- | RETURN_STATEMENT | ENTRY_CALL_STATEMENT |
| -- | REQUEUE_STATEMENT | DELAY_STATEMENT |
| -- | ABORT_STATEMENT | RAISE_STATEMENT |
| -- | CODE_STATEMENT |
| |
| ----------------------------- |
| -- 5.1 Compound Statement -- |
| ----------------------------- |
| |
| -- COMPOUND_STATEMENT ::= |
| -- IF_STATEMENT | CASE_STATEMENT |
| -- | LOOP_STATEMENT | BLOCK_STATEMENT |
| -- | ACCEPT_STATEMENT | SELECT_STATEMENT |
| |
| ------------------------- |
| -- 5.1 Null Statement -- |
| ------------------------- |
| |
| -- NULL_STATEMENT ::= null; |
| |
| -- N_Null_Statement |
| -- Sloc points to NULL |
| |
| ---------------- |
| -- 5.1 Label -- |
| ---------------- |
| |
| -- LABEL ::= <<label_STATEMENT_IDENTIFIER>> |
| |
| -- Note that the occurrence of a label is not a defining identifier, |
| -- but rather a referencing occurrence. The defining occurrence is |
| -- in the implicit label declaration which occurs in the innermost |
| -- enclosing block. |
| |
| -- N_Label |
| -- Sloc points to << |
| -- Identifier (Node1) direct name of statement identifier |
| -- Exception_Junk (Flag11-Sem) |
| |
| ------------------------------- |
| -- 5.1 Statement Identifier -- |
| ------------------------------- |
| |
| -- STATEMENT_INDENTIFIER ::= DIRECT_NAME |
| |
| -- The IDENTIFIER of a STATEMENT_IDENTIFIER shall be an identifier |
| -- (not an OPERATOR_SYMBOL) |
| |
| ------------------------------- |
| -- 5.2 Assignment Statement -- |
| ------------------------------- |
| |
| -- ASSIGNMENT_STATEMENT ::= |
| -- variable_NAME := EXPRESSION; |
| |
| -- N_Assignment_Statement |
| -- Sloc points to := |
| -- Name (Node2) |
| -- Expression (Node3) |
| -- Do_Tag_Check (Flag13-Sem) |
| -- Do_Length_Check (Flag4-Sem) |
| -- Forwards_OK (Flag5-Sem) |
| -- Backwards_OK (Flag6-Sem) |
| -- No_Ctrl_Actions (Flag7-Sem) |
| |
| -- Note: if a range check is required, then the Do_Range_Check flag |
| -- is set in the Expression (right hand side), with the check being |
| -- done against the type of the Name (left hand side). |
| |
| -- Note: the back end places some restrictions on the form of the |
| -- Expression field. If the object being assigned to is Atomic, then |
| -- the Expression may not have the form of an aggregate (since this |
| -- might cause the back end to generate separate assignments). It |
| -- also cannot be a reference to an object marked as a true constant |
| -- (Is_True_Constant flag set), where the object is itself initalized |
| -- with an aggregate. If necessary the front end must generate an |
| -- extra temporary (with Is_True_Constant set False), and initialize |
| -- this temporary as required (the temporary itself is not atomic). |
| |
| ----------------------- |
| -- 5.3 If Statement -- |
| ----------------------- |
| |
| -- IF_STATEMENT ::= |
| -- if CONDITION then |
| -- SEQUENCE_OF_STATEMENTS |
| -- {elsif CONDITION then |
| -- SEQUENCE_OF_STATEMENTS} |
| -- [else |
| -- SEQUENCE_OF_STATEMENTS] |
| -- end if; |
| |
| -- Gigi restriction: This expander ensures that the type of the |
| -- Condition fields is always Standard.Boolean, even if the type |
| -- in the source is some non-standard boolean type. |
| |
| -- N_If_Statement |
| -- Sloc points to IF |
| -- Condition (Node1) |
| -- Then_Statements (List2) |
| -- Elsif_Parts (List3) (set to No_List if none present) |
| -- Else_Statements (List4) (set to No_List if no else part present) |
| -- End_Span (Uint5) (set to No_Uint if expander generated) |
| |
| -- N_Elsif_Part |
| -- Sloc points to ELSIF |
| -- Condition (Node1) |
| -- Then_Statements (List2) |
| -- Condition_Actions (List3-Sem) |
| |
| -------------------- |
| -- 5.3 Condition -- |
| -------------------- |
| |
| -- CONDITION ::= boolean_EXPRESSION |
| |
| ------------------------- |
| -- 5.4 Case Statement -- |
| ------------------------- |
| |
| -- CASE_STATEMENT ::= |
| -- case EXPRESSION is |
| -- CASE_STATEMENT_ALTERNATIVE |
| -- {CASE_STATEMENT_ALTERNATIVE} |
| -- end case; |
| |
| -- Note: the Alternatives can contain pragmas. These only occur at |
| -- the start of the list, since any pragmas occurring after the first |
| -- alternative are absorbed into the corresponding statement sequence. |
| |
| -- N_Case_Statement |
| -- Sloc points to CASE |
| -- Expression (Node3) |
| -- Alternatives (List4) |
| -- End_Span (Uint5) (set to No_Uint if expander generated) |
| |
| ------------------------------------- |
| -- 5.4 Case Statement Alternative -- |
| ------------------------------------- |
| |
| -- CASE_STATEMENT_ALTERNATIVE ::= |
| -- when DISCRETE_CHOICE_LIST => |
| -- SEQUENCE_OF_STATEMENTS |
| |
| -- N_Case_Statement_Alternative |
| -- Sloc points to WHEN |
| -- Discrete_Choices (List4) |
| -- Statements (List3) |
| |
| ------------------------- |
| -- 5.5 Loop Statement -- |
| ------------------------- |
| |
| -- LOOP_STATEMENT ::= |
| -- [loop_STATEMENT_IDENTIFIER :] |
| -- [ITERATION_SCHEME] loop |
| -- SEQUENCE_OF_STATEMENTS |
| -- end loop [loop_IDENTIFIER]; |
| |
| -- Note: The occurrence of a loop label is not a defining identifier |
| -- but rather a referencing occurrence. The defining occurrence is in |
| -- the implicit label declaration which occurs in the innermost |
| -- enclosing block. |
| |
| -- Note: there is always a loop statement identifier present in |
| -- the tree, even if none was given in the source. In the case where |
| -- no loop identifier is given in the source, the parser creates |
| -- a name of the form _Loop_n, where n is a decimal integer (the |
| -- two underlines ensure that the loop names created in this manner |
| -- do not conflict with any user defined identifiers), and the flag |
| -- Has_Created_Identifier is set to True. The only exception to the |
| -- rule that all loop statement nodes have identifiers occurs for |
| -- loops constructed by the expander, and the semantic analyzer will |
| -- create and supply dummy loop identifiers in these cases. |
| |
| -- N_Loop_Statement |
| -- Sloc points to LOOP |
| -- Identifier (Node1) loop identifier (set to Empty if no identifier) |
| -- Iteration_Scheme (Node2) (set to Empty if no iteration scheme) |
| -- Statements (List3) |
| -- End_Label (Node4) |
| -- Has_Created_Identifier (Flag15) |
| -- Is_Null_Loop (Flag16) |
| |
| -------------------------- |
| -- 5.5 Iteration Scheme -- |
| -------------------------- |
| |
| -- ITERATION_SCHEME ::= |
| -- while CONDITION | for LOOP_PARAMETER_SPECIFICATION |
| |
| -- Gigi restriction: This expander ensures that the type of the |
| -- Condition field is always Standard.Boolean, even if the type |
| -- in the source is some non-standard boolean type. |
| |
| -- N_Iteration_Scheme |
| -- Sloc points to WHILE or FOR |
| -- Condition (Node1) (set to Empty if FOR case) |
| -- Condition_Actions (List3-Sem) |
| -- Loop_Parameter_Specification (Node4) (set to Empty if WHILE case) |
| |
| --------------------------------------- |
| -- 5.5 Loop parameter specification -- |
| --------------------------------------- |
| |
| -- LOOP_PARAMETER_SPECIFICATION ::= |
| -- DEFINING_IDENTIFIER in [reverse] DISCRETE_SUBTYPE_DEFINITION |
| |
| -- N_Loop_Parameter_Specification |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- Reverse_Present (Flag15) |
| -- Discrete_Subtype_Definition (Node4) |
| |
| -------------------------- |
| -- 5.6 Block Statement -- |
| -------------------------- |
| |
| -- BLOCK_STATEMENT ::= |
| -- [block_STATEMENT_IDENTIFIER:] |
| -- [declare |
| -- DECLARATIVE_PART] |
| -- begin |
| -- HANDLED_SEQUENCE_OF_STATEMENTS |
| -- end [block_IDENTIFIER]; |
| |
| -- Note that the occurrence of a block identifier is not a defining |
| -- identifier, but rather a referencing occurrence. The defining |
| -- occurrence is in the implicit label declaration which occurs in |
| -- the innermost enclosing block. |
| |
| -- Note: there is always a block statement identifier present in |
| -- the tree, even if none was given in the source. In the case where |
| -- no block identifier is given in the source, the parser creates |
| -- a name of the form _Block_n, where n is a decimal integer (the |
| -- two underlines ensure that the block names created in this manner |
| -- do not conflict with any user defined identifiers), and the flag |
| -- Has_Created_Identifier is set to True. The only exception to the |
| -- rule that all loop statement nodes have identifiers occurs for |
| -- blocks constructed by the expander, and the semantic analyzer |
| -- creates and supplies dummy names for the blocks). |
| |
| -- N_Block_Statement |
| -- Sloc points to DECLARE or BEGIN |
| -- Identifier (Node1) block direct name (set to Empty if not present) |
| -- Declarations (List2) (set to No_List if no DECLARE part) |
| -- Handled_Statement_Sequence (Node4) |
| -- Is_Task_Master (Flag5-Sem) |
| -- Activation_Chain_Entity (Node3-Sem) |
| -- Has_Created_Identifier (Flag15) |
| -- Is_Task_Allocation_Block (Flag6) |
| -- Is_Asynchronous_Call_Block (Flag7) |
| |
| ------------------------- |
| -- 5.7 Exit Statement -- |
| ------------------------- |
| |
| -- EXIT_STATEMENT ::= exit [loop_NAME] [when CONDITION]; |
| |
| -- Gigi restriction: This expander ensures that the type of the |
| -- Condition field is always Standard.Boolean, even if the type |
| -- in the source is some non-standard boolean type. |
| |
| -- N_Exit_Statement |
| -- Sloc points to EXIT |
| -- Name (Node2) (set to Empty if no loop name present) |
| -- Condition (Node1) (set to Empty if no when part present) |
| |
| ------------------------- |
| -- 5.9 Goto Statement -- |
| ------------------------- |
| |
| -- GOTO_STATEMENT ::= goto label_NAME; |
| |
| -- N_Goto_Statement |
| -- Sloc points to GOTO |
| -- Name (Node2) |
| -- Exception_Junk (Flag11-Sem) |
| |
| --------------------------------- |
| -- 6.1 Subprogram Declaration -- |
| --------------------------------- |
| |
| -- SUBPROGRAM_DECLARATION ::= SUBPROGRAM_SPECIFICATION; |
| |
| -- N_Subprogram_Declaration |
| -- Sloc points to FUNCTION or PROCEDURE |
| -- Specification (Node1) |
| -- Body_To_Inline (Node3-Sem) |
| -- Corresponding_Body (Node5-Sem) |
| -- Parent_Spec (Node4-Sem) |
| |
| ------------------------------------------ |
| -- 6.1 Abstract Subprogram Declaration -- |
| ------------------------------------------ |
| |
| -- ABSTRACT_SUBPROGRAM_DECLARATION ::= |
| -- SUBPROGRAM_SPECIFICATION is abstract; |
| |
| -- N_Abstract_Subprogram_Declaration |
| -- Sloc points to ABSTRACT |
| -- Specification (Node1) |
| |
| ----------------------------------- |
| -- 6.1 Subprogram Specification -- |
| ----------------------------------- |
| |
| -- SUBPROGRAM_SPECIFICATION ::= |
| -- procedure DEFINING_PROGRAM_UNIT_NAME PARAMETER_PROFILE |
| -- | function DEFINING_DESIGNATOR PARAMETER_AND_RESULT_PROFILE |
| |
| -- Note: there are no separate nodes for the profiles, instead the |
| -- information appears directly in the following nodes. |
| |
| -- N_Function_Specification |
| -- Sloc points to FUNCTION |
| -- Defining_Unit_Name (Node1) (the designator) |
| -- Elaboration_Boolean (Node2-Sem) |
| -- Parameter_Specifications (List3) (set to No_List if no formal part) |
| -- Subtype_Mark (Node4) for return type |
| -- Generic_Parent (Node5-Sem) |
| |
| -- N_Procedure_Specification |
| -- Sloc points to PROCEDURE |
| -- Defining_Unit_Name (Node1) |
| -- Elaboration_Boolean (Node2-Sem) |
| -- Parameter_Specifications (List3) (set to No_List if no formal part) |
| -- Generic_Parent (Node5-Sem) |
| |
| --------------------- |
| -- 6.1 Designator -- |
| --------------------- |
| |
| -- DESIGNATOR ::= |
| -- [PARENT_UNIT_NAME .] IDENTIFIER | OPERATOR_SYMBOL |
| |
| -- Designators that are simply identifiers or operator symbols appear |
| -- directly in the tree in this form. The following node is used only |
| -- in the case where the designator has a parent unit name component. |
| |
| -- N_Designator |
| -- Sloc points to period |
| -- Name (Node2) holds the parent unit name. Note that this is always |
| -- non-Empty, since this node is only used for the case where a |
| -- parent library unit package name is present. |
| -- Identifier (Node1) |
| |
| -- Note that the identifier can also be an operator symbol here. |
| |
| ------------------------------ |
| -- 6.1 Defining Designator -- |
| ------------------------------ |
| |
| -- DEFINING_DESIGNATOR ::= |
| -- DEFINING_PROGRAM_UNIT_NAME | DEFINING_OPERATOR_SYMBOL |
| |
| ------------------------------------- |
| -- 6.1 Defining Program Unit Name -- |
| ------------------------------------- |
| |
| -- DEFINING_PROGRAM_UNIT_NAME ::= |
| -- [PARENT_UNIT_NAME .] DEFINING_IDENTIFIER |
| |
| -- The parent unit name is present only in the case of a child unit |
| -- name (permissible only for Ada 95 for a library level unit, i.e. |
| -- a unit at scope level one). If no such name is present, the defining |
| -- program unit name is represented simply as the defining identifier. |
| -- In the child unit case, the following node is used to represent the |
| -- child unit name. |
| |
| -- N_Defining_Program_Unit_Name |
| -- Sloc points to period |
| -- Name (Node2) holds the parent unit name. Note that this is always |
| -- non-Empty, since this node is only used for the case where a |
| -- parent unit name is present. |
| -- Defining_Identifier (Node1) |
| |
| -------------------------- |
| -- 6.1 Operator Symbol -- |
| -------------------------- |
| |
| -- OPERATOR_SYMBOL ::= STRING_LITERAL |
| |
| -- Note: the fields of the N_Operator_Symbol node are laid out to |
| -- match the corresponding fields of an N_Character_Literal node. This |
| -- allows easy conversion of the operator symbol node into a character |
| -- literal node in the case where a string constant of the form of an |
| -- operator symbol is scanned out as such, but turns out semantically |
| -- to be a string literal that is not an operator. For details see |
| -- Sinfo.CN.Change_Operator_Symbol_To_String_Literal. |
| |
| -- N_Operator_Symbol |
| -- Sloc points to literal |
| -- Chars (Name1) contains the Name_Id for the operator symbol |
| -- Strval (Str3) Id of string value. This is used if the operator |
| -- symbol turns out to be a normal string after all. |
| -- Entity (Node4-Sem) |
| -- Associated_Node (Node4-Sem) |
| -- Has_Private_View (Flag11-Sem) set in generic units. |
| -- Etype (Node5-Sem) |
| |
| -- Note: the Strval field may be set to No_String for generated |
| -- operator symbols that are known not to be string literals |
| -- semantically. |
| |
| ----------------------------------- |
| -- 6.1 Defining Operator Symbol -- |
| ----------------------------------- |
| |
| -- DEFINING_OPERATOR_SYMBOL ::= OPERATOR_SYMBOL |
| |
| -- A defining operator symbol is an entity, which has additional |
| -- fields depending on the setting of the Ekind field. These |
| -- additional fields are defined (and access subprograms declared) |
| -- in package Einfo. |
| |
| -- Note: N_Defining_Operator_Symbol is an extended node whose fields |
| -- are deliberately layed out to match the layout of fields in an |
| -- ordinary N_Operator_Symbol node allowing for easy alteration of |
| -- an operator symbol node into a defining operator symbol node. |
| -- See Sinfo.CN.Change_Operator_Symbol_To_Defining_Operator_Symbol |
| -- for further details. |
| |
| -- N_Defining_Operator_Symbol |
| -- Sloc points to literal |
| -- Chars (Name1) contains the Name_Id for the operator symbol |
| -- Next_Entity (Node2-Sem) |
| -- Scope (Node3-Sem) |
| -- Etype (Node5-Sem) |
| |
| ---------------------------- |
| -- 6.1 Parameter Profile -- |
| ---------------------------- |
| |
| -- PARAMETER_PROFILE ::= [FORMAL_PART] |
| |
| --------------------------------------- |
| -- 6.1 Parameter and Result Profile -- |
| --------------------------------------- |
| |
| -- PARAMETER_AND_RESULT_PROFILE ::= [FORMAL_PART] return SUBTYPE_MARK |
| |
| -- There is no explicit node in the tree for a parameter and result |
| -- profile. Instead the information appears directly in the parent. |
| |
| ---------------------- |
| -- 6.1 Formal part -- |
| ---------------------- |
| |
| -- FORMAL_PART ::= |
| -- (PARAMETER_SPECIFICATION {; PARAMETER_SPECIFICATION}) |
| |
| ---------------------------------- |
| -- 6.1 Parameter specification -- |
| ---------------------------------- |
| |
| -- PARAMETER_SPECIFICATION ::= |
| -- DEFINING_IDENTIFIER_LIST : MODE SUBTYPE_MARK |
| -- [:= DEFAULT_EXPRESSION] |
| -- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION |
| -- [:= DEFAULT_EXPRESSION] |
| |
| -- Although the syntax allows multiple identifiers in the list, the |
| -- semantics is as though successive specifications were given with |
| -- identical type definition and expression components. To simplify |
| -- semantic processing, the parser represents a multiple declaration |
| -- case as a sequence of single Specifications, using the More_Ids and |
| -- Prev_Ids flags to preserve the original source form as described |
| -- in the section on "Handling of Defining Identifier Lists". |
| |
| -- N_Parameter_Specification |
| -- Sloc points to first identifier |
| -- Defining_Identifier (Node1) |
| -- In_Present (Flag15) |
| -- Out_Present (Flag17) |
| -- Parameter_Type (Node2) subtype mark or access definition |
| -- Expression (Node3) (set to Empty if no default expression present) |
| -- Do_Accessibility_Check (Flag13-Sem) |
| -- More_Ids (Flag5) (set to False if no more identifiers in list) |
| -- Prev_Ids (Flag6) (set to False if no previous identifiers in list) |
| -- Default_Expression (Node5-Sem) |
| |
| --------------- |
| -- 6.1 Mode -- |
| --------------- |
| |
| -- MODE ::= [in] | in out | out |
| |
| -- There is no explicit node in the tree for the Mode. Instead the |
| -- In_Present and Out_Present flags are set in the parent node to |
| -- record the presence of keywords specifying the mode. |
| |
| -------------------------- |
| -- 6.3 Subprogram Body -- |
| -------------------------- |
| |
| -- SUBPROGRAM_BODY ::= |
| -- SUBPROGRAM_SPECIFICATION is |
| -- DECLARATIVE_PART |
| -- begin |
| -- HANDLED_SEQUENCE_OF_STATEMENTS |
| -- end [DESIGNATOR]; |
| |
| -- N_Subprogram_Body |
| -- Sloc points to FUNCTION or PROCEDURE |
| -- Specification (Node1) |
| -- Declarations (List2) |
| -- Handled_Statement_Sequence (Node4) |
| -- Activation_Chain_Entity (Node3-Sem) |
| -- Corresponding_Spec (Node5-Sem) |
| -- Acts_As_Spec (Flag4-Sem) |
| -- Bad_Is_Detected (Flag15) used only by parser |
| -- Do_Storage_Check (Flag17-Sem) |
| -- Has_Priority_Pragma (Flag6-Sem) |
| -- Is_Protected_Subprogram_Body (Flag7-Sem) |
| -- Is_Task_Master (Flag5-Sem) |
| -- Was_Originally_Stub (Flag13-Sem) |
| |
| ----------------------------------- |
| -- 6.4 Procedure Call Statement -- |
| ----------------------------------- |
| |
| -- PROCEDURE_CALL_STATEMENT ::= |
| -- procedure_NAME; | procedure_PREFIX ACTUAL_PARAMETER_PART; |
| |
| -- Note: the reason that a procedure call has expression fields is |
| -- that it semantically resembles an expression, e.g. overloading is |
| -- allowed and a type is concocted for semantic processing purposes. |
| -- Certain of these fields, such as Parens are not relevant, but it |
| -- is easier to just supply all of them together! |
| |
| -- N_Procedure_Call_Statement |
| -- Sloc points to first token of name or prefix |
| -- Name (Node2) stores name or prefix |
| -- Parameter_Associations (List3) (set to No_List if no |
| -- actual parameter part) |
| -- First_Named_Actual (Node4-Sem) |
| -- Controlling_Argument (Node1-Sem) (set to Empty if not dispatching) |
| -- Do_Tag_Check (Flag13-Sem) |
| -- No_Elaboration_Check (Flag14-Sem) |
| -- Parameter_List_Truncated (Flag17-Sem) |
| -- ABE_Is_Certain (Flag18-Sem) |
| -- plus fields for expression |
| |
| -- If any IN parameter requires a range check, then the corresponding |
| -- argument expression has the Do_Range_Check flag set, and the range |
| -- check is done against the formal type. Note that this argument |
| -- expression may appear directly in the Parameter_Associations list, |
| -- or may be a descendent of an N_Parameter_Association node that |
| -- appears in this list. |
| |
| ------------------------ |
| -- 6.4 Function Call -- |
| ------------------------ |
| |
| -- FUNCTION_CALL ::= |
| -- function_NAME | function_PREFIX ACTUAL_PARAMETER_PART |
| |
| -- Note: the parser may generate an indexed component node or simply |
| -- a name node instead of a function call node. The semantic pass must |
| -- correct this misidentification. |
| |
| -- N_Function_Call |
| -- Sloc points to first token of name or prefix |
| -- Name (Node2) stores name or prefix |
| -- Parameter_Associations (List3) (set to No_List if no |
| -- actual parameter part) |
| -- First_Named_Actual (Node4-Sem) |
| -- Controlling_Argument (Node1-Sem) (set to Empty if not dispatching) |
| -- Do_Tag_Check (Flag13-Sem) |
| -- No_Elaboration_Check (Flag14-Sem) |
| -- Parameter_List_Truncated (Flag17-Sem) |
| -- ABE_Is_Certain (Flag18-Sem) |
| -- plus fields for expression |
| |
| -------------------------------- |
| -- 6.4 Actual Parameter Part -- |
| -------------------------------- |
| |
| -- ACTUAL_PARAMETER_PART ::= |
| -- (PARAMETER_ASSOCIATION {,PARAMETER_ASSOCIATION}) |
| |
| -------------------------------- |
| -- 6.4 Parameter Association -- |
| -------------------------------- |
| |
| -- PARAMETER_ASSOCIATION ::= |
| -- [formal_parameter_SELECTOR_NAME =>] EXPLICIT_ACTUAL_PARAMETER |
| |
| -- Note: the N_Parameter_Association node is built only if a formal |
| -- parameter selector name is present, otherwise the parameter |
| -- association appears in the tree simply as the node for the |
| -- explicit actual parameter. |
| |
| -- N_Parameter_Association |
| -- Sloc points to formal parameter |
| -- Selector_Name (Node2) (always non-Empty, since this node is |
| -- only used if a formal parameter selector name is present) |
| -- Explicit_Actual_Parameter (Node3) |
| -- Next_Named_Actual (Node4-Sem) |
| |
| --------------------------- |
| -- 6.4 Actual Parameter -- |
| --------------------------- |
| |
| -- EXPLICIT_ACTUAL_PARAMETER ::= EXPRESSION | variable_NAME |
| |
| --------------------------- |
| -- 6.5 Return Statement -- |
| --------------------------- |
| |
| -- RETURN_STATEMENT ::= return [EXPRESSION]; |
| |
| -- N_Return_Statement |
| -- Sloc points to RETURN |
| -- Expression (Node3) (set to Empty if no expression present) |
| -- Storage_Pool (Node1-Sem) |
| -- Procedure_To_Call (Node4-Sem) |
| -- Do_Tag_Check (Flag13-Sem) |
| -- Return_Type (Node2-Sem) |
| -- By_Ref (Flag5-Sem) |
| |
| -- Note: if a range check is required, then Do_Range_Check is set |
| -- on the Expression. The range check is against Return_Type. |
| |
| ------------------------------ |
| -- 7.1 Package Declaration -- |
| ------------------------------ |
| |
| -- PACKAGE_DECLARATION ::= PACKAGE_SPECIFICATION; |
|