Restore r26192, r26240, r26241: Two missing files from last check in.
[platform/upstream/glslang.git] / glslang / MachineIndependent / SymbolTable.h
1 //
2 //Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
3 //Copyright (C) 2013 LunarG, Inc.
4 //
5 //All rights reserved.
6 //
7 //Redistribution and use in source and binary forms, with or without
8 //modification, are permitted provided that the following conditions
9 //are met:
10 //
11 //    Redistributions of source code must retain the above copyright
12 //    notice, this list of conditions and the following disclaimer.
13 //
14 //    Redistributions in binary form must reproduce the above
15 //    copyright notice, this list of conditions and the following
16 //    disclaimer in the documentation and/or other materials provided
17 //    with the distribution.
18 //
19 //    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 //    contributors may be used to endorse or promote products derived
21 //    from this software without specific prior written permission.
22 //
23 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 //POSSIBILITY OF SUCH DAMAGE.
35 //
36
37 #ifndef _SYMBOL_TABLE_INCLUDED_
38 #define _SYMBOL_TABLE_INCLUDED_
39
40 //
41 // Symbol table for parsing.  Has these design characteristics:
42 //
43 // * Same symbol table can be used to compile many shaders, to preserve
44 //   effort of creating and loading with the large numbers of built-in
45 //   symbols.
46 //
47 // -->  This requires a copy mechanism, so initial pools used to create
48 //   the shared information can be popped.  Done through "clone"
49 //   methods.
50 //
51 // * Name mangling will be used to give each function a unique name
52 //   so that symbol table lookups are never ambiguous.  This allows
53 //   a simpler symbol table structure.
54 //
55 // * Pushing and popping of scope, so symbol table will really be a stack
56 //   of symbol tables.  Searched from the top, with new inserts going into
57 //   the top.
58 //
59 // * Constants:  Compile time constant symbols will keep their values
60 //   in the symbol table.  The parser can substitute constants at parse
61 //   time, including doing constant folding and constant propagation.
62 //
63 // * No temporaries:  Temporaries made from operations (+, --, .xy, etc.)
64 //   are tracked in the intermediate representation, not the symbol table.
65 //
66
67 #include "../Include/Common.h"
68 #include "../Include/intermediate.h"
69 #include "../Include/InfoSink.h"
70
71 namespace glslang {
72
73 //
74 // Symbol base class.  (Can build functions or variables out of these...)
75 //
76
77 class TVariable;
78 class TFunction;
79 class TAnonMember;
80
81 class TSymbol {
82 public:
83     POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
84     explicit TSymbol(const TString *n) :  name(n), numExtensions(0), extensions(0), writable(true) { }
85         virtual TSymbol* clone() const = 0;
86     virtual ~TSymbol() { }  // rely on all symbol owned memory coming from the pool
87
88     virtual const TString& getName() const { return *name; }
89     virtual void changeName(const TString* newName) { name = newName; }
90     virtual const TString& getMangledName() const { return getName(); }
91     virtual TFunction* getAsFunction() { return 0; }
92     virtual const TFunction* getAsFunction() const { return 0; }
93     virtual TVariable* getAsVariable() { return 0; }
94     virtual const TVariable* getAsVariable() const { return 0; }
95     virtual const TAnonMember* getAsAnonMember() const { return 0; }
96     virtual const TType& getType() const = 0;
97     virtual TType& getWritableType() = 0;
98     virtual void setUniqueId(int id) { uniqueId = id; }
99     virtual int getUniqueId() const { return uniqueId; }
100     virtual void setExtensions(int num, const char* const exts[])
101     {
102         assert(extensions == 0);
103         assert(num > 0);
104         numExtensions = num;
105         extensions = NewPoolObject(exts[0], num);
106         for (int e = 0; e < num; ++e)
107             extensions[e] = exts[e];
108     }
109     virtual int getNumExtensions() const { return numExtensions; }
110     virtual const char** getExtensions() const { return extensions; }
111     virtual void dump(TInfoSink &infoSink) const = 0;
112
113     virtual bool isReadOnly() const { return ! writable; }
114     virtual void makeReadOnly() { writable = false; }
115
116 protected:
117         explicit TSymbol(const TSymbol&);
118     TSymbol& operator=(const TSymbol&);
119
120     const TString *name;
121     unsigned int uniqueId;      // For cross-scope comparing during code generation
122
123     // For tracking what extensions must be present 
124     // (don't use if correct version/profile is present).
125     int numExtensions;
126     const char** extensions; // an array of pointers to existing constant char strings
127
128     //
129     // N.B.: Non-const functions that will be generally used should assert on this,
130     // to avoid overwriting shared symbol-table information.
131     //
132     bool writable;
133 };
134
135 //
136 // Variable class, meaning a symbol that's not a function.
137 //
138 // There could be a separate class heirarchy for Constant variables;
139 // Only one of int, bool, or float, (or none) is correct for
140 // any particular use, but it's easy to do this way, and doesn't
141 // seem worth having separate classes, and "getConst" can't simply return
142 // different values for different types polymorphically, so this is
143 // just simple and pragmatic.
144 //
145 class TVariable : public TSymbol {
146 public:
147     TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), userType(uT) { type.shallowCopy(t); }
148         virtual TVariable* clone() const;
149     virtual ~TVariable() { }
150
151     virtual TVariable* getAsVariable() { return this; }
152     virtual const TVariable* getAsVariable() const { return this; }
153     virtual const TType& getType() const { return type; }
154     virtual TType& getWritableType() { assert(writable); return type; }
155     virtual bool isUserType() const { return userType; }
156     virtual const TConstUnionArray& getConstArray() const { return unionArray; }
157     virtual void setConstArray(const TConstUnionArray& constArray) { unionArray = constArray; }
158
159     virtual void dump(TInfoSink &infoSink) const;
160
161 protected:
162     explicit TVariable(const TVariable&);
163     TVariable& operator=(const TVariable&);
164
165     TType type;
166     bool userType;
167     // we are assuming that Pool Allocator will free the memory allocated to unionArray
168     // when this object is destroyed
169     TConstUnionArray unionArray;
170 };
171
172 //
173 // The function sub-class of symbols and the parser will need to
174 // share this definition of a function parameter.
175 //
176 struct TParameter {
177     TString *name;
178     TType* type;
179         void copyParam(const TParameter& param) 
180     {
181                 if (param.name)
182             name = NewPoolTString(param.name->c_str());
183         else
184             name = 0;
185                 type = param.type->clone();
186         }
187 };
188
189 //
190 // The function sub-class of a symbol.
191 //
192 class TFunction : public TSymbol {
193 public:
194     explicit TFunction(TOperator o) :
195         TSymbol(0),
196         op(o),
197         defined(false), prototyped(false) { }
198     TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) :
199         TSymbol(name),
200         mangledName(*name + '('),
201         op(tOp),
202         defined(false), prototyped(false) { returnType.shallowCopy(retType); }    
203         virtual TFunction* clone() const;
204         virtual ~TFunction();
205
206     virtual TFunction* getAsFunction() { return this; }
207     virtual const TFunction* getAsFunction() const { return this; }
208
209     virtual void addParameter(TParameter& p)
210     {
211         assert(writable);
212         parameters.push_back(p);
213         p.type->appendMangledName(mangledName);
214     }
215
216     virtual const TString& getMangledName() const { return mangledName; }
217     virtual const TType& getType() const { return returnType; }
218     virtual TType& getWritableType() { return returnType; }
219     virtual void relateToOperator(TOperator o) { assert(writable); op = o; }
220     virtual TOperator getBuiltInOp() const { return op; }
221     virtual void setDefined() { assert(writable); defined = true; }
222     virtual bool isDefined() const { return defined; }
223     virtual void setPrototyped() { assert(writable); prototyped = true; }
224     virtual bool isPrototyped() const { return prototyped; }
225
226     virtual int getParamCount() const { return static_cast<int>(parameters.size()); }
227     virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; }
228     virtual const TParameter& operator[](int i) const { return parameters[i]; }
229
230     virtual void dump(TInfoSink &infoSink) const;
231
232 protected:
233     explicit TFunction(const TFunction&);
234     TFunction& operator=(const TFunction&);
235
236     typedef TVector<TParameter> TParamList;
237         TParamList parameters;
238     TType returnType;
239     TString mangledName;
240     TOperator op;
241     bool defined;
242     bool prototyped;
243 };
244
245 class TAnonMember : public TSymbol {
246 public:
247     TAnonMember(const TString* n, unsigned int m, const TVariable& a, int an) : TSymbol(n), anonContainer(a), memberNumber(m), anonId(an) { }
248         virtual TAnonMember* clone() const;
249     virtual ~TAnonMember() { }
250
251     virtual const TAnonMember* getAsAnonMember() const { return this; }
252     virtual const TVariable& getAnonContainer() const { return anonContainer; }
253     virtual unsigned int getMemberNumber() const { return memberNumber; }    
254     
255     virtual const TType& getType() const
256     {
257         const TTypeList& types = *anonContainer.getType().getStruct();
258         return *types[memberNumber].type;
259     }
260
261     virtual TType& getWritableType()
262     {
263         assert(writable);
264         const TTypeList& types = *anonContainer.getType().getStruct();
265         return *types[memberNumber].type;
266     }
267     
268     virtual int getAnonId() const { return anonId; }
269     virtual void dump(TInfoSink &infoSink) const;
270
271 protected:
272     explicit TAnonMember(const TAnonMember&);
273     TAnonMember& operator=(const TAnonMember&);
274
275     const TVariable& anonContainer;
276     unsigned int memberNumber;
277     int anonId;
278 };
279
280 class TSymbolTableLevel {
281 public:
282     POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
283     TSymbolTableLevel() : defaultPrecision(0), anonId(0) { }
284         ~TSymbolTableLevel();
285
286     bool insert(TSymbol& symbol, bool separateNameSpaces)
287     {
288         //
289         // returning true means symbol was added to the table with no semantic errors
290         //
291         tInsertResult result;
292         const TString& name = symbol.getName();
293         if (name == "") {
294             // An empty name means an anonymous container, exposing its members to the external scope.
295             // Give it a name and insert its members in the symbol table, pointing to the container.
296             char buf[20];
297             snprintf(buf, 20, "%s%d", AnonymousPrefix, anonId);
298             symbol.changeName(NewPoolTString(buf));
299
300             bool isOkay = true;
301             const TTypeList& types = *symbol.getAsVariable()->getType().getStruct();
302             for (unsigned int m = 0; m < types.size(); ++m) {
303                 TAnonMember* member = new TAnonMember(&types[m].type->getFieldName(), m, *symbol.getAsVariable(), anonId);
304                 result = level.insert(tLevelPair(member->getMangledName(), member));
305                 if (! result.second)
306                     isOkay = false;
307             }
308
309             ++anonId;
310
311             return isOkay;
312         } else {
313             // Check for redefinition errors:
314             // - STL itself will tell us if there is a direct name collision, with name mangling, at this level
315             // - additionally, check for function-redefining-variable name collisions
316             const TString& insertName = symbol.getMangledName();
317             if (symbol.getAsFunction()) {
318                 // make sure there isn't a variable of this name
319                 if (! separateNameSpaces && level.find(name) != level.end())
320                     return false;
321
322                 // insert, and whatever happens is okay
323                 level.insert(tLevelPair(insertName, &symbol));
324
325                 return true;
326             } else {
327                 result = level.insert(tLevelPair(insertName, &symbol));
328
329                 return result.second;
330             }
331         }
332     }
333
334     TSymbol* find(const TString& name) const
335     {
336         tLevel::const_iterator it = level.find(name);
337         if (it == level.end()) 
338             return 0;
339         else
340             return (*it).second;
341     }
342
343     void findFunctionNameList(const TString& name, TVector<TFunction*>& list)
344     {
345         size_t parenAt = name.find_first_of('(');
346         TString base(name, 0, parenAt + 1);
347
348         tLevel::const_iterator begin = level.lower_bound(base);
349         base[parenAt] = ')';  // assume ')' is lexically after '('
350         tLevel::const_iterator end = level.upper_bound(base);
351         for (tLevel::const_iterator it = begin; it != end; ++it)
352             list.push_back(it->second->getAsFunction());
353     }
354
355     // See if there is already a function in the table having the given non-function-style name.
356     bool hasFunctionName(const TString& name) const
357     {
358         tLevel::const_iterator candidate = level.lower_bound(name);
359         if (candidate != level.end()) {
360             const TString& candidateName = (*candidate).first;
361             TString::size_type parenAt = candidateName.find_first_of('(');
362             if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0)
363
364                 return true;
365         }
366
367         return false;
368     }
369
370     // See if there is a variable at this level having the given non-function-style name.
371     // Return true if name is found, and set variable to true if the name was a variable.
372     bool findFunctionVariableName(const TString& name, bool& variable) const
373     {
374         tLevel::const_iterator candidate = level.lower_bound(name);
375         if (candidate != level.end()) {
376             const TString& candidateName = (*candidate).first;
377             TString::size_type parenAt = candidateName.find_first_of('(');
378             if (parenAt == candidateName.npos) {
379                 // not a mangled name
380                 if (candidateName == name) {
381                     // found a variable name match
382                     variable = true;
383                     return true;
384                 }
385             } else {
386                 // a mangled name
387                 if (candidateName.compare(0, parenAt, name) == 0) {
388                     // found a function name match
389                     variable = false;
390                     return true;
391                 }
392             }
393         }
394
395         return false;
396     }
397
398     // Use this to do a lazy 'push' of precision defaults the first time
399     // a precision statement is seen in a new scope.  Leave it at 0 for
400     // when no push was needed.  Thus, it is not the current defaults,
401     // it is what to restore the defaults to when popping a level.
402     void setPreviousDefaultPrecisions(const TPrecisionQualifier *p)
403     {
404         // can call multiple times at one scope, will only latch on first call,
405         // as we're tracking the previous scope's values, not the current values
406         if (defaultPrecision != 0)
407             return;
408
409         defaultPrecision = new TPrecisionQualifier[EbtNumTypes];
410         for (int t = 0; t < EbtNumTypes; ++t)
411             defaultPrecision[t] = p[t];
412     }
413
414     void getPreviousDefaultPrecisions(TPrecisionQualifier *p)
415     {
416         // can be called for table level pops that didn't set the
417         // defaults
418         if (defaultPrecision == 0 || p == 0)
419             return;
420
421         for (int t = 0; t < EbtNumTypes; ++t)
422             p[t] = defaultPrecision[t];
423     }
424
425     void relateToOperator(const char* name, TOperator op);
426     void setFunctionExtensions(const char* name, int num, const char* const extensions[]);
427     void dump(TInfoSink &infoSink) const;
428         TSymbolTableLevel* clone() const;
429     void readOnly();
430
431 protected:
432     explicit TSymbolTableLevel(TSymbolTableLevel&);
433     TSymbolTableLevel& operator=(TSymbolTableLevel&);
434
435     typedef std::map<TString, TSymbol*, std::less<TString>, pool_allocator<std::pair<const TString, TSymbol*> > > tLevel;
436     typedef const tLevel::value_type tLevelPair;
437     typedef std::pair<tLevel::iterator, bool> tInsertResult;
438
439     tLevel level;  // named mappings
440     TPrecisionQualifier *defaultPrecision;
441     int anonId;
442 };
443
444 class TSymbolTable {
445 public:
446     TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), separateNameSpaces(false), adoptedLevels(0)
447     {
448         //
449         // This symbol table cannot be used until push() is called.
450         //
451     }
452     ~TSymbolTable()
453     {
454         // this can be called explicitly; safest to code it so it can be called multiple times
455
456         // don't deallocate levels passed in from elsewhere
457         while (table.size() > adoptedLevels)
458             pop(0);
459     }
460     
461     void adoptLevels(TSymbolTable& symTable)
462     {
463         for (unsigned int level = 0; level < symTable.table.size(); ++level) {
464             table.push_back(symTable.table[level]);
465             ++adoptedLevels;
466         }
467         uniqueId = symTable.uniqueId;
468         noBuiltInRedeclarations = symTable.noBuiltInRedeclarations;
469         separateNameSpaces = symTable.separateNameSpaces;
470     }
471
472     //
473     // While level adopting is generic, the methods below enact a the following
474     // convention for levels:
475     //   0: common built-ins shared across all stages, all compiles, only one copy for all symbol tables
476     //   1: per-stage built-ins, shared across all compiles, but a different copy per stage
477     //   2: built-ins specific to a compile, like resources that are context-dependent, or redeclared built-ins
478     //   3: user-shader globals
479     //
480 protected:
481     static const int globalLevel = 3;
482     bool isSharedLevel(int level)  { return level <= 1; }    // exclude all per-compile levels
483     bool isBuiltInLevel(int level) { return level <= 2; }    // exclude user globals
484     bool isGlobalLevel(int level)  { return level <= globalLevel; }    // include user globals
485 public:
486     bool isEmpty() { return table.size() == 0; }
487     bool atBuiltInLevel() { return isBuiltInLevel(currentLevel()); }
488     bool atGlobalLevel()  { return isGlobalLevel(currentLevel()); }
489
490     void setNoBuiltInRedeclarations() { noBuiltInRedeclarations = true; }
491     void setSeparateNameSpaces() { separateNameSpaces = true; }
492     
493     void push()
494     {
495         table.push_back(new TSymbolTableLevel);
496     }
497
498     void pop(TPrecisionQualifier *p)
499     {
500         table[currentLevel()]->getPreviousDefaultPrecisions(p);
501         delete table.back();
502         table.pop_back();
503     }
504
505     //
506     // Insert a visible symbol into the symbol table so it can
507     // be found later by name.
508     //
509     // Returns false if the was a name collision.
510     //
511     bool insert(TSymbol& symbol)
512     {
513         symbol.setUniqueId(++uniqueId);
514
515         // make sure there isn't a function of this variable name
516         if (! separateNameSpaces && ! symbol.getAsFunction() && table[currentLevel()]->hasFunctionName(symbol.getName()))
517             return false;
518             
519         // check for not overloading or redefining a built-in function
520         if (noBuiltInRedeclarations) {
521             if (atGlobalLevel() && currentLevel() > 0) {
522                 if (table[0]->hasFunctionName(symbol.getName()))
523                     return false;
524                 if (currentLevel() > 1 && table[1]->hasFunctionName(symbol.getName()))
525                     return false;
526             }
527         }
528
529         return table[currentLevel()]->insert(symbol, separateNameSpaces);
530     }
531
532     //
533     // To allocate an internal temporary, which will need to be uniquely
534     // identified by the consumer of the AST, but never need to 
535     // found by doing a symbol table search by name, hence allowed an
536     // arbitrary name in the symbol with no worry of collision.
537     //
538     void makeInternalVariable(TSymbol& symbol)
539     {
540         symbol.setUniqueId(++uniqueId);
541     }
542
543     //
544     // Copy a variable or anonymous member's structure from a shared level so that
545     // it can be added (soon after return) to the symbol table where it can be
546     // modified without impacting other users of the shared table.
547     //
548     TSymbol* copyUpDeferredInsert(TSymbol* shared)
549     {
550         if (shared->getAsVariable()) {
551             TSymbol* copy = shared->clone();
552             copy->setUniqueId(shared->getUniqueId());
553             return copy;
554         } else {
555             const TAnonMember* anon = shared->getAsAnonMember();
556             assert(anon);
557             TVariable* container = anon->getAnonContainer().clone();
558             container->changeName(NewPoolTString(""));
559             container->setUniqueId(anon->getAnonContainer().getUniqueId());
560             return container;
561         }
562     }
563
564     TSymbol* copyUp(TSymbol* shared)
565     {
566         TSymbol* copy = copyUpDeferredInsert(shared);
567         table[globalLevel]->insert(*copy, separateNameSpaces);
568         if (shared->getAsVariable())
569             return copy;
570         else {
571             // return the copy of the anonymous member
572             return table[globalLevel]->find(shared->getName());
573         }
574     }
575
576     TSymbol* find(const TString& name, bool* builtIn = 0, bool *currentScope = 0)
577     {
578         int level = currentLevel();
579         TSymbol* symbol;
580         do {
581             symbol = table[level]->find(name);
582             --level;
583         } while (symbol == 0 && level >= 0);
584         level++;
585         if (builtIn)
586             *builtIn = isBuiltInLevel(level);
587         if (currentScope)
588             *currentScope = isGlobalLevel(currentLevel()) || level == currentLevel();  // consider shared levels as "current scope" WRT user globals
589
590         return symbol;
591     }
592
593     bool isFunctionNameVariable(const TString& name) const
594     {
595         if (separateNameSpaces)
596             return false;
597
598         int level = currentLevel();
599         do {
600             bool variable;
601             bool found = table[level]->findFunctionVariableName(name, variable);
602             if (found)
603                 return variable;
604             --level;
605         } while (level >= 0);
606
607         return false;
608     }
609
610     void findFunctionNameList(const TString& name, TVector<TFunction*>& list, bool& builtIn)
611     {
612         // For user levels, return the set found in the first scope with a match
613         builtIn = false;
614         int level = currentLevel();
615         do {
616             table[level]->findFunctionNameList(name, list);
617             --level;
618         } while (list.empty() && level >= globalLevel);
619
620         if (! list.empty())
621             return;
622
623         // Gather across all built-in levels; they don't hide each other
624         builtIn = true;
625         do {
626             table[level]->findFunctionNameList(name, list);
627             --level;
628         } while (level >= 0);
629     }
630
631     void relateToOperator(const char* name, TOperator op)
632     {
633         for (unsigned int level = 0; level < table.size(); ++level)
634             table[level]->relateToOperator(name, op);
635     }
636     
637     void setFunctionExtensions(const char* name, int num, const char* const extensions[])
638     {
639         for (unsigned int level = 0; level < table.size(); ++level)
640             table[level]->setFunctionExtensions(name, num, extensions);
641     }
642
643     void setVariableExtensions(const char* name, int num, const char* const extensions[])
644     {
645         TSymbol* symbol = find(TString(name));
646         if (symbol)
647             symbol->setExtensions(num, extensions);
648     }
649
650     int getMaxSymbolId() { return uniqueId; }
651     void dump(TInfoSink &infoSink) const;
652         void copyTable(const TSymbolTable& copyOf);
653
654     void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); }
655
656     void readOnly()
657     {
658         for (unsigned int level = 0; level < table.size(); ++level)
659             table[level]->readOnly();
660     }
661
662 protected:
663     TSymbolTable(TSymbolTable&);
664     TSymbolTable& operator=(TSymbolTableLevel&);
665
666     int currentLevel() const { return static_cast<int>(table.size()) - 1; }
667
668     std::vector<TSymbolTableLevel*> table;
669     int uniqueId;     // for unique identification in code generation
670     bool noBuiltInRedeclarations;
671     bool separateNameSpaces;
672     unsigned int adoptedLevels;
673 };
674
675 } // end namespace glslang
676
677 #endif // _SYMBOL_TABLE_INCLUDED_