stage3/enum_declaration_check.hh
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 05 Apr 2024 13:23:53 +0200
changeset 1103 f3c6c938d5ff
parent 752 8f05bde3efa8
permissions -rw-r--r--
merge
752
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     1
/*
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     2
 *  matiec - a compiler for the programming languages defined in IEC 61131-3
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     3
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     4
 *  Copyright (C) 2012  Mario de Sousa (msousa@fe.up.pt)
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     5
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     6
 *  This program is free software: you can redistribute it and/or modify
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     7
 *  it under the terms of the GNU General Public License as published by
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     8
 *  the Free Software Foundation, either version 3 of the License, or
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
     9
 *  (at your option) any later version.
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    10
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    11
 *  This program is distributed in the hope that it will be useful,
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    14
 *  GNU General Public License for more details.
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    15
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    16
 *  You should have received a copy of the GNU General Public License
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    17
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    18
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    19
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    20
 * This code is made available on the understanding that it will not be
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    21
 * used in safety-critical situations without a full and competent review.
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    22
 */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    23
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    24
/*
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    25
 * An IEC 61131-3 compiler.
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    26
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    27
 * Based on the
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    28
 * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    29
 *
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    30
 */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    31
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    32
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    33
#include "../absyntax_utils/absyntax_utils.hh"
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    34
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    35
class populate_enumvalue_symtable_c;
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    36
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    37
class enum_declaration_check_c : public iterator_visitor_c {
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    38
  private:
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    39
    int error_count;
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    40
    int current_display_error_level;
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    41
    populate_enumvalue_symtable_c *populate_enumvalue_symtable;
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    42
    symbol_c::enumvalue_symtable_t *global_enumvalue_symtable;
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    43
    
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    44
  public:
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    45
     enum_declaration_check_c(symbol_c *ignore);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    46
    ~enum_declaration_check_c(void);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    47
    int get_error_count();
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    48
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    49
    
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    50
    /***************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    51
    /* B 0 - Programming Model */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    52
    /***************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    53
    void *visit(library_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    54
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    55
    /**********************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    56
    /* B.1.3 - Data types */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    57
    /**********************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    58
    void *visit(data_type_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    59
  
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    60
    /***********************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    61
    /* B 1.5.1 - Functions */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    62
    /***********************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    63
    void *visit(function_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    64
   
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    65
    /*****************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    66
    /* B 1.5.2 - Function Blocks */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    67
    /*****************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    68
    void *visit(function_block_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    69
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    70
    /******************************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    71
    /* B 1.5.3 - Declaration & Initialisation */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    72
    /******************************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    73
    void *visit(program_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    74
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    75
    /********************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    76
    /* B 1.7 Configuration elements */
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    77
    /********************************/
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    78
    void *visit(configuration_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    79
    void *visit(resource_declaration_c *symbol);
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    80
    void *visit(single_resource_declaration_c *symbol);    
8f05bde3efa8 Add files missing from a few commits ago...
Mario de Sousa <msousa@fe.up.pt>
parents:
diff changeset
    81
};