--- parser3/src/include/pa_symbols.h 2016/05/24 11:55:13 1.1 +++ parser3/src/include/pa_symbols.h 2016/11/21 19:31:56 1.6 @@ -8,22 +8,54 @@ #ifndef PA_SYMBOLS_H #define PA_SYMBOLS_H -#define IDENT_PA_SYMBOLS_H "$Id: pa_symbols.h,v 1.1 2016/05/24 11:55:13 moko Exp $" +#define IDENT_PA_SYMBOLS_H "$Id: pa_symbols.h,v 1.6 2016/11/21 19:31:56 moko Exp $" #include "pa_common.h" +// cache symbols for faster comparation +#define SYMBOLS_CACHING + +#ifdef SYMBOLS_CACHING +#define SYMBOLS_EQ(a,b) (&(a)==&(Symbols::b)) // pointer comparation +#else +#define SYMBOLS_EQ(a,b) ((a)==(Symbols::b)) // string comparation +#endif + class Symbols: public HashStringValue{ public: -void add(const String &astring); -const String *add(const char *astring); +static const String SELF_SYMBOL; +static const String CALLER_SYMBOL; +static const String RESULT_SYMBOL; + +static const String CLASS_SYMBOL; +static const String CLASS_NAME_SYMBOL; + +static const String METHOD_SYMBOL; + +static const String STATIC_SYMBOL; +static const String DYNAMIC_SYMBOL; -static const String *result; -static const String *caller; -static const String *self; +static const String LOCALS_SYMBOL; +static const String PARTIAL_SYMBOL; + +static const String REM_SYMBOL; + +static const String FIELDS_SYMBOL; +static const String _DEFAULT_SYMBOL; + +#ifdef SYMBOLS_CACHING +void add(const String &astring); +void set(const String &astring); static Symbols &instance(); +static void init(); +#endif }; +#ifdef SYMBOLS_CACHING +extern Symbols *symbols; +#endif + #endif