absyntax_utils/search_il_operand_type.hh
changeset 201 e657008f43d0
child 202 da1a8186f86f
equal deleted inserted replaced
196:1c0c7a664fc2 201:e657008f43d0
       
     1 /*
       
     2  * (c) 2003 Mario de Sousa
       
     3  *
       
     4  * Offered to the public under the terms of the GNU General Public License
       
     5  * as published by the Free Software Foundation; either version 2 of the
       
     6  * License, or (at your option) any later version.
       
     7  *
       
     8  * This program is distributed in the hope that it will be useful, but
       
     9  * WITHOUT ANY WARRANTY; without even the implied warranty of
       
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
       
    11  * Public License for more details.
       
    12  *
       
    13  * This code is made available on the understanding that it will not be
       
    14  * used in safety-critical situations without a full and competent review.
       
    15  */
       
    16 
       
    17 /*
       
    18  * An IEC 61131-3 IL and ST compiler.
       
    19  *
       
    20  * Based on the
       
    21  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
       
    22  *
       
    23  */
       
    24 
       
    25 /* Returns the data type of an il_operand.
       
    26  *
       
    27  * Note that the il_operand may be a variable, in which case
       
    28  * we return the type of the variable instance.
       
    29  * The il_operand may also be a constant, in which case
       
    30  * we return the data type of that constant.
       
    31  *
       
    32  * The variable instance may be a member of a structured variable,
       
    33  * or an element in an array, or any combination of the two.
       
    34  *
       
    35  * The class constructor must be given the search scope
       
    36  * (function, function block or program within which
       
    37  * the possible il_operand variable instance was declared).
       
    38  */
       
    39 
       
    40 class search_il_operand_type_c {
       
    41 
       
    42   private:
       
    43     search_varfb_instance_type_c search_varfb_instance_type;
       
    44     search_constant_type_c search_constant_type;
       
    45 
       
    46   public:
       
    47     search_il_operand_type_c(symbol_c *search_scope): search_varfb_instance_type(search_scope) {}
       
    48 
       
    49   public:
       
    50     symbol_c *get_type(symbol_c *il_operand);
       
    51 };