1 //////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (C) 1996-2021 The Octave Project Developers 4 // 5 // See the file COPYRIGHT.md in the top-level directory of this 6 // distribution or <https://octave.org/copyright/>. 7 // 8 // This file is part of Octave. 9 // 10 // Octave is free software: you can redistribute it and/or modify it 11 // under the terms of the GNU General Public License as published by 12 // the Free Software Foundation, either version 3 of the License, or 13 // (at your option) any later version. 14 // 15 // Octave is distributed in the hope that it will be useful, but 16 // WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of the GNU General Public License 21 // along with Octave; see the file COPYING. If not, see 22 // <https://www.gnu.org/licenses/>. 23 // 24 //////////////////////////////////////////////////////////////////////// 25 26 #if ! defined (octave_pt_check_h) 27 #define octave_pt_check_h 1 28 29 #include "octave-config.h" 30 31 #include <string> 32 33 #include "pt-walk.h" 34 35 namespace octave 36 { 37 class tree_decl_command; 38 39 // How to check the semantics of the code that the parse trees represent. 40 41 class tree_checker : public tree_walker 42 { 43 public: 44 tree_checker(void)45 tree_checker (void) 46 : m_do_lvalue_check (false), m_file_name () { } 47 48 // No copying! 49 50 tree_checker (const tree_checker&) = delete; 51 52 tree_checker& operator = (const tree_checker&) = delete; 53 54 ~tree_checker (void) = default; 55 56 void visit_argument_list (tree_argument_list&); 57 58 void visit_simple_for_command (tree_simple_for_command&); 59 60 void visit_complex_for_command (tree_complex_for_command&); 61 62 void visit_multi_assignment (tree_multi_assignment&); 63 64 void visit_simple_assignment (tree_simple_assignment&); 65 66 void visit_try_catch_command (tree_try_catch_command&); 67 68 private: 69 70 bool m_do_lvalue_check; 71 72 std::string m_file_name; 73 74 OCTAVE_NORETURN void errmsg (const std::string& msg, int line); 75 }; 76 } 77 78 #endif 79