absyntax_utils/search_il_label.hh
changeset 460 00f39a4b25fb
equal deleted inserted replaced
459:01f6664bf8c5 460:00f39a4b25fb
       
     1 /*
       
     2  *  matiec - a compiler for the programming languages defined in IEC 61131-3
       
     3  *
       
     4  *  Copyright (C) 2012  Mario de Sousa (msousa@fe.up.pt)
       
     5  *
       
     6  *
       
     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
       
     9  *  the Free Software Foundation, either version 3 of the License, or
       
    10  *  (at your option) any later version.
       
    11  *
       
    12  *  This program is distributed in the hope that it will be useful,
       
    13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    15  *  GNU General Public License for more details.
       
    16  *
       
    17  *  You should have received a copy of the GNU General Public License
       
    18  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    19  *
       
    20  *
       
    21  * This code is made available on the understanding that it will not be
       
    22  * used in safety-critical situations without a full and competent review.
       
    23  */
       
    24 
       
    25 /*
       
    26  * An IEC 61131-3 compiler.
       
    27  *
       
    28  * Based on the
       
    29  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
       
    30  *
       
    31  */
       
    32 
       
    33 
       
    34 /*
       
    35  *  Search for a specific label in an IL list. 
       
    36  *
       
    37  *  when instantiated, must be given a pointer to one of the following
       
    38  *     - function_declaration_c
       
    39  *     - function_block_declaration_c
       
    40  *     - program_declaration_c
       
    41  *     - instruction_list_c
       
    42  *
       
    43  * which is where all calls to search for a specific label will look for said label.
       
    44  */
       
    45 
       
    46 
       
    47 
       
    48 #include "../absyntax_utils/absyntax_utils.hh"
       
    49 
       
    50 
       
    51 class search_il_label_c: public search_visitor_c {
       
    52 
       
    53   private:
       
    54     search_varfb_instance_type_c *search_varfb_instance_type;
       
    55     symbol_c *search_scope;
       
    56     symbol_c *search_label;
       
    57 
       
    58   public:
       
    59     search_il_label_c(symbol_c *search_scope);
       
    60     virtual ~search_il_label_c(void);
       
    61 
       
    62     il_instruction_c *find_label(const char *label);
       
    63     il_instruction_c *find_label(symbol_c   *label);
       
    64 
       
    65     
       
    66     /****************************************/
       
    67     /* B.2 - Language IL (Instruction List) */
       
    68     /****************************************/
       
    69     /***********************************/
       
    70     /* B 2.1 Instructions and Operands */
       
    71     /***********************************/
       
    72 //     void *visit(instruction_list_c *symbol);
       
    73     void *visit(il_instruction_c *symbol);
       
    74 //     void *visit(il_simple_operation_c *symbol);
       
    75 //     void *visit(il_function_call_c *symbol);
       
    76 //     void *visit(il_expression_c *symbol);
       
    77 //     void *visit(il_fb_call_c *symbol);
       
    78 //     void *visit(il_formal_funct_call_c *symbol);
       
    79 //     void *visit(il_operand_list_c *symbol);
       
    80 //     void *visit(simple_instr_list_c *symbol);
       
    81 //     void *visit(il_simple_instruction_c*symbol);
       
    82 //     void *visit(il_param_list_c *symbol);
       
    83 //     void *visit(il_param_assignment_c *symbol);
       
    84 //     void *visit(il_param_out_assignment_c *symbol);
       
    85 
       
    86 
       
    87 }; // search_il_label_c
       
    88 
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 
       
    94 
       
    95