2887
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
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 class symbol_record; |
|
34 |
|
35 class tree_walker; |
|
36 |
2980
|
37 #include "pt-exp.h" |
2887
|
38 |
|
39 // Symbols from the symbol table. |
|
40 |
|
41 class |
2971
|
42 tree_identifier : public tree_expression |
2887
|
43 { |
|
44 friend class tree_index_expression; |
|
45 |
|
46 public: |
|
47 |
|
48 tree_identifier (int l = -1, int c = -1) |
2971
|
49 : tree_expression (l, c), sym (0) { } |
2887
|
50 |
|
51 tree_identifier (symbol_record *s, int l = -1, int c = -1) |
2971
|
52 : tree_expression (l, c), sym (s) { } |
2887
|
53 |
|
54 ~tree_identifier (void) { } |
|
55 |
4267
|
56 bool has_magic_end (void) const { return (name () == "__end__"); } |
|
57 |
3933
|
58 bool is_identifier (void) const { return true; } |
2887
|
59 |
3523
|
60 std::string name (void) const; |
2887
|
61 |
|
62 tree_identifier *define (octave_function *f, unsigned int sym_type); |
|
63 |
3523
|
64 void document (const std::string& s); |
2887
|
65 |
|
66 bool is_defined (void); |
|
67 |
2971
|
68 bool is_function (void); |
|
69 |
|
70 octave_value |
|
71 do_lookup (bool& script_file_executed, bool exec_script = true); |
2887
|
72 |
|
73 void link_to_global (void); |
|
74 |
|
75 void mark_as_static (void); |
|
76 |
|
77 void mark_as_formal_parameter (void); |
|
78 |
3010
|
79 // We really need to know whether this symbol referst to a variable |
|
80 // or a function, but we may not know that yet. |
|
81 |
3933
|
82 bool lvalue_ok (void) const { return true; } |
3010
|
83 |
2971
|
84 octave_value rvalue (void); |
2887
|
85 |
2971
|
86 octave_value_list rvalue (int nargout); |
2887
|
87 |
2979
|
88 octave_lvalue lvalue (void); |
2887
|
89 |
|
90 void eval_undefined_error (void); |
|
91 |
|
92 void accept (tree_walker& tw); |
|
93 |
|
94 private: |
|
95 |
|
96 // The symbol record that this identifier references. |
|
97 symbol_record *sym; |
2988
|
98 |
|
99 // No copying! |
|
100 |
|
101 tree_identifier (const tree_identifier&); |
|
102 |
|
103 tree_identifier& operator = (const tree_identifier&); |
2887
|
104 }; |
|
105 |
|
106 #endif |
|
107 |
|
108 /* |
|
109 ;;; Local Variables: *** |
|
110 ;;; mode: C++ *** |
|
111 ;;; End: *** |
|
112 */ |