classNode.h
Ir a la documentación de este archivo.
1 //classNode.h
2 //-------------------------------------------------------------------------------------------
3 /*
4  * Fco. Javier Bohórquez Ogalla
5  * 75766599-E
6  * Puerto Real (Cádiz)
7  * powersgame@gmail.com
8  */
9 //-------------------------------------------------------------------------------------------
10 /*
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24  * MA 02110-1301, USA.
25  */
26 //-------------------------------------------------------------------------------------------
35 //-------------------------------------------------------------------------------------------
36 #ifndef _RUN_TABLE_CLASSNODE_
37 #define _RUN_TABLE_CLASSNODE_
38 
39 #include "funcNode.h"
40 //-------------------------------------------------------------------------------------------
41 
42 //-------------------------------------------------------------------------------------------
89 class classNode :
90  public runNode {
91  public:
97  classNode (classNode* node);
105  classNode (runNode* id, runNode* body, runNode *extends = NULL);
111  void run ();
118  runNode* newcall (runNode *params);
123  inline sTable* insideTable () const { return inside_; }
128  inline classNode * getExtendClass () { return extend_class_; }
133  inline runNode* getID () {return id_;}
138  inline string name(){
139  if (idNode* id = dynamic_cast<idNode*>(id_))
140  return id->name();
141  return "";
142  }
149  runNode * getMethod (runNode * key);
156  refNode * getMethodRef (runNode * key);
162  void setMethod (runNode * key, runNode * func);
168  runNode * getFromStatic (runNode *key);
174  void setFromStatic (runNode *key, runNode* val);
180  runNode * toObject ();
181  static sTable* static_class;
182  runNode * newelement_;
183  private:
184  runNode *id_, *body_, *extends_;
185  sTable *inside_, *static_;
186  bool exec_;
187  classNode *extend_class_;
188 };
189 //-------------------------------------------------------------------------------------------
190 
191 //-------------------------------------------------------------------------------------------
208 class newNode :
209  public nexpNode {
210  public:
218  newNode (runNode* id, runNode* params);
227  void run ();
228  private:
229  runNode *id_, *params_;
230  runNode * nodeR_;
231 };
232 //-------------------------------------------------------------------------------------------
233 
234 //-------------------------------------------------------------------------------------------
243 class thisNode :
244  public nexpNode {
245  public:
251  void run ();
256  virtual void noderef (runNode* node);
257  private:
258  runNode *nodeR_;
259 };
260 //-------------------------------------------------------------------------------------------
261 
262 //-------------------------------------------------------------------------------------------
271 class parentNode : public thisNode {
272  public:
276  parentNode ();
283  runNode * get (runNode * key);
284  static classNode *link;
285 };
286 //-------------------------------------------------------------------------------------------
287 
288 //-------------------------------------------------------------------------------------------
296 class staticNode : public runNode {
297  public:
301  staticNode ();
306  staticNode (runNode *stmt);
310  void run () ;
311  static runNode* link;
312  private:
313  runNode * stmt_;
314 };
315 //-------------------------------------------------------------------------------------------
316 
317 //-------------------------------------------------------------------------------------------
326 class privateNode : public runNode {
327  public:
332  privateNode (runNode * stmt);
336  void run();
337  static bool is;
338  private:
339  runNode * stmt_;
340 };
341 //-------------------------------------------------------------------------------------------
342 
343 //-------------------------------------------------------------------------------------------
351 class namespaceNode : public nexpNode {
352  public:
359  namespaceNode (runNode *space, runNode * key);
365  void run () ;
366  private:
367  runNode * space_, *key_;
368 };
369 #endif
370 //-------------------------------------------------------------------------------------------
371 
372 //-------------------------------------------------------------------------------------------
373 //Fco. Javier Bohórquez Ogalla
Nodo de acceso privado.
Definition: classNode.h:326
Nodo identificador.
Definition: idNode.h:59
sTable * insideTable() const
Definition: classNode.h:123
runNode * getMethod(runNode *key)
Definition: classNode.cpp:180
parentNode()
Definition: classNode.cpp:288
classNode(classNode *node)
Definition: classNode.cpp:42
namespaceNode(runNode *space, runNode *key)
Definition: classNode.cpp:367
newNode(runNode *id, runNode *params)
Definition: classNode.cpp:216
Nodos relacionados con funciones.
Nodo clase.
Definition: classNode.h:89
privateNode(runNode *stmt)
Definition: classNode.cpp:347
runNode * getID()
Definition: classNode.h:133
void run()
Definition: classNode.cpp:62
runNode * newcall(runNode *params)
Definition: classNode.cpp:127
classNode * getExtendClass()
Definition: classNode.h:128
Nodo referencia al objeto.
Definition: classNode.h:243
staticNode()
Definition: classNode.cpp:315
void run()
Definition: classNode.cpp:253
refNode * getMethodRef(runNode *key)
Definition: classNode.cpp:184
Nodo ejecutable.
Definition: runTree.h:123
Nodo estático.
Definition: classNode.h:296
void run()
Definition: classNode.cpp:349
Node referencia a objeto padre.
Definition: classNode.h:271
runNode * toObject()
Definition: classNode.cpp:152
void run()
Definition: classNode.cpp:319
Nodo de espacio de nombre.
Definition: classNode.h:351
void setMethod(runNode *key, runNode *func)
Definition: classNode.cpp:188
Contexto de tablas de símbolos.
Definition: sTable.h:121
void run()
Definition: classNode.cpp:369
Nodo referencia.
Definition: runTree.h:279
string name()
Definition: classNode.h:138
virtual void noderef(runNode *node)
Definition: classNode.cpp:269
runNode * getFromStatic(runNode *key)
Definition: classNode.cpp:192
void run()
Definition: classNode.cpp:220
Nodo expresión de tipo no definido.
Definition: expNode.h:164
Nodo nueva instancia.
Definition: classNode.h:208
void setFromStatic(runNode *key, runNode *val)
Definition: classNode.cpp:205