conti@559: /* conti@559: * matiec - a compiler for the programming languages defined in IEC 61131-3 conti@559: * conti@559: * Copyright (C) 2009-2012 Mario de Sousa (msousa@fe.up.pt) conti@559: * Copyright (C) 2012 Manuele Conti (conti.ma@alice.it) conti@559: * conti@559: * conti@559: * This program is free software: you can redistribute it and/or modify conti@559: * it under the terms of the GNU General Public License as published by conti@559: * the Free Software Foundation, either version 3 of the License, or conti@559: * (at your option) any later version. conti@559: * conti@559: * This program is distributed in the hope that it will be useful, conti@559: * but WITHOUT ANY WARRANTY; without even the implied warranty of conti@559: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the conti@559: * GNU General Public License for more details. conti@559: * conti@559: * You should have received a copy of the GNU General Public License conti@559: * along with this program. If not, see . conti@559: * conti@559: * conti@559: * This code is made available on the understanding that it will not be conti@559: * used in safety-critical situations without a full and competent review. conti@559: */ conti@559: conti@559: /* conti@559: * An IEC 61131-3 compiler. conti@559: * conti@559: * Based on the conti@559: * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) conti@559: * conti@559: */ conti@559: msousa@560: // #include conti@559: #include "../absyntax_utils/absyntax_utils.hh" msousa@560: // #include "datatype_functions.hh" conti@559: conti@559: conti@559: msousa@560: class array_range_check_c: public iterator_visitor_c { conti@559: conti@559: private: conti@559: search_varfb_instance_type_c *search_varfb_instance_type; conti@559: int error_count; conti@559: int current_display_error_level; conti@559: msousa@560: void check_dimension_count(array_variable_c *symbol); conti@581: void check_bounds(array_variable_c *symbol); conti@559: conti@559: public: msousa@560: array_range_check_c(symbol_c *ignore); msousa@560: virtual ~array_range_check_c(void); conti@559: int get_error_count(); conti@559: msousa@592: /*************************/ msousa@592: /* B.1 - Common elements */ msousa@592: /*************************/ msousa@592: /**********************/ msousa@592: /* B.1.3 - Data types */ msousa@592: /**********************/ msousa@592: /********************************/ msousa@592: /* B 1.3.3 - Derived data types */ msousa@592: /********************************/ msousa@598: /* NOTE: we may later want to move the following 2 methods to a visitor that will focus on analysing the data type declarations! */ msousa@592: void *visit(subrange_c *symbol); msousa@598: void *visit(array_initial_elements_c *symbol); msousa@592: conti@559: /*********************/ conti@559: /* B 1.4 - Variables */ conti@559: /*********************/ conti@559: /*************************************/ conti@559: /* B 1.4.2 - Multi-element variables */ conti@559: /*************************************/ conti@559: void *visit(array_variable_c *symbol); conti@559: conti@559: /**************************************/ conti@559: /* B 1.5 - Program organisation units */ conti@559: /**************************************/ conti@559: /***********************/ conti@559: /* B 1.5.1 - Functions */ conti@559: /***********************/ conti@559: void *visit(function_declaration_c *symbol); conti@559: conti@559: /*****************************/ conti@559: /* B 1.5.2 - Function blocks */ conti@559: /*****************************/ conti@559: void *visit(function_block_declaration_c *symbol); conti@559: conti@559: /**********************/ conti@559: /* B 1.5.3 - Programs */ conti@559: /**********************/ conti@559: void *visit(program_declaration_c *symbol); conti@559: msousa@560: }; /* array_range_check_c */ conti@559: conti@559: conti@559: conti@559: conti@559: conti@559: conti@559: