Lexer.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section: Vision Components
00004 //  Project: GenApi
00005 //  Author:  Margret Albrecht
00006 //  $Header$
00007 //
00008 //  License: Derived from Kirill Zaborski's MathParser library (http://kirya.narod.ru/mathparser.html ).
00009 //  This library comes under LGPL license (see http://www.gnu.org/licenses/lgpl.html).
00010 //  Kirill's implementation is a C++ port of the CCalc library from Walery Studennikov (http://www.sama.ru/~despair/ccalc/)
00011 //  which also comes under the LGPL.
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 
00032 
00033 typedef unsigned char uchar;
00034 
00035 typedef enum {
00036     CH_LETTER = 0x01, CH_DIGIT = 0x02, CH_SEPARAT = 0x04,
00037     CH_SYMBOL = 0x08, CH_QUOTE = 0x10,
00038     CH_UNKNOWN= 0x7E, CH_FINAL = 0x7F
00039 } hqCharType;
00040 
00041 typedef enum {
00042     TOK_ERROR, TOK_NONE, TOK_FINAL, TOK_INT, TOK_FLOAT, TOK_SYMBOL,
00043     TOK_NAME, TOK_STRING
00044 } hqTokenType;
00045 
00046 
00047 class CLexer{
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     // input params
00061     int        cssn;    // Comment Start Symbol Number. -1 if none
00062     char    *ComEnd;    // End of comment
00063     const CSymTable *SymTable;
00064     const hqCharType *CharTypeTable;
00065 public:
00066     // output params
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_


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:05