absyntax_utils/search_base_type.hh
changeset 202 da1a8186f86f
parent 194 e18690830555
child 257 90782e241346
equal deleted inserted replaced
201:e657008f43d0 202:da1a8186f86f
    32  *      TYPE new_subr_t : INT (4..5); END_TYPE;
    32  *      TYPE new_subr_t : INT (4..5); END_TYPE;
    33  *
    33  *
    34  *    new_int_t is really an INT!!
    34  *    new_int_t is really an INT!!
    35  *    new_int2_t is also really an INT!!
    35  *    new_int2_t is also really an INT!!
    36  *    new_subr_t is also really an INT!!
    36  *    new_subr_t is also really an INT!!
       
    37  *
       
    38  * Note that a FB declaration is also considered a base type, as
       
    39  * we may have FB instances declared of a specific FB type.
    37  */
    40  */
    38 
    41 
    39 
    42 
    40 class search_base_type_c: public null_visitor_c {
    43 class search_base_type_c: public null_visitor_c {
    41 
    44 
    51     void *visit(identifier_c *type_name);
    54     void *visit(identifier_c *type_name);
    52     bool type_is_subrange(symbol_c* type_decl);
    55     bool type_is_subrange(symbol_c* type_decl);
    53     bool type_is_enumerated(symbol_c* type_decl);
    56     bool type_is_enumerated(symbol_c* type_decl);
    54 
    57 
    55   public:
    58   public:
       
    59     /*********************/
       
    60     /* B 1.2 - Constants */
       
    61     /*********************/
       
    62 
       
    63     /******************************/
       
    64     /* B 1.2.1 - Numeric Literals */
       
    65     /******************************/
       
    66      /* Numeric literals without any explicit type cast have unknown data type, 
       
    67       * so we continue considering them as their own basic data types until
       
    68       * they can be resolved (for example, when using '30+x' where 'x' is a LINT variable, the
       
    69       * numeric literal '30' must then be considered a LINT so the ADD function may be called
       
    70       * with all inputs of the same data type.
       
    71       * If 'x' were a SINT, then the '30' would have to be a SINT too!
       
    72       */
       
    73     void *visit(real_c *symbol);
       
    74     void *visit(integer_c *symbol);
       
    75     void *visit(binary_integer_c *symbol);
       
    76     void *visit(octal_integer_c *symbol);
       
    77     void *visit(hex_integer_c *symbol);
       
    78 
       
    79 
    56   /***********************************/
    80   /***********************************/
    57   /* B 1.3.1 - Elementary Data Types */
    81   /* B 1.3.1 - Elementary Data Types */
    58   /***********************************/
    82   /***********************************/
    59     void *visit(time_type_name_c *symbol);
    83     void *visit(time_type_name_c *symbol);
    60     void *visit(bool_type_name_c *symbol);
    84     void *visit(bool_type_name_c *symbol);
    75     void *visit(word_type_name_c *symbol);
    99     void *visit(word_type_name_c *symbol);
    76     void *visit(dword_type_name_c *symbol);
   100     void *visit(dword_type_name_c *symbol);
    77     void *visit(lword_type_name_c *symbol);
   101     void *visit(lword_type_name_c *symbol);
    78     void *visit(string_type_name_c *symbol);
   102     void *visit(string_type_name_c *symbol);
    79     void *visit(wstring_type_name_c *symbol);
   103     void *visit(wstring_type_name_c *symbol);
       
   104 
       
   105 /*
    80     void *visit(constant_int_type_name_c *symbol);
   106     void *visit(constant_int_type_name_c *symbol);
    81     void *visit(constant_real_type_name_c *symbol);
   107     void *visit(constant_real_type_name_c *symbol);
       
   108 */
    82 
   109 
    83     /******************************************************/
   110     /******************************************************/
    84     /* Extensions to the base standard as defined in      */
   111     /* Extensions to the base standard as defined in      */
    85     /* "Safety Software Technical Specification,          */
   112     /* "Safety Software Technical Specification,          */
    86     /*  Part 1: Concepts and Function Blocks,             */
   113     /*  Part 1: Concepts and Function Blocks,             */
   160   					elementary_string_type_name,
   187   					elementary_string_type_name,
   161   					string_type_declaration_size,
   188   					string_type_declaration_size,
   162   					string_type_declaration_init) // may be == NULL!
   189   					string_type_declaration_init) // may be == NULL!
   163   */
   190   */
   164     void *visit(string_type_declaration_c *symbol);
   191     void *visit(string_type_declaration_c *symbol);
       
   192 
       
   193   /*****************************/
       
   194   /* B 1.5.2 - Function Blocks */
       
   195   /*****************************/
       
   196   /*  FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */
       
   197   // SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body)
       
   198     void *visit(function_block_declaration_c *symbol);
       
   199 
   165 }; // search_base_type_c
   200 }; // search_base_type_c
   166 
   201 
   167 
   202 
   168 
   203 
   169 
   204