1 #ifndef _SimpleQueryParser_h_ 2 #define _SimpleQueryParser_h_ 3 4 // 5 // SimpleQueryParser.h 6 // 7 // SimpleQueryParser: (abstract) a family of parsers that generate queries 8 // for strings with the syntax (word|phrase){(word|phrase)} 9 // combining them in a single operator. 10 // The operator to apply is tbd by concrete classes. 11 // 12 // Part of the ht://Dig package <http://www.htdig.org/> 13 // Copyright (c) 1995-2004 The ht://Dig Group 14 // For copyright details, see the file COPYING in your distribution 15 // or the GNU Library General Public License (LGPL) version 2 or later 16 // <http://www.gnu.org/copyleft/lgpl.html> 17 // 18 // $Id: SimpleQueryParser.h,v 1.4 2004/05/28 13:15:24 lha Exp $ 19 // 20 21 #include "QueryParser.h" 22 #include "SimpleLexer.h" 23 24 // abstract 25 class OperatorQuery; 26 27 class SimpleQueryParser : public QueryParser 28 { 29 public: ~SimpleQueryParser()30 virtual ~SimpleQueryParser() {} 31 32 protected: SimpleQueryParser()33 SimpleQueryParser() {} 34 35 // get a combination query 36 virtual OperatorQuery *MakeQuery() = 0; 37 38 private: 39 // apply expr == term { term } 40 Query *ParseExpression(); 41 42 // apply term == word | phrase 43 Query *ParseTerm(); 44 45 // let the parent access the lexer Token()46 QueryLexer &Token() { return token; } 47 48 // the used lexer 49 SimpleLexer token; 50 }; 51 52 #endif 53