absyntax_utils/search_base_type.hh
changeset 417 d48f53715f77
parent 377 60b012b7793f
child 619 f8c9ac5c529a
equal deleted inserted replaced
416:0c2ef191b22a 417:d48f53715f77
     1 /*
     1 /*
     2  *  matiec - a compiler for the programming languages defined in IEC 61131-3
     2  *  matiec - a compiler for the programming languages defined in IEC 61131-3
     3  *
     3  *
     4  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
     4  *  Copyright (C) 2003-2012  Mario de Sousa (msousa@fe.up.pt)
     5  *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
     5  *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
     6  *
     6  *
     7  *  This program is free software: you can redistribute it and/or modify
     7  *  This program is free software: you can redistribute it and/or modify
     8  *  it under the terms of the GNU General Public License as published by
     8  *  it under the terms of the GNU General Public License as published by
     9  *  the Free Software Foundation, either version 3 of the License, or
     9  *  the Free Software Foundation, either version 3 of the License, or
    58 
    58 
    59   public:
    59   public:
    60     search_base_type_c(void);
    60     search_base_type_c(void);
    61 
    61 
    62   public:
    62   public:
    63     void *visit(identifier_c *type_name);
    63     symbol_c *get_basetype_decl(symbol_c *symbol);
       
    64     symbol_c *get_basetype_id  (symbol_c *symbol);
    64     bool type_is_subrange(symbol_c* type_decl);
    65     bool type_is_subrange(symbol_c* type_decl);
    65     bool type_is_enumerated(symbol_c* type_decl);
    66     bool type_is_enumerated(symbol_c* type_decl);
    66 
    67 
    67   public:
    68   public:
    68     /*********************/
    69   /*************************/
    69     /* B 1.2 - Constants */
    70   /* B.1 - Common elements */
    70     /*********************/
    71   /*************************/
    71 
    72   /*******************************************/
    72     /******************************/
    73   /* B 1.1 - Letters, digits and identifiers */
    73     /* B 1.2.1 - Numeric Literals */
    74   /*******************************************/
    74     /******************************/
    75     void *visit(identifier_c *type_name);
       
    76 
       
    77     
       
    78   /*********************/
       
    79   /* B 1.2 - Constants */
       
    80   /*********************/
       
    81   /******************************/
       
    82   /* B 1.2.1 - Numeric Literals */
       
    83   /******************************/
    75      /* Numeric literals without any explicit type cast have unknown data type, 
    84      /* Numeric literals without any explicit type cast have unknown data type, 
    76       * so we continue considering them as their own basic data types until
    85       * so we continue considering them as their own basic data types until
    77       * they can be resolved (for example, when using '30+x' where 'x' is a LINT variable, the
    86       * they can be resolved (for example, when using '30+x' where 'x' is a LINT variable, the
    78       * numeric literal '30' must then be considered a LINT so the ADD function may be called
    87       * numeric literal '30' must then be considered a LINT so the ADD function may be called
    79       * with all inputs of the same data type.
    88       * with all inputs of the same data type.