FirteX-高性能全文索引和检索平台API Documentation |
00001 #ifndef _LEXER_H 00002 #define _LEXER_H 00003 00004 #include "../utility/StdHeader.h" 00005 #include "QueryParserConstants.h" 00006 #include "../utility/FastCharStream.h" 00007 #include "../utility/StringReader.h" 00008 00009 using namespace firtex::utility; 00010 using namespace std; 00011 00012 00013 namespace firtex 00014 { 00015 namespace search 00016 { 00017 class CTokenList; 00018 class CQueryToken; 00019 class CLexer 00020 { 00021 public: 00022 CLexer(const tstring& query); 00023 CLexer(CStringReader* source); 00024 ~CLexer(); 00025 public: 00026 void lex(CTokenList *tokens); 00027 private: 00028 CQueryToken* getNextToken(); 00029 00033 string readIntegerNumber(const tchar ch); 00034 00035 #ifdef RANGE_QUERY 00036 00039 CQueryToken* readInclusiveRange(const tchar prev); 00040 00041 00045 CQueryToken* readExclusiveRange(const tchar prev); 00046 #endif 00047 00051 CQueryToken* readQuoted(const tchar prev); 00052 00056 CQueryToken* readTerm(const tchar prev); 00057 00061 string readEscape(const tchar prev); 00062 private: 00063 CFastCharStream* reader; 00064 bool bOwn; 00065 }; 00066 } 00067 } 00068 00069 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex