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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_tree_identifier_h) |
|
24 #define octave_tree_identifier_h 1 |
|
25 |
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
3503
|
30 #include <iostream> |
2887
|
31 #include <string> |
|
32 |
2943
|
33 class octave_value; |
|
34 class octave_value_list; |
2887
|
35 class octave_function; |
|
36 class symbol_record; |
|
37 |
|
38 class tree_walker; |
|
39 |
2980
|
40 #include "pt-exp.h" |
2887
|
41 |
|
42 // Symbols from the symbol table. |
|
43 |
|
44 class |
2971
|
45 tree_identifier : public tree_expression |
2887
|
46 { |
|
47 friend class tree_index_expression; |
|
48 |
|
49 public: |
|
50 |
|
51 tree_identifier (int l = -1, int c = -1) |
2971
|
52 : tree_expression (l, c), sym (0) { } |
2887
|
53 |
|
54 tree_identifier (symbol_record *s, int l = -1, int c = -1) |
2971
|
55 : tree_expression (l, c), sym (s) { } |
2887
|
56 |
|
57 ~tree_identifier (void) { } |
|
58 |
|
59 bool is_identifier (void) const |
|
60 { return true; } |
|
61 |
|
62 string name (void) const; |
|
63 |
|
64 tree_identifier *define (octave_function *f, unsigned int sym_type); |
|
65 |
|
66 void document (const string& s); |
|
67 |
|
68 bool is_defined (void); |
|
69 |
2971
|
70 bool is_function (void); |
|
71 |
|
72 octave_value |
|
73 do_lookup (bool& script_file_executed, bool exec_script = true); |
2887
|
74 |
|
75 void link_to_global (void); |
|
76 |
|
77 void mark_as_static (void); |
|
78 |
|
79 void mark_as_formal_parameter (void); |
|
80 |
3010
|
81 // We really need to know whether this symbol referst to a variable |
|
82 // or a function, but we may not know that yet. |
|
83 |
|
84 bool lvalue_ok (void) const |
|
85 { return true; } |
|
86 |
2971
|
87 octave_value rvalue (void); |
2887
|
88 |
2971
|
89 octave_value_list rvalue (int nargout); |
2887
|
90 |
2979
|
91 octave_lvalue lvalue (void); |
2887
|
92 |
|
93 void eval_undefined_error (void); |
|
94 |
|
95 void accept (tree_walker& tw); |
|
96 |
|
97 private: |
|
98 |
|
99 // The symbol record that this identifier references. |
|
100 symbol_record *sym; |
2988
|
101 |
|
102 // No copying! |
|
103 |
|
104 tree_identifier (const tree_identifier&); |
|
105 |
|
106 tree_identifier& operator = (const tree_identifier&); |
2887
|
107 }; |
|
108 |
|
109 #endif |
|
110 |
|
111 /* |
|
112 ;;; Local Variables: *** |
|
113 ;;; mode: C++ *** |
|
114 ;;; End: *** |
|
115 */ |