sTable.h
Ir a la documentación de este archivo.
1 //sTable.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 //-------------------------------------------------------------------------------------------
49 //-------------------------------------------------------------------------------------------
50 #ifndef _RUN_TABLE_STABLE_
51 #define _RUN_TABLE_STABLE_
52 
53 #include <string>
54 #include <vector>
55 #include "symbols.h"
56 
57 using namespace std;
58 class classNode;
59 //-------------------------------------------------------------------------------------------
60 
61 //-------------------------------------------------------------------------------------------
121 class sTable {
122  public:
126  sTable ();
133  sTable (sTable* s);
137  void mklevel (symbols *default_level = NULL );
142  symbols *currentlevel ();
147  void rmlevel ();
156  void add (runNode* str, runNode* node);
164  void addfunction (runNode* str, runNode* node);
172  void addclass (runNode *str, runNode* node);
180  refNode *access (runNode *str);
188  refNode *accessfunction (runNode *str);
196  refNode* accessclass (runNode *str);
201  void clear (runNode *str);
207  bool exist (runNode *str);
213  bool existfunction (runNode *str);
219  bool existclass (runNode *str);
225  int getLevel () const;
230  int getLevelTop () const;
235  void setLevel (int l);
240  void print ();
245  void fprint ();
250  void cprint ();
255  symbols *getTable ();
260  symbols getFunctions ();
267  runNode* getFunction (runNode *key);
274  refNode* getFunctionRef (runNode *key);
281  void setFunction (runNode *key, runNode* exp);
288  runNode* getElement (runNode *key);
295  refNode* getElementRef (runNode *key);
301  void setNodeUse (runNode* node);
307  runNode* getNodeUse () const;
312  void setPrivate (runNode *str);
319  bool isPrivate (runNode *str);
326  static sTable* sys_sTable ();
345  static sTable* new_sTable (bool level_default = true);
353  static sTable* new_sTable (sTable* s, bool level_default = true);
358  static void add_sTable (sTable* s);
366  static int search_sTable (sTable* s);
371  static void setGlobal (runNode* node);
378  void setDeleteCurrentLevel (bool del);
383  bool isref (runNode* node, int level_see);
388  bool isrefAll (runNode* node, int level_see);
392  vector<symbols *> tables_;
396  int level_;
401  vector<runNode*> private_;
405  static symbols class_;
409  static vector<sTable*> sTables_;
413  static map<runNode*, refNode*, cmp_runNode> globals_;
421 private:
422  bool delete_current_level_;
423 };
424 //-------------------------------------------------------------------------------------------
425 #endif
426 //-------------------------------------------------------------------------------------------
427 
428 //-------------------------------------------------------------------------------------------
429 //Fco. Javier Bohórquez Ogalla
430 
431 
static sTable * sTable_ini
Definition: sTable.h:336
int level_
Definition: sTable.h:396
Nodo clase.
Definition: classNode.h:89
Tabla de símbolos.
Definition: symbols.h:65
static sTable * sTable_use
Definition: sTable.h:332
static vector< sTable * > sTables_
Definition: sTable.h:409
symbols functions_
Definition: sTable.h:400
Nodo ejecutable.
Definition: runTree.h:123
Tabla de símbolos.
vector< symbols * > tables_
Definition: sTable.h:392
Contexto de tablas de símbolos.
Definition: sTable.h:121
static map< runNode *, refNode *, cmp_runNode > globals_
Definition: sTable.h:413
Nodo referencia.
Definition: runTree.h:279
static symbols class_
Definition: sTable.h:405
runNode * node_use_
Definition: sTable.h:420