00001 #ifndef INC_QueryParser_hpp_ 00002 #define INC_QueryParser_hpp_ 00003 00004 #line 18 "indrilang.g" 00005 00006 #include "indri/QuerySpec.hpp" 00007 #include "indri/DateParse.hpp" 00008 #include "indri/delete_range.hpp" 00009 #include "indri/QueryLexer.hpp" 00010 00011 #line 12 "QueryParser.hpp" 00012 #include <antlr/config.hpp> 00013 /* $ANTLR 2.7.7 (2006-11-01): "indrilang.g" -> "QueryParser.hpp"$ */ 00014 #include <antlr/TokenStream.hpp> 00015 #include <antlr/TokenBuffer.hpp> 00016 #include "QueryLexerTokenTypes.hpp" 00017 #include <antlr/LLkParser.hpp> 00018 00019 ANTLR_BEGIN_NAMESPACE(indri) 00020 ANTLR_BEGIN_NAMESPACE(lang) 00021 class CUSTOM_API QueryParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public QueryLexerTokenTypes 00022 { 00023 #line 158 "indrilang.g" 00024 00025 private: 00026 // storage for allocated nodes 00027 std::vector<indri::lang::Node*> _nodes; 00028 // makes sure nodes go away when parser goes away 00029 indri::utility::VectorDeleter<indri::lang::Node*> _deleter; 00030 00031 indri::lang::RawExtentNode * innerMost( indri::lang::ScoredExtentNode* sr ) { 00032 indri::lang::RawExtentNode * ou = 0; 00033 // set the new outer node we need to pass down (the innermost of field or field list of 00034 // of this restriction) 00035 indri::lang::ExtentRestriction * er = dynamic_cast<indri::lang::ExtentRestriction *>(sr); 00036 if (er != 0) { 00037 indri::lang::RawExtentNode * f = er->getField(); 00038 indri::lang::ExtentInside * ei = dynamic_cast<indri::lang::ExtentInside *>(f); 00039 while (ei != 0) { 00040 f = ei->getInner(); 00041 ei = dynamic_cast<indri::lang::ExtentInside *>(f); 00042 } 00043 ou = f; 00044 } 00045 return ou; 00046 } 00047 00048 public: 00049 void init( QueryLexer* lexer ) { 00050 _deleter.setVector( _nodes ); 00051 } 00052 #line 23 "QueryParser.hpp" 00053 public: 00054 void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); 00055 protected: 00056 QueryParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); 00057 public: 00058 QueryParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); 00059 protected: 00060 QueryParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); 00061 public: 00062 QueryParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); 00063 QueryParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); 00064 int getNumTokens() const 00065 { 00066 return QueryParser::NUM_TOKENS; 00067 } 00068 const char* getTokenName( int type ) const 00069 { 00070 if( type > getNumTokens() ) return 0; 00071 return QueryParser::tokenNames[type]; 00072 } 00073 const char* const* getTokenNames() const 00074 { 00075 return QueryParser::tokenNames; 00076 } 00077 public: indri::lang::ScoredExtentNode* query(); 00078 public: indri::lang::ScoredExtentNode* scoredExtentNode( 00079 indri::lang::RawExtentNode * ou 00080 ); 00081 public: indri::lang::ScoredExtentNode* weightNode( 00082 indri::lang::RawExtentNode * ou 00083 ); 00084 public: indri::lang::ScoredExtentNode* combineNode( 00085 indri::lang::RawExtentNode * ou 00086 ); 00087 public: indri::lang::ScoredExtentNode* orNode( 00088 indri::lang::RawExtentNode * ou 00089 ); 00090 public: indri::lang::ScoredExtentNode* notNode( 00091 indri::lang::RawExtentNode * ou 00092 ); 00093 public: indri::lang::ScoredExtentNode* wandNode( 00094 indri::lang::RawExtentNode * ou 00095 ); 00096 public: indri::lang::ScoredExtentNode* wsumNode( 00097 indri::lang::RawExtentNode * ou 00098 ); 00099 public: indri::lang::ScoredExtentNode* maxNode( 00100 indri::lang::RawExtentNode * ou 00101 ); 00102 public: indri::lang::PriorNode* priorNode(); 00103 public: indri::lang::FilRejNode* filrejNode( 00104 indri::lang::RawExtentNode * ou 00105 ); 00106 public: indri::lang::FilReqNode* filreqNode( 00107 indri::lang::RawExtentNode * ou 00108 ); 00109 public: indri::lang::FilReqNode* scoreifNode( 00110 indri::lang::RawExtentNode * ou 00111 ); 00112 public: indri::lang::FilRejNode* scoreifnotNode( 00113 indri::lang::RawExtentNode * ou 00114 ); 00115 public: indri::lang::ScoredExtentNode* scoredRaw( 00116 indri::lang::RawExtentNode * ou 00117 ); 00118 public: RawExtentNode* qualifiedTerm(); 00119 public: ExtentOr* context_list( 00120 indri::lang::RawExtentNode * ou 00121 ); 00122 public: indri::lang::RawExtentNode* unqualifiedTerm(); 00123 public: indri::lang::ScoredExtentNode* weightedList( 00124 indri::lang::WeightedCombinationNode* wn, indri::lang::RawExtentNode * ou 00125 ); 00126 public: indri::lang::ScoredExtentNode* extentRestriction( 00127 indri::lang::ScoredExtentNode* sn, indri::lang::RawExtentNode * ou 00128 ); 00129 public: double floating(); 00130 public: indri::lang::ScoredExtentNode* sumList( 00131 indri::lang::WSumNode* wn, indri::lang::RawExtentNode * ou 00132 ); 00133 public: indri::lang::ScoredExtentNode* unweightedList( 00134 indri::lang::UnweightedCombinationNode* cn, indri::lang::RawExtentNode * ou 00135 ); 00136 public: indri::lang::ScoredExtentNode* sumNode( 00137 indri::lang::RawExtentNode * ou 00138 ); 00139 public: indri::lang::WeightedExtentOr* wsynNode(); 00140 public: RawExtentNode* unscoredTerm(); 00141 public: indri::lang::ODNode* odNode(); 00142 public: indri::lang::UWNode* uwNode(); 00143 public: indri::lang::BAndNode* bandNode(); 00144 public: indri::lang::Field* anyField(); 00145 public: std::string fieldNameString(); 00146 public: indri::lang::ExtentAnd* field_list(); 00147 public: indri::lang::FieldLessNode* dateBefore(); 00148 public: indri::lang::FieldGreaterNode* dateAfter(); 00149 public: indri::lang::FieldBetweenNode* dateBetween(); 00150 public: indri::lang::FieldEqualsNode* dateEquals(); 00151 public: indri::lang::ExtentOr* synonym_list(); 00152 public: indri::lang::ExtentOr* synonym_list_brace(); 00153 public: indri::lang::ExtentOr* synonym_list_alt(); 00154 public: indri::lang::FieldLessNode* lessNode(); 00155 public: indri::lang::FieldGreaterNode* greaterNode(); 00156 public: indri::lang::FieldBetweenNode* betweenNode(); 00157 public: indri::lang::FieldEqualsNode* equalsNode(); 00158 public: indri::lang::IndexTerm* rawText(); 00159 public: indri::lang::ODNode* hyphenTerm(); 00160 public: indri::lang::WildcardTerm* wildcardOpNode(); 00161 public: indri::lang::IndexTerm * hyphenate(); 00162 public: std::string fstring(); 00163 public: indri::lang::ExtentInside* path(); 00164 public: indri::lang::ExtentInside* pathOperator(); 00165 public: indri::lang::Field* field_restriction(); 00166 public: UINT64 date(); 00167 public: UINT64 slashDate(); 00168 public: UINT64 spaceDate(); 00169 public: UINT64 dashDate(); 00170 public: INT64 number(); 00171 public: 00172 ANTLR_USE_NAMESPACE(antlr)RefAST getAST() 00173 { 00174 return returnAST; 00175 } 00176 00177 protected: 00178 ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; 00179 private: 00180 static const char* tokenNames[]; 00181 #ifndef NO_STATIC_CONSTS 00182 static const int NUM_TOKENS = 69; 00183 #else 00184 enum { 00185 NUM_TOKENS = 69 00186 }; 00187 #endif 00188 00189 static const unsigned long _tokenSet_0_data_[]; 00190 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; 00191 static const unsigned long _tokenSet_1_data_[]; 00192 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; 00193 static const unsigned long _tokenSet_2_data_[]; 00194 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; 00195 static const unsigned long _tokenSet_3_data_[]; 00196 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; 00197 static const unsigned long _tokenSet_4_data_[]; 00198 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; 00199 static const unsigned long _tokenSet_5_data_[]; 00200 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; 00201 static const unsigned long _tokenSet_6_data_[]; 00202 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; 00203 static const unsigned long _tokenSet_7_data_[]; 00204 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; 00205 static const unsigned long _tokenSet_8_data_[]; 00206 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; 00207 static const unsigned long _tokenSet_9_data_[]; 00208 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; 00209 }; 00210 00211 ANTLR_END_NAMESPACE 00212 ANTLR_END_NAMESPACE 00213 #endif /*INC_QueryParser_hpp_*/