Mercurial > hg > octave-nkf
annotate src/pt-id.h @ 7677:db02cc0ba8f2
handle breakpoints in tree_identifier::do_lookup
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 01 Apr 2008 13:50:27 -0400 |
parents | 745a8299c2b5 |
children | 40c428ea3408 |
rev | line source |
---|---|
2887 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004, 2005, 2006, 2007 |
4 John W. Eaton | |
2887 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2887 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2887 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_tree_identifier_h) | |
25 #define octave_tree_identifier_h 1 | |
26 | |
3503 | 27 #include <iostream> |
2887 | 28 #include <string> |
29 | |
2943 | 30 class octave_value; |
31 class octave_value_list; | |
2887 | 32 class octave_function; |
33 | |
34 class tree_walker; | |
35 | |
7677
db02cc0ba8f2
handle breakpoints in tree_identifier::do_lookup
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
36 #include "pt-bp.h" |
2980 | 37 #include "pt-exp.h" |
7336 | 38 #include "symtab.h" |
2887 | 39 |
40 // Symbols from the symbol table. | |
41 | |
42 class | |
2971 | 43 tree_identifier : public tree_expression |
2887 | 44 { |
45 friend class tree_index_expression; | |
46 | |
47 public: | |
48 | |
49 tree_identifier (int l = -1, int c = -1) | |
7336 | 50 : tree_expression (l, c), sym () { } |
2887 | 51 |
7336 | 52 tree_identifier (const symbol_table::symbol_record& s, int l = -1, int c = -1) |
2971 | 53 : tree_expression (l, c), sym (s) { } |
2887 | 54 |
55 ~tree_identifier (void) { } | |
56 | |
4267 | 57 bool has_magic_end (void) const { return (name () == "__end__"); } |
58 | |
3933 | 59 bool is_identifier (void) const { return true; } |
2887 | 60 |
7336 | 61 std::string name (void) const { return sym.name (); } |
2887 | 62 |
7336 | 63 bool is_defined (void) { return sym.is_defined (); } |
64 | |
65 bool is_variable (void) { return sym.is_variable (); } | |
2887 | 66 |
7336 | 67 // Try to find a definition for an identifier. Here's how: |
68 // | |
69 // * If the identifier is already defined and is a function defined | |
70 // in an function file that has been modified since the last time | |
71 // we parsed it, parse it again. | |
72 // | |
73 // * If the identifier is not defined, try to find a builtin | |
74 // variable or an already compiled function with the same name. | |
75 // | |
76 // * If the identifier is still undefined, try looking for an | |
77 // function file to parse. | |
78 // | |
79 // * On systems that support dynamic linking, we prefer .oct files, | |
80 // then .mex files, then .m files. | |
2971 | 81 |
82 octave_value | |
7336 | 83 do_lookup (tree_argument_list *args, const string_vector& arg_names, |
84 octave_value_list& evaluated_args, bool& args_evaluated) | |
85 { | |
7677
db02cc0ba8f2
handle breakpoints in tree_identifier::do_lookup
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
86 MAYBE_DO_BREAKPOINT; |
db02cc0ba8f2
handle breakpoints in tree_identifier::do_lookup
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
87 |
7336 | 88 return sym.find (args, arg_names, evaluated_args, args_evaluated); |
89 } | |
2887 | 90 |
7336 | 91 void mark_global (void) { sym.mark_global (); } |
92 | |
93 void mark_as_static (void) { sym.init_persistent (); } | |
94 | |
95 void mark_as_formal_parameter (void) { sym.mark_formal (); } | |
2887 | 96 |
3010 | 97 // We really need to know whether this symbol referst to a variable |
98 // or a function, but we may not know that yet. | |
99 | |
3933 | 100 bool lvalue_ok (void) const { return true; } |
3010 | 101 |
2971 | 102 octave_value rvalue (void); |
2887 | 103 |
2971 | 104 octave_value_list rvalue (int nargout); |
2887 | 105 |
2979 | 106 octave_lvalue lvalue (void); |
2887 | 107 |
108 void eval_undefined_error (void); | |
109 | |
7336 | 110 tree_identifier *dup (symbol_table::scope_id scope); |
5861 | 111 |
2887 | 112 void accept (tree_walker& tw); |
113 | |
114 private: | |
115 | |
116 // The symbol record that this identifier references. | |
7336 | 117 symbol_table::symbol_record sym; |
2988 | 118 |
119 // No copying! | |
120 | |
121 tree_identifier (const tree_identifier&); | |
122 | |
123 tree_identifier& operator = (const tree_identifier&); | |
2887 | 124 }; |
125 | |
126 #endif | |
127 | |
128 /* | |
129 ;;; Local Variables: *** | |
130 ;;; mode: C++ *** | |
131 ;;; End: *** | |
132 */ |