pt-check.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_tree_checker_h)
00024 #define octave_tree_checker_h 1
00025 
00026 #include "pt-walk.h"
00027 
00028 class tree_decl_command;
00029 
00030 // How to check the semantics of the code that the parse trees represent.
00031 
00032 class
00033 tree_checker : public tree_walker
00034 {
00035 public:
00036 
00037   tree_checker (void)
00038     : do_lvalue_check (false) { }
00039 
00040   ~tree_checker (void) { }
00041 
00042   void visit_argument_list (tree_argument_list&);
00043 
00044   void visit_binary_expression (tree_binary_expression&);
00045 
00046   void visit_break_command (tree_break_command&);
00047 
00048   void visit_colon_expression (tree_colon_expression&);
00049 
00050   void visit_continue_command(tree_continue_command&);
00051 
00052   void visit_global_command (tree_global_command&);
00053 
00054   void visit_static_command (tree_static_command&);
00055 
00056   void visit_decl_elt (tree_decl_elt&);
00057 
00058   void visit_decl_init_list (tree_decl_init_list&);
00059 
00060   void visit_simple_for_command (tree_simple_for_command&);
00061 
00062   void visit_complex_for_command (tree_complex_for_command&);
00063 
00064   void visit_octave_user_script (octave_user_script&);
00065 
00066   void visit_octave_user_function (octave_user_function&);
00067 
00068   void visit_function_def (tree_function_def&);
00069 
00070   void visit_identifier (tree_identifier&);
00071 
00072   void visit_if_clause (tree_if_clause&);
00073 
00074   void visit_if_command (tree_if_command&);
00075 
00076   void visit_if_command_list (tree_if_command_list&);
00077 
00078   void visit_index_expression (tree_index_expression&);
00079 
00080   void visit_matrix (tree_matrix&);
00081 
00082   void visit_cell (tree_cell&);
00083 
00084   void visit_multi_assignment (tree_multi_assignment&);
00085 
00086   void visit_no_op_command (tree_no_op_command&);
00087 
00088   void visit_anon_fcn_handle (tree_anon_fcn_handle&);
00089 
00090   void visit_constant (tree_constant&);
00091 
00092   void visit_fcn_handle (tree_fcn_handle&);
00093 
00094   void visit_parameter_list (tree_parameter_list&);
00095 
00096   void visit_postfix_expression (tree_postfix_expression&);
00097 
00098   void visit_prefix_expression (tree_prefix_expression&);
00099 
00100   void visit_return_command (tree_return_command&);
00101 
00102   void visit_return_list (tree_return_list&);
00103 
00104   void visit_simple_assignment (tree_simple_assignment&);
00105 
00106   void visit_statement (tree_statement&);
00107 
00108   void visit_statement_list (tree_statement_list&);
00109 
00110   void visit_switch_case (tree_switch_case&);
00111 
00112   void visit_switch_case_list (tree_switch_case_list&);
00113 
00114   void visit_switch_command (tree_switch_command&);
00115 
00116   void visit_try_catch_command (tree_try_catch_command&);
00117 
00118   void visit_unwind_protect_command (tree_unwind_protect_command&);
00119 
00120   void visit_while_command (tree_while_command&);
00121 
00122   void visit_do_until_command (tree_do_until_command&);
00123 
00124 private:
00125 
00126   bool do_lvalue_check;
00127 
00128   void do_decl_command (tree_decl_command&);
00129 
00130   void gripe (const std::string& msg, int line);
00131 
00132   // No copying!
00133 
00134   tree_checker (const tree_checker&);
00135 
00136   tree_checker& operator = (const tree_checker&);
00137 };
00138 
00139 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines