Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00018 #ifndef _LEXER_H_
00019 #define _LEXER_H_
00020
00021 #include <cstdlib>
00022
00023 #ifdef __APPLE__
00024 #include <xlocale.h>
00025 #endif
00026
00027 #include "GenApi/Types.h"
00028 #include "GenApi/impl/Internal_Compatibility.h"
00029 #include "SymTable.h"
00030
00031 typedef unsigned char uchar;
00032
00033 typedef enum
00034 {
00035 CH_LETTER = 0x01, CH_DIGIT = 0x02, CH_SEPARAT = 0x04,
00036 CH_SYMBOL = 0x08, CH_QUOTE = 0x10,
00037 CH_UNKNOWN = 0x7E, CH_FINAL = 0x7F
00038 } hqCharType;
00039
00040 typedef enum
00041 {
00042 TOK_ERROR, TOK_NONE, TOK_FINAL, TOK_INT, TOK_FLOAT, TOK_SYMBOL,
00043 TOK_NAME, TOK_STRING
00044 } hqTokenType;
00045
00046 class CLexer
00047 {
00048 char* m_pSS;
00049 char* SS;
00050 #ifdef _WIN32
00051 _locale_t CLocale;
00052 #else
00053 #ifndef VXWORKS
00054 locale_t CLocale;
00055 #endif
00056 #endif
00057 public:
00058 void SetParams( int cssn, const char ComEnd[], const CSymTable* SymTable, const hqCharType* CharTypeTable );
00059 private:
00060
00061 int cssn;
00062 char* ComEnd;
00063 const CSymTable* SymTable;
00064 const hqCharType* CharTypeTable;
00065 public:
00066
00067 char* Name;
00068 size_t NameLen;
00069 double ExtValue;
00070 int IntValue;
00071 hqTokenType PrevTokenType;
00072 hqCharType CharType;
00073 int NoIntegers;
00074 public:
00075 int SetParseString( const char* str );
00076 hqTokenType GetNextToken();
00077 CLexer();
00078 ~CLexer();
00079 char* GetCurrentPos();
00080 };
00081
00082
00083 #endif //_LEXER_H_