TagexprParser.h

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

Generated on Fri Feb 8 10:50:41 2008 for libtagcoll by  doxygen 1.5.4