00001 #ifndef TAGCOLL_TAGEXPR_PARSER_H 00002 #define TAGCOLL_TAGEXPR_PARSER_H 00003 00004 /* 00005 * Parser for tag expressions 00006 * 00007 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #include <tagcoll/tagexpr/Tagexpr.h> 00025 #include <string> 00026 00027 namespace Tagcoll 00028 { 00029 00030 class TagexprParser 00031 { 00032 protected: 00033 static TagexprParser* _instance; 00034 00035 Tagexpr* result; 00036 std::string errorMessage; 00037 00038 public: 00039 // For use by the bison+yacc code 00040 void setResult(Tagexpr* result) throw () { this->result = result; } 00041 void addError(const std::string& message) throw () { errorMessage += message; } 00042 00043 // For use by the wide public 00044 Tagexpr* parse(const std::string& buffer) throw (); 00045 00046 // Get the error message for a failed parse 00047 const std::string& getErrorMessage() const throw () { return errorMessage; } 00048 std::string getErrorMessage() throw () { return errorMessage; } 00049 00050 static TagexprParser* instance() throw (); 00051 }; 00052 00053 }; 00054 00055 // vim:set ts=4 sw=4: 00056 #endif